Browse Source

[12.0] [ADD] Domain on country_id for partner company type

12.0
Quentin Groulard 5 years ago
parent
commit
48b84c28bb
  1. 7
      partner_company_type/models/res_partner_company_type.py
  2. 1
      partner_company_type/readme/CONTRIBUTORS.rst
  3. 1
      partner_company_type/views/res_partner.xml
  4. 2
      partner_company_type/views/res_partner_company_type.xml

7
partner_company_type/models/res_partner_company_type.py

@ -18,6 +18,13 @@ class ResPartnerCompanyType(models.Model):
string='Abbreviation',
translate=True,
)
country_id = fields.Many2one(
comodel_name="res.country",
string="Country",
help="Allows this company type to be selected on partners from this "
"country only. "
"Leave it blank if you want it to appear on any partner.",
)
_sql_constraints = [('name_uniq', 'unique (name)',
"Partner Company Type already exists!")]

1
partner_company_type/readme/CONTRIBUTORS.rst

@ -1,2 +1,3 @@
* Denis Roussel <denis.roussel@acsone.eu> (https://acsone.eu)
* Gilles Meyomesse <gilles.meyomesse@acsone.eu> (https://acsone.eu)
* Quentin Groulard <quentin.groulard@acsone.eu> (https://acsone.eu)

1
partner_company_type/views/res_partner.xml

@ -10,6 +10,7 @@
<field name="arch" type="xml">
<field name="title" position="after">
<field name="partner_company_type_id" options='{"no_open": True}'
domain="['|', ('country_id', '=', False), ('country_id', '=', country_id)]"
attrs="{'invisible': [('is_company', '=', False)]}"/>
</field>
</field>

2
partner_company_type/views/res_partner_company_type.xml

@ -11,6 +11,7 @@
<group col="4">
<field name="name"/>
<field name="shortcut"/>
<field name="country_id"/>
</group>
</form>
</field>
@ -33,6 +34,7 @@
<tree>
<field name="name"/>
<field name="shortcut"/>
<field name="country_id"/>
</tree>
</field>
</record>

Loading…
Cancel
Save