committed by
Quentin THEURET
13 changed files with 982 additions and 924 deletions
-
4base_continent/README.rst
-
12base_continent/__manifest__.py
-
14base_continent/data/continent_data.xml
-
1033base_continent/data/country_data.xml
-
64base_continent/i18n/fr.po
-
23base_continent/migrations/10.0.1.0.1/post-migration.py
-
2base_continent/models/__init__.py
-
18base_continent/models/continent.py
-
9base_continent/models/country.py
-
12base_continent/models/partner.py
-
15base_continent/views/continent.xml
-
6base_continent/views/country.xml
-
6base_continent/views/partner.xml
@ -1,27 +1,37 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<openerp> |
|
||||
|
<odoo> |
||||
|
|
||||
<data noupdate="1"> |
<data noupdate="1"> |
||||
|
|
||||
<record id="af" model="res.continent"> |
<record id="af" model="res.continent"> |
||||
<field name="name">Africa</field> |
<field name="name">Africa</field> |
||||
|
<field name="code">AF</field> |
||||
</record> |
</record> |
||||
<record id="an" model="res.continent"> |
<record id="an" model="res.continent"> |
||||
<field name="name">Antarctica</field> |
<field name="name">Antarctica</field> |
||||
|
<field name="code">AN</field> |
||||
</record> |
</record> |
||||
<record id="as" model="res.continent"> |
<record id="as" model="res.continent"> |
||||
<field name="name">Asia</field> |
<field name="name">Asia</field> |
||||
|
<field name="code">AS</field> |
||||
</record> |
</record> |
||||
<record id="eu" model="res.continent"> |
<record id="eu" model="res.continent"> |
||||
<field name="name">Europe</field> |
<field name="name">Europe</field> |
||||
|
<field name="code">EU</field> |
||||
</record> |
</record> |
||||
<record id="na" model="res.continent"> |
<record id="na" model="res.continent"> |
||||
<field name="name">North America</field> |
<field name="name">North America</field> |
||||
|
<field name="code">NA</field> |
||||
</record> |
</record> |
||||
<record id="oc" model="res.continent"> |
<record id="oc" model="res.continent"> |
||||
<field name="name">Oceania</field> |
<field name="name">Oceania</field> |
||||
|
<field name="code">OC</field> |
||||
</record> |
</record> |
||||
<record id="sa" model="res.continent"> |
<record id="sa" model="res.continent"> |
||||
<field name="name">South America</field> |
<field name="name">South America</field> |
||||
|
<field name="code">SA</field> |
||||
</record> |
</record> |
||||
|
|
||||
</data> |
</data> |
||||
</openerp> |
|
||||
|
|
||||
|
</odoo> |
1033
base_continent/data/country_data.xml
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# © 2017 senseFly, Amaris (Author: Quentin Theuret) |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
|
|
||||
|
def migrate(cr, version): |
||||
|
continents = [ |
||||
|
('af', 'AF'), |
||||
|
('an', 'AN'), |
||||
|
('as', 'AS'), |
||||
|
('eu', 'EU'), |
||||
|
('na', 'NA'), |
||||
|
('oc', 'OC'), |
||||
|
('sa', 'SA'), |
||||
|
] |
||||
|
|
||||
|
for xml_id, code in continents: |
||||
|
cr.execute(""" |
||||
|
UPDATE res_continent SET code = %(code)s WHERE id = ( |
||||
|
SELECT res_id |
||||
|
FROM ir_model_data |
||||
|
WHERE model = 'res.continent' AND name = %(xml_id)s |
||||
|
);""", {'code': code, 'xml_id': xml_id}) |
@ -1,5 +1,5 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
|
|
||||
from . import base_continent |
|
||||
|
from . import continent |
||||
from . import country |
from . import country |
||||
from . import partner |
from . import partner |
@ -1,12 +1,17 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# © 2014-2016 Camptocamp SA (Author: Romain Deheele) |
# © 2014-2016 Camptocamp SA (Author: Romain Deheele) |
||||
|
# © 2017 senseFly, Amaris (Author: Quentin Theuret) |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
from openerp import models, fields |
|
||||
|
from odoo import models |
||||
|
from odoo import fields |
||||
|
|
||||
|
|
||||
class Country(models.Model): |
class Country(models.Model): |
||||
_inherit = 'res.country' |
_inherit = 'res.country' |
||||
|
|
||||
continent_id = fields.Many2one( |
continent_id = fields.Many2one( |
||||
'res.continent', string='Continent', ondelete='restrict') |
|
||||
|
comodel_name='res.continent', |
||||
|
string='Continent', |
||||
|
ondelete='restrict', |
||||
|
) |
@ -1,13 +1,19 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# © 2014-2016 Camptocamp SA (Author: Romain Deheele) |
# © 2014-2016 Camptocamp SA (Author: Romain Deheele) |
||||
|
# © 2017 senseFly, Amaris (Author: Quentin Theuret) |
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
||||
|
|
||||
from openerp import models, fields |
|
||||
|
from odoo import models |
||||
|
from odoo import fields |
||||
|
|
||||
|
|
||||
class Partner(models.Model): |
class Partner(models.Model): |
||||
_inherit = 'res.partner' |
_inherit = 'res.partner' |
||||
|
|
||||
continent_id = fields.Many2one( |
continent_id = fields.Many2one( |
||||
'res.continent', related='country_id.continent_id', |
|
||||
string='Continent', readonly=True, store=True) |
|
||||
|
'res.continent', |
||||
|
related='country_id.continent_id', |
||||
|
string='Continent', |
||||
|
readonly=True, |
||||
|
store=True, |
||||
|
) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue