Remove _columns dict
This commit is contained in:
1 parent
3030669230
commit
c8e441d5b4
5 files changed
+75
-90
No files matched your search
+23
-27
@@ -1,37 +1,33 @@
|
||||
from trytond.osv import fields, OSV
|
||||
STATES = {'readonly': "active == False",}
|
||||
STATES = {
|
||||
'readonly': "active == False",
|
||||
}
|
||||
|
||||
class Address(OSV):
|
||||
"Partner Address"
|
||||
|
||||
_name = 'partner.address'
|
||||
_description = __doc__
|
||||
_order = 'partner'
|
||||
|
||||
|
||||
|
||||
_columns = {
|
||||
'partner': fields.Many2One('partner.partner', 'Partner', required=True,
|
||||
ondelete='cascade', select=True, states= STATES,),
|
||||
'type': fields.Selection( [ ('default','Default'),('invoice','Invoice'),
|
||||
('delivery','Delivery'), ('contact','Contact'),
|
||||
('other','Other') ], 'Address Type', states= STATES,),
|
||||
'name': fields.Char('Contact Name', size=64, states= STATES,),
|
||||
'street': fields.Char('Street', size=128, states= STATES,),
|
||||
'streetbis': fields.Char('Street (bis)', size=128, states= STATES,),
|
||||
'zip': fields.Char('Zip', change_default=True, size=24,
|
||||
states= STATES,),
|
||||
'city': fields.Char('City', size=128, states= STATES,),
|
||||
'state': fields.Many2One("partner.state", 'State',
|
||||
domain="[('country_id','=',country_id)]", states= STATES,),
|
||||
'country': fields.Many2One('partner.country', 'Country',
|
||||
states= STATES,),
|
||||
'email': fields.Char('E-Mail', size=64, states= STATES,),
|
||||
'phone': fields.Char('Phone', size=64, states= STATES,),
|
||||
'fax': fields.Char('Fax', size=64, states= STATES,),
|
||||
'mobile': fields.Char('Mobile', size=64, states= STATES,),
|
||||
'active': fields.Boolean('Active'),
|
||||
}
|
||||
partner = fields.Many2One('partner.partner', 'Partner', required=True,
|
||||
ondelete='cascade', select=True, states=STATES)
|
||||
type = fields.Selection( [ ('default','Default'),('invoice','Invoice'),
|
||||
('delivery','Delivery'), ('contact','Contact'),
|
||||
('other','Other') ], 'Address Type', states=STATES)
|
||||
name = fields.Char('Contact Name', size=64, states=STATES)
|
||||
street = fields.Char('Street', size=128, states=STATES)
|
||||
streetbis = fields.Char('Street (bis)', size=128, states=STATES)
|
||||
zip = fields.Char('Zip', change_default=True, size=24,
|
||||
states=STATES)
|
||||
city = fields.Char('City', size=128, states=STATES)
|
||||
state = fields.Many2One("partner.state", 'State',
|
||||
domain="[('country_id','=',country_id)]", states=STATES)
|
||||
country = fields.Many2One('partner.country', 'Country',
|
||||
states=STATES)
|
||||
email = fields.Char('E-Mail', size=64, states=STATES)
|
||||
phone = fields.Char('Phone', size=64, states=STATES)
|
||||
fax = fields.Char('Fax', size=64, states=STATES)
|
||||
mobile = fields.Char('Mobile', size=64, states=STATES)
|
||||
active = fields.Boolean('Active')
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
}
|
||||
|
||||
+13
-16
@@ -1,30 +1,27 @@
|
||||
from trytond.osv import fields, OSV
|
||||
STATES = {'readonly': "active == False",}
|
||||
STATES = {
|
||||
'readonly': "active == False",
|
||||
}
|
||||
|
||||
|
||||
class Category(OSV):
|
||||
"Partner Category"
|
||||
|
||||
_name = "partner.category"
|
||||
_description = __doc__
|
||||
_order = 'parent,name'
|
||||
_parent_name = 'parent'
|
||||
|
||||
_columns = {
|
||||
'name': fields.Char('Category Name', required=True, size=64,
|
||||
states= STATES,),
|
||||
'parent': fields.Many2One('partner.category', 'Parent Category',
|
||||
select=True, states= STATES,),
|
||||
'complete_name': fields.Function('complete_name',
|
||||
type="char", string='Name', states= STATES,),
|
||||
'childs': fields.One2Many('partner.category', 'parent',
|
||||
'Childs Category', states= STATES,),
|
||||
'active' : fields.Boolean('Active'),
|
||||
}
|
||||
|
||||
name = fields.Char('Category Name', required=True, size=64,
|
||||
states=STATES)
|
||||
parent = fields.Many2One('partner.category', 'Parent Category',
|
||||
select=1, states=STATES)
|
||||
complete_name = fields.Function('complete_name',
|
||||
type="char", string='Name', states=STATES)
|
||||
childs = fields.One2Many('partner.category', 'parent',
|
||||
'Childs Category', states=STATES)
|
||||
active = fields.Boolean('Active')
|
||||
_defaults = {
|
||||
'active' : lambda *a: 1,
|
||||
}
|
||||
|
||||
_constraints = [
|
||||
('check_recursion',
|
||||
'Error! You can not create recursive categories.', ['parent'])
|
||||
|
||||
+10
-13
@@ -1,20 +1,19 @@
|
||||
from trytond.osv import fields, OSV
|
||||
STATES = {'readonly': "active == False",}
|
||||
STATES = {
|
||||
'readonly': "active == False",
|
||||
}
|
||||
|
||||
|
||||
class Country(OSV):
|
||||
'Partner Country'
|
||||
|
||||
_name = 'partner.country'
|
||||
_description = __doc__
|
||||
_order='code'
|
||||
|
||||
_columns = {
|
||||
'name': fields.Char('Country Name', size=64,
|
||||
help='The full name of the country.', required=True),
|
||||
'code': fields.Char('Country Code', size=2,
|
||||
help='The ISO country code in two chars.\n'
|
||||
'You can use this field for quick search.', required=True),
|
||||
}
|
||||
name = fields.Char('Country Name', size=64,
|
||||
help='The full name of the country.', required=True)
|
||||
code = fields.Char('Country Code', size=2,
|
||||
help='The ISO country code in two chars.\n'
|
||||
'You can use this field for quick search.', required=True)
|
||||
_sql_constraints = [
|
||||
('name_uniq', 'unique (name)',
|
||||
'The name of the country must be unique !'),
|
||||
@@ -37,17 +36,15 @@ class Country(OSV):
|
||||
limit=limit, context=context)
|
||||
return self.name_get(cr, user, ids, context)
|
||||
|
||||
|
||||
def create(self, cursor, user, vals, context=None):
|
||||
if 'code' in vals:
|
||||
vals['code'] = vals['code'].upper()
|
||||
return super(Country, self).create(cursor, user, vals, context=context)
|
||||
|
||||
|
||||
def write(self, cursor, user, ids, vals, context=None):
|
||||
if 'code' in vals:
|
||||
vals['code'] = vals['code'].upper()
|
||||
return super(Country, self).write(cursor, user, ids, vals,
|
||||
context=context)
|
||||
context=context)
|
||||
|
||||
Country()
|
||||
+21
-25
@@ -1,5 +1,7 @@
|
||||
from trytond.osv import fields, OSV
|
||||
STATES = {'readonly': "active == False",}
|
||||
STATES = {
|
||||
'readonly': "active == False",
|
||||
}
|
||||
|
||||
|
||||
class PartnerType(OSV):
|
||||
@@ -8,39 +10,33 @@ class PartnerType(OSV):
|
||||
_name = 'partner.partner.type'
|
||||
_description = __doc__
|
||||
_order= 'name'
|
||||
_columns = {
|
||||
'name': fields.Char('Name', required=True, size=64),
|
||||
}
|
||||
name = fields.Char('Name', required=True, size=64)
|
||||
|
||||
PartnerType()
|
||||
|
||||
|
||||
class Partner(OSV):
|
||||
"Partner"
|
||||
|
||||
_description = __doc__
|
||||
_name = "partner.partner"
|
||||
_order = "name"
|
||||
|
||||
_columns = {
|
||||
'name': fields.Char('Name', size=128, required=True, select=True,
|
||||
states=STATES,),
|
||||
'type': fields.Many2One("partner.partner.type", "Corp. Type",
|
||||
states=STATES,),
|
||||
'lang': fields.Many2One("ir.lang", 'Language',
|
||||
states=STATES,),
|
||||
'vat': fields.Char('VAT',size=32 ,help="Value Added Tax number",
|
||||
states=STATES,),
|
||||
'website': fields.Char('Website',size=64,
|
||||
states=STATES,),
|
||||
'addresses': fields.One2Many('partner.address', 'partner',
|
||||
'Addresses',states=STATES,),
|
||||
'categories': fields.Many2Many(
|
||||
'partner.category', 'partner_category_rel',
|
||||
'partner', 'category', 'Categories',
|
||||
states=STATES,),
|
||||
'active': fields.Boolean('Active'),
|
||||
}
|
||||
name = fields.Char('Name', size=128, required=True, select=True,
|
||||
states=STATES)
|
||||
type = fields.Many2One("partner.partner.type", "Type",
|
||||
states=STATES)
|
||||
lang = fields.Many2One("ir.lang", 'Language',
|
||||
states=STATES)
|
||||
vat = fields.Char('VAT',size=32 ,help="Value Added Tax number",
|
||||
states=STATES)
|
||||
website = fields.Char('Website',size=64,
|
||||
states=STATES)
|
||||
addresses = fields.One2Many('partner.address', 'partner',
|
||||
'Addresses',states=STATES)
|
||||
categories = fields.Many2Many(
|
||||
'partner.category', 'partner_category_rel',
|
||||
'partner', 'category', 'Categories',
|
||||
states=STATES)
|
||||
active = fields.Boolean('Active')
|
||||
_defaults = {
|
||||
'active': lambda *a: True,
|
||||
}
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
from trytond.osv import fields, OSV
|
||||
STATES = {'readonly': "active == False",}
|
||||
STATES = {
|
||||
'readonly': "active == False"
|
||||
}
|
||||
|
||||
|
||||
class State(OSV):
|
||||
"Country state"
|
||||
|
||||
_name = 'partner.state'
|
||||
_description = __doc__
|
||||
_order = 'code'
|
||||
|
||||
_columns = {
|
||||
'country': fields.Many2One('partner.country', 'Country',
|
||||
required=True),
|
||||
'name': fields.Char('State Name', size=64, required=True),
|
||||
'code': fields.Char('State Code', size=3, required=True),
|
||||
}
|
||||
country = fields.Many2One('partner.country', 'Country',
|
||||
required=True)
|
||||
name = fields.Char('State Name', size=64, required=True)
|
||||
code = fields.Char('State Code', size=3, required=True)
|
||||
|
||||
def create(self, cursor, user, vals, context=None):
|
||||
if 'code' in vals:
|
||||
|
||||
Reference in new issue
Block a user