Maxime Chambreuil
8 years ago
committed by
Dave Lasley
7 changed files with 185 additions and 0 deletions
-
68partner_contact_nutrition/README.rst
-
5partner_contact_nutrition/__init__.py
-
20partner_contact_nutrition/__openerp__.py
-
5partner_contact_nutrition/models/__init__.py
-
36partner_contact_nutrition/models/res_partner.py
-
BINpartner_contact_nutrition/static/description/icon.png
-
51partner_contact_nutrition/views/res_partner_view.xml
@ -0,0 +1,68 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
========================= |
|||
Partner Contact Nutrition |
|||
========================= |
|||
|
|||
This module adds a 'Nutrition' tab to a contact with the following information: |
|||
|
|||
* Calories |
|||
* Carbohydrate |
|||
* Fat |
|||
* Protein |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
To use this module, you need to: |
|||
|
|||
#. Go to Contacts |
|||
#. Create or select a contact |
|||
#. In the Nutrition tab, enter its intake information |
|||
|
|||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/134/9.0 |
|||
|
|||
Known issues / Roadmap |
|||
====================== |
|||
|
|||
* ... |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues |
|||
<https://github.com/OCA/partner-contact/issues>`_. In case of trouble, please |
|||
check there if your issue has already been reported. If you spotted it first, |
|||
help us smashing it by providing a detailed and welcomed feedback. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Images |
|||
------ |
|||
|
|||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Maxime Chambreuil <mchambreuil@ursainfosystems.com> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose |
|||
mission is to support the collaborative development of Odoo features and |
|||
promote its widespread use. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 Ursa Information Systems <http://ursainfosystems.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from . import models |
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 Ursa Information Systems <http://ursainfosystems.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
{ |
|||
"name": "Partner Contact Nutrition Information", |
|||
"summary": "Provide caloric intake", |
|||
"version": "9.0.1.0.0", |
|||
"category": "Uncategorized", |
|||
"website": "http://ursainfosystems.com", |
|||
"author": "Ursa Information Systems, Odoo Community Association (OCA)", |
|||
"license": "AGPL-3", |
|||
"application": False, |
|||
"installable": True, |
|||
"depends": [ |
|||
"product_uom", |
|||
], |
|||
"data": [ |
|||
"views/res_partner_view.xml", |
|||
], |
|||
} |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 Ursa Information Systems <http://ursainfosystems.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from . import res_partner |
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 Ursa Information Systems <http://ursainfosystems.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
|
|||
from openerp import fields, models |
|||
|
|||
|
|||
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)]" |
|||
) |
|||
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 |
|||
) |
|||
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)]" |
|||
) |
|||
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)]" |
|||
) |
After Width: 128 | Height: 128 | Size: 9.2 KiB |
@ -0,0 +1,51 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="view_nutrition_information" model="ir.ui.view"> |
|||
<field name="name">Partner Contact Nutrition</field> |
|||
<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"/> |
|||
</group> |
|||
</page> |
|||
</xpath> |
|||
</data> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue