Migrate version 3.4
This commit is contained in:
parent
5bbcac01b0
commit
82873a716e
|
@ -3,13 +3,10 @@
|
|||
#the full copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from .configuration import *
|
||||
from .country import *
|
||||
from .address import *
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
Configuration,
|
||||
Address,
|
||||
CountryZip,
|
||||
module='country_zip', type_='model')
|
||||
|
|
26
country.py
26
country.py
|
@ -1,26 +0,0 @@
|
|||
#This file is part country_zip module for Tryton.
|
||||
#The COPYRIGHT file at the top level of this repository contains
|
||||
#the full copyright notices and license terms.
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
|
||||
__all__ = ['CountryZip']
|
||||
|
||||
|
||||
class CountryZip(ModelSQL, ModelView):
|
||||
'Country Zip'
|
||||
__name__ = 'country.zip'
|
||||
_rec_name = 'zip'
|
||||
zip = fields.Char('Zip', required=True, select=1)
|
||||
city = fields.Char('City', select=1)
|
||||
subdivision = fields.Many2One('country.subdivision', 'Subdivision',
|
||||
ondelete='CASCADE', select=1)
|
||||
country = fields.Function(fields.Many2One('country.country', 'Country'),
|
||||
'get_country', searcher='search_country'
|
||||
)
|
||||
|
||||
def get_country(self, name):
|
||||
return self.subdivision.country.id
|
||||
|
||||
@classmethod
|
||||
def search_country(cls, name, clause):
|
||||
return [('subdivision.%s' % name,) + tuple(clause[1:])]
|
|
@ -5,4 +5,3 @@ depends:
|
|||
country
|
||||
xml:
|
||||
configuration.xml
|
||||
country.xml
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<form string="Country Zip">
|
||||
<label name="zip"/>
|
||||
<field name="zip"/>
|
||||
<label name="city"/>
|
||||
<field name="city"/>
|
||||
<label name="subdivision"/>
|
||||
<field name="subdivision"/>
|
||||
<label name="country"/>
|
||||
<field name="country"/>
|
||||
</form>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<tree string="Countries">
|
||||
<field name="zip"/>
|
||||
<field name="city"/>
|
||||
<field name="subdivision"/>
|
||||
<field name="country"/>
|
||||
</tree>
|
Loading…
Reference in New Issue