Browse Source

[ADD] partner_contact_nutrition (#337)

* [ADD] partner_contact_nutrition
pull/342/head
Maxime Chambreuil 8 years ago
committed by GitHub
parent
commit
e068d8bcde
  1. 1
      oca_dependencies.txt
  2. 68
      partner_contact_nutrition/README.rst
  3. 5
      partner_contact_nutrition/__init__.py
  4. 20
      partner_contact_nutrition/__openerp__.py
  5. 5
      partner_contact_nutrition/models/__init__.py
  6. 36
      partner_contact_nutrition/models/res_partner.py
  7. BIN
      partner_contact_nutrition/static/description/icon.png
  8. 51
      partner_contact_nutrition/views/res_partner_view.xml
  9. 1
      setup/partner_contact_nutrition/odoo_addons/__init__.py
  10. 1
      setup/partner_contact_nutrition/odoo_addons/partner_contact_nutrition
  11. 6
      setup/partner_contact_nutrition/setup.py
  12. 1
      setup/partner_contact_nutrition_goal/odoo_addons/__init__.py
  13. 1
      setup/partner_contact_nutrition_goal/odoo_addons/partner_contact_nutrition_goal
  14. 6
      setup/partner_contact_nutrition_goal/setup.py

1
oca_dependencies.txt

@ -0,0 +1 @@
product-attribute

68
partner_contact_nutrition/README.rst

@ -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.

5
partner_contact_nutrition/__init__.py

@ -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

20
partner_contact_nutrition/__openerp__.py

@ -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",
],
}

5
partner_contact_nutrition/models/__init__.py

@ -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

36
partner_contact_nutrition/models/res_partner.py

@ -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)]"
)

BIN
partner_contact_nutrition/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

51
partner_contact_nutrition/views/res_partner_view.xml

@ -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>

1
setup/partner_contact_nutrition/odoo_addons/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/partner_contact_nutrition/odoo_addons/partner_contact_nutrition

@ -0,0 +1 @@
../../../partner_contact_nutrition

6
setup/partner_contact_nutrition/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

1
setup/partner_contact_nutrition_goal/odoo_addons/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/partner_contact_nutrition_goal/odoo_addons/partner_contact_nutrition_goal

@ -0,0 +1 @@
../../../partner_contact_nutrition_goal

6
setup/partner_contact_nutrition_goal/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save