Browse Source

domain (#345)

pull/395/head
Maxime Chambreuil 8 years ago
committed by Brett Wood
parent
commit
ad9dc8fe80
  1. 6
      partner_contact_weight/__openerp__.py
  2. 10
      partner_contact_weight/models/res_partner.py
  3. 20
      partner_contact_weight/views/res_partner_view.xml

6
partner_contact_weight/__openerp__.py

@ -4,9 +4,9 @@
{
"name": "Partner Contact Weight",
"summary": "Provide contact weight",
"version": "9.0.1.0.0",
"category": "Uncategorized",
"website": "https://ursainfosystems.com",
"version": "9.0.1.0.1",
"category": "Health",
"website": "http://ursainfosystems.com",
"author": "Ursa Information Systems, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,

10
partner_contact_weight/models/res_partner.py

@ -10,7 +10,9 @@ class ResPartner(models.Model):
_inherit = 'res.partner'
weight = fields.Float("Weight")
weight_uom = fields.Many2one("product.uom", "Weight UoM",
domain="[('category_id', '=', "
"self.env.ref('product.\
product_uom_categ_kgm').id)]")
weight_uom = fields.Many2one(
"product.uom", "Weight UoM",
domain=lambda self: [('category_id', '=',
self.env.ref('product.product_uom_categ_kgm').id)
]
)

20
partner_contact_weight/views/res_partner_view.xml

@ -6,17 +6,15 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_contact_personal_information_page.personal_information"/>
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='personal_information_page']/group[@name='personal_information_group']">
<label for="weight"/>
<div>
<field name='weight' class="oe_inline"/>
<field name='weight_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
</xpath>
</data>
<xpath expr="//page[@name='personal_information_page']/group[@name='personal_information_group']">
<label for="weight"/>
<div>
<field name='weight' class="oe_inline"/>
<field name='weight_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
</xpath>
</field>
</record>

Loading…
Cancel
Save