RemiFr82
7 months ago
10 changed files with 131 additions and 16 deletions
-
1l10n_fr_association/__init__.py
-
3l10n_fr_association/__manifest__.py
-
40l10n_fr_association/hooks.py
-
39l10n_fr_association/i18n/fr.po
-
1l10n_fr_association/models/__init__.py
-
10l10n_fr_association/models/res_country.py
-
16l10n_fr_association/models/res_partner.py
-
30l10n_fr_association/views/res_country.xml
-
5l10n_fr_association/views/res_partner.xml
-
2l10n_fr_association/views/res_partner_relation_type.xml
@ -1,2 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import models |
|||
from .hooks import post_init_hook |
@ -0,0 +1,40 @@ |
|||
import logging |
|||
|
|||
from odoo.api import Environment, SUPERUSER_ID |
|||
|
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
# def pre_init_hook(cr, registry): |
|||
# env = Environment(cr, SUPERUSER_ID, {}) |
|||
# _logger.info("Pre init hook") |
|||
|
|||
|
|||
def post_init_hook(cr, registry): |
|||
env = Environment(cr, SUPERUSER_ID, {}) |
|||
env["res.country"].search( |
|||
[ |
|||
( |
|||
"code", |
|||
"in", |
|||
( |
|||
"FR", |
|||
"GP", |
|||
"MQ", |
|||
"GF", |
|||
"RE", |
|||
"YT", |
|||
), |
|||
) |
|||
] |
|||
).write( |
|||
{ |
|||
"is_french": True, |
|||
} |
|||
) |
|||
_logger.info("\n#####\nPost init hook for french associations passed...\n#####\n") |
|||
|
|||
|
|||
# def uninstall_hook(cr, registry): |
|||
# env = Environment(cr, SUPERUSER_ID, {}) |
|||
# _logger.info("Uninstall hook") |
@ -1,4 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import res_country |
|||
from . import res_partner_relation_instance |
|||
from . import res_partner_relation_type |
|||
from . import res_partner |
@ -0,0 +1,10 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class ResCountry(models.Model): |
|||
_inherit = "res.country" |
|||
|
|||
is_french = fields.Boolean( |
|||
string="French country", |
|||
) |
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="view_country_form_inherit_base" model="ir.ui.view"> |
|||
<field name="name">res.country.view.form.inherit</field> |
|||
<field name="model">res.country</field> |
|||
<field name="inherit_id" ref="base.view_country_form" /> |
|||
<field name="priority">30</field> |
|||
<field name="arch" type="xml"> |
|||
<field name="state_required" position="after"> |
|||
<field name="is_french" groups="base.group_no_one" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="res_country_view_search" model="ir.ui.view"> |
|||
<field name="name">res.country.view.search</field> |
|||
<field name="model">res.country</field> |
|||
<field name="arch" type="xml"> |
|||
<search> |
|||
<filter name="french" string="French" domain="[('is_french', '=', True)]" /> |
|||
<filter name="europe" string="Europe" domain="[('country_group_ids', 'in', %(base.europe)d)]" /> |
|||
<group name="group_by" expand="0"> |
|||
<filter name="by_group" string="Country Group" context="{'group_by': 'country_group_ids'}" /> |
|||
</group> |
|||
</search> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue