Browse Source

[FIX] domain (#345)

pull/213/merge
Maxime Chambreuil 8 years ago
committed by GitHub
parent
commit
50df5e59d1
  1. 2
      partner_contact_height/README.rst
  2. 6
      partner_contact_height/__openerp__.py
  3. 9
      partner_contact_height/models/res_partner.py
  4. 20
      partner_contact_height/views/res_partner_view.xml
  5. 2
      partner_contact_nutrition/README.rst
  6. 4
      partner_contact_nutrition/__openerp__.py
  7. 45
      partner_contact_nutrition/models/res_partner.py
  8. 74
      partner_contact_nutrition/views/res_partner_view.xml
  9. 6
      partner_contact_weight/__openerp__.py
  10. 10
      partner_contact_weight/models/res_partner.py
  11. 20
      partner_contact_weight/views/res_partner_view.xml

2
partner_contact_height/README.rst

@ -15,7 +15,7 @@ To use this module, you need to:
#. Go to Contacts
#. Create or select a contact
#. In the Personal Information tab, enter its height and the unit of measure
#. In the Personal Information tab, enter their height and the unit of measure
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot

6
partner_contact_height/__openerp__.py

@ -4,9 +4,9 @@
{
"name": "Partner Contact Height",
"summary": "Provide contact height.",
"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,

9
partner_contact_height/models/res_partner.py

@ -10,7 +10,8 @@ class ResPartner(models.Model):
_inherit = 'res.partner'
height = fields.Float("Height")
height_uom = fields.Many2one("product.uom", "Height UoM",
domain="[('category_id', '=', "
"self.env.ref('product.\
uom_categ_length').id)]")
height_uom = fields.Many2one(
"product.uom", "Height UoM",
domain=lambda self: [('category_id', '=',
self.env.ref('product.uom_categ_length').id)]
)

20
partner_contact_height/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="height"/>
<div>
<field name='height' class="oe_inline"/>
<field name='height_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
</xpath>
</data>
<xpath expr="//page[@name='personal_information_page']/group[@name='personal_information_group']">
<label for="height"/>
<div>
<field name='height' class="oe_inline"/>
<field name='height_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
</xpath>
</field>
</record>

2
partner_contact_nutrition/README.rst

@ -20,7 +20,7 @@ To use this module, you need to:
#. Go to Contacts
#. Create or select a contact
#. In the Nutrition tab, enter its intake information
#. In the Nutrition tab, enter their intake information
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot

4
partner_contact_nutrition/__openerp__.py

@ -4,8 +4,8 @@
{
"name": "Partner Contact Nutrition Information",
"summary": "Provide caloric intake",
"version": "9.0.1.0.0",
"category": "Uncategorized",
"version": "9.0.1.0.1",
"category": "Health",
"website": "http://ursainfosystems.com",
"author": "Ursa Information Systems, Odoo Community Association (OCA)",
"license": "AGPL-3",

45
partner_contact_nutrition/models/res_partner.py

@ -10,27 +10,30 @@ class ResPartner(models.Model):
_inherit = 'res.partner'
caloric_intake = fields.Float("Calories")
caloric_intake_uom = fields.Many2one("product.uom", "Calories UoM",
domain="[('category_id', '=', "
"self.env.ref('product_uom.\
product_category_energy').id)]"
)
caloric_intake_uom = fields.Many2one(
"product.uom", "Calories UoM",
domain=lambda self: [('category_id', '=',
self.env.ref(
'product_uom.product_category_energy').id)]
)
carbohydrate_intake = fields.Float("Carbohydrate")
carbohydrate_intake_uom = fields.Many2one("product.uom",
"Carbohydrate UoM",
domain="[('category_id', '=', "
"self.env.ref('product.\
product_uom_categ_kgm').id)]" # noqa
)
carbohydrate_intake_uom = fields.Many2one(
"product.uom", "Carbohydrate UoM",
domain=lambda self: [('category_id', '=',
self.env.ref('product.product_uom_categ_kgm').id)
]
)
fat_intake = fields.Float("Fat")
fat_intake_uom = fields.Many2one("product.uom", "Fat UoM",
domain="[('category_id', '=', "
"self.env.ref('product.\
product_uom_categ_kgm').id)]"
)
fat_intake_uom = fields.Many2one(
"product.uom", "Fat UoM",
domain=lambda self: [('category_id', '=',
self.env.ref('product.product_uom_categ_kgm').id)
]
)
protein_intake = fields.Float("Protein")
protein_intake_uom = fields.Many2one("product.uom", "Protein UoM",
domain="[('category_id', '=', "
"self.env.ref('product.\
product_uom_categ_kgm').id)]"
)
protein_intake_uom = fields.Many2one(
"product.uom", "Protein UoM",
domain=lambda self: [('category_id', '=',
self.env.ref('product.product_uom_categ_kgm').id)
]
)

74
partner_contact_nutrition/views/res_partner_view.xml

@ -6,45 +6,43 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//page[@name='sales_purchases']" position="before">
<page name="nutrition" string="Nutrition">
<group>
<group name="intake" string="Intake">
<label for="caloric_intake"/>
<div>
<field name='caloric_intake' class="oe_inline"/>
<field name='caloric_intake_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
<label for="carbohydrate_intake"/>
<div>
<field name='carbohydrate_intake' class="oe_inline"/>
<field name='carbohydrate_intake_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
<label for="fat_intake"/>
<div>
<field name='fat_intake' class="oe_inline"/>
<field name='fat_intake_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
<label for="protein_intake"/>
<div>
<field name='protein_intake' class="oe_inline"/>
<field name='protein_intake_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
</group>
<group name="other_info" string="Other info"/>
<xpath expr="//page[@name='sales_purchases']" position="before">
<page name="nutrition" string="Nutrition">
<group>
<group name="intake" string="Intake">
<label for="caloric_intake"/>
<div>
<field name='caloric_intake' class="oe_inline"/>
<field name='caloric_intake_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
<label for="carbohydrate_intake"/>
<div>
<field name='carbohydrate_intake' class="oe_inline"/>
<field name='carbohydrate_intake_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
<label for="fat_intake"/>
<div>
<field name='fat_intake' class="oe_inline"/>
<field name='fat_intake_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
<label for="protein_intake"/>
<div>
<field name='protein_intake' class="oe_inline"/>
<field name='protein_intake_uom'
class="oe_inline"
placeholder="UoM"/>
</div>
</group>
</page>
</xpath>
</data>
<group name="other_info" string="Other info"/>
</group>
</page>
</xpath>
</field>
</record>

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