diff --git a/nutritional_info/README.rst b/nutritional_info/README.rst new file mode 100644 index 00000000000..e067875c6e1 --- /dev/null +++ b/nutritional_info/README.rst @@ -0,0 +1,109 @@ +================ +Nutritional Info +================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github + :target: https://github.com/OCA/product-attribute/tree/15.0/nutritional_info + :alt: OCA/product-attribute +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/product-attribute-15-0/product-attribute-15-0-nutritional_info + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/product-attribute&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to set the nutritional information for a given product. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To define the nutritional information, you have to define first the type of information +that can be filled on the products. + +To achieve this: + +- Go to Settings > General Settings > Nutritional Information +- Click on Nutritional Product Types +- Create the types to be used in the order they should appear on reports. + +Usage +===== + +To use this module you have to: + +- Create or edit a product variant or product template with just a variant. +- Go to Nutrition page +- Select the type and the value for the given product. + +Now you can print the "Nutritional Info" report. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_ + + * Carlos Roca + * Sergio Teruel + * Carlos Dauden + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-CarlosRoca13| image:: https://github.com/CarlosRoca13.png?size=40px + :target: https://github.com/CarlosRoca13 + :alt: CarlosRoca13 + +Current `maintainer `__: + +|maintainer-CarlosRoca13| + +This module is part of the `OCA/product-attribute `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/nutritional_info/__init__.py b/nutritional_info/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/nutritional_info/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/nutritional_info/__manifest__.py b/nutritional_info/__manifest__.py new file mode 100644 index 00000000000..41b039919b7 --- /dev/null +++ b/nutritional_info/__manifest__.py @@ -0,0 +1,28 @@ +# Copyright 2023 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Nutritional Info", + "summary": "Nutritional information.", + "version": "15.0.1.0.0", + "development_status": "Production/Stable", + "category": "Technical Settings", + "website": "https://github.com/OCA/product-attribute", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["CarlosRoca13"], + "license": "AGPL-3", + "depends": ["product"], + "data": [ + "report/report_nutritional_info.xml", + "security/ir.model.access.csv", + "views/nutritional_type_view.xml", + "views/product_views.xml", + "views/res_config_settings_view.xml", + ], + "application": False, + "installable": True, + "assets": { + "web.report_assets_common": [ + "nutritional_info/static/src/scss/nutrition_table_style.scss", + ] + }, +} diff --git a/nutritional_info/i18n/es.po b/nutritional_info/i18n/es.po new file mode 100644 index 00000000000..411a3b88f8d --- /dev/null +++ b/nutritional_info/i18n/es.po @@ -0,0 +1,166 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * nutritional_info +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-24 16:00+0000\n" +"PO-Revision-Date: 2024-01-24 17:02+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4.1\n" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.res_config_settings_view_form +msgid "Configure your nutritional types" +msgstr "Configura tus tipos nutricionales" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.nutritional_info_table_title +msgid ")" +msgstr ")" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.nutritional_info_table_title +msgid "Nutrition facts (" +msgstr "Valores nutricionales (" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__create_uid +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__create_date +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__display_name +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__id +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__id +msgid "ID" +msgstr "ID" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type____last_update +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value____last_update +msgid "Last Modified on" +msgstr "Última modificación el" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__write_uid +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__write_date +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__name +msgid "Name" +msgstr "Nombre" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:nutritional_info.product_template_only_form_view +msgid "Nutrition" +msgstr "Nutrición" + +#. module: nutritional_info +#: model:ir.actions.report,name:nutritional_info.action_nutritional_info_product_report +#: model:ir.actions.report,name:nutritional_info.action_nutritional_info_template_report +msgid "Nutritional Info" +msgstr "Información nutricional" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.res_config_settings_view_form +msgid "Nutritional Information" +msgstr "Información nutricional" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_product_product__nutritional_reference_uom +#: model:ir.model.fields,field_description:nutritional_info.field_product_template__nutritional_reference_uom +msgid "Nutritional Reference Uom" +msgstr "Unidad de medida de referencia nutricional" + +#. module: nutritional_info +#: model:ir.actions.act_window,name:nutritional_info.action_nutritional_type +#: model_terms:ir.ui.view,arch_db:nutritional_info.res_config_settings_view_form +msgid "Nutritional Types" +msgstr "Tipos nutricionales" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_product_product__nutritional_value_ids +#: model:ir.model.fields,field_description:nutritional_info.field_product_template__nutritional_value_ids +msgid "Nutritional Value" +msgstr "Valor nutricional" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_product_product__nutritional_reference_qty +#: model:ir.model.fields,field_description:nutritional_info.field_product_template__nutritional_reference_qty +msgid "Nutritional reference quantity" +msgstr "Cantidad de referencia nutricional" + +#. module: nutritional_info +#: model:ir.model,name:nutritional_info.model_nutritional_value +msgid "Nutritional values for a given product" +msgstr "Valores nutricionales de un producto determinado" + +#. module: nutritional_info +#: model:ir.model,name:nutritional_info.model_product_product +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__product_id +msgid "Product" +msgstr "Producto" + +#. module: nutritional_info +#: model:ir.model,name:nutritional_info.model_product_template +msgid "Product Template" +msgstr "Plantilla de producto" + +#. module: nutritional_info +#: code:addons/nutritional_info/models/product_template.py:0 +#, python-format +msgid "Repeating types of nutritional values is not allowed." +msgstr "No está permitido repetir los tipos de los valores nutricionales." + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__sequence +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__sequence +msgid "Sequence" +msgstr "Secuencia" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__type_id +msgid "Type" +msgstr "Tipo" + +#. module: nutritional_info +#: model:ir.model,name:nutritional_info.model_nutritional_type +msgid "Types used to inform about nutritional values at products." +msgstr "" +"Tipos utilizados para informar sobre los valores nutricionales de los " +"productos." + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__value +msgid "Value" +msgstr "Valor" diff --git a/nutritional_info/i18n/nutritional_info.pot b/nutritional_info/i18n/nutritional_info.pot new file mode 100644 index 00000000000..8303e2f3a8a --- /dev/null +++ b/nutritional_info/i18n/nutritional_info.pot @@ -0,0 +1,162 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * nutritional_info +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-24 16:00+0000\n" +"PO-Revision-Date: 2024-01-24 16:00+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.res_config_settings_view_form +msgid "Configure your nutritional types" +msgstr "" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.nutritional_info_table_title +msgid ")" +msgstr "" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.nutritional_info_table_title +msgid "Nutrition facts (" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__create_uid +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__create_uid +msgid "Created by" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__create_date +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__create_date +msgid "Created on" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__display_name +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__display_name +msgid "Display Name" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__id +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__id +msgid "ID" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type____last_update +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value____last_update +msgid "Last Modified on" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__write_uid +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__write_date +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__write_date +msgid "Last Updated on" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__name +msgid "Name" +msgstr "" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:nutritional_info.product_template_only_form_view +msgid "Nutrition" +msgstr "" + +#. module: nutritional_info +#: model:ir.actions.report,name:nutritional_info.action_nutritional_info_product_report +#: model:ir.actions.report,name:nutritional_info.action_nutritional_info_template_report +msgid "Nutritional Info" +msgstr "" + +#. module: nutritional_info +#: model_terms:ir.ui.view,arch_db:nutritional_info.res_config_settings_view_form +msgid "Nutritional Information" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_product_product__nutritional_reference_uom +#: model:ir.model.fields,field_description:nutritional_info.field_product_template__nutritional_reference_uom +msgid "Nutritional Reference Uom" +msgstr "" + +#. module: nutritional_info +#: model:ir.actions.act_window,name:nutritional_info.action_nutritional_type +#: model_terms:ir.ui.view,arch_db:nutritional_info.res_config_settings_view_form +msgid "Nutritional Types" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_product_product__nutritional_value_ids +#: model:ir.model.fields,field_description:nutritional_info.field_product_template__nutritional_value_ids +msgid "Nutritional Value" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_product_product__nutritional_reference_qty +#: model:ir.model.fields,field_description:nutritional_info.field_product_template__nutritional_reference_qty +msgid "Nutritional reference quantity" +msgstr "" + +#. module: nutritional_info +#: model:ir.model,name:nutritional_info.model_nutritional_value +msgid "Nutritional values for a given product" +msgstr "" + +#. module: nutritional_info +#: model:ir.model,name:nutritional_info.model_product_product +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__product_id +msgid "Product" +msgstr "" + +#. module: nutritional_info +#: model:ir.model,name:nutritional_info.model_product_template +msgid "Product Template" +msgstr "" + +#. module: nutritional_info +#: code:addons/nutritional_info/models/product_template.py:0 +#, python-format +msgid "Repeating types of nutritional values is not allowed." +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_type__sequence +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__sequence +msgid "Sequence" +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__type_id +msgid "Type" +msgstr "" + +#. module: nutritional_info +#: model:ir.model,name:nutritional_info.model_nutritional_type +msgid "Types used to inform about nutritional values at products." +msgstr "" + +#. module: nutritional_info +#: model:ir.model.fields,field_description:nutritional_info.field_nutritional_value__value +msgid "Value" +msgstr "" diff --git a/nutritional_info/models/__init__.py b/nutritional_info/models/__init__.py new file mode 100644 index 00000000000..cd2a1f2a20e --- /dev/null +++ b/nutritional_info/models/__init__.py @@ -0,0 +1,4 @@ +from . import nutritional_type +from . import nutritional_value +from . import product_product +from . import product_template diff --git a/nutritional_info/models/nutritional_type.py b/nutritional_info/models/nutritional_type.py new file mode 100644 index 00000000000..8446883d6fb --- /dev/null +++ b/nutritional_info/models/nutritional_type.py @@ -0,0 +1,12 @@ +# Copyright 2023 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class NutritionalType(models.Model): + _name = "nutritional.type" + _description = "Types used to inform about nutritional values at products." + _order = "sequence, id" + + sequence = fields.Integer(required=True) + name = fields.Char(translate=True) diff --git a/nutritional_info/models/nutritional_value.py b/nutritional_info/models/nutritional_value.py new file mode 100644 index 00000000000..81301209b0f --- /dev/null +++ b/nutritional_info/models/nutritional_value.py @@ -0,0 +1,14 @@ +# Copyright 2023 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class NutritionalValue(models.Model): + _name = "nutritional.value" + _description = "Nutritional values for a given product" + _order = "sequence, id" + + type_id = fields.Many2one(comodel_name="nutritional.type") + value = fields.Char() + sequence = fields.Integer(related="type_id.sequence") + product_id = fields.Many2one(comodel_name="product.product") diff --git a/nutritional_info/models/product_product.py b/nutritional_info/models/product_product.py new file mode 100644 index 00000000000..bb490c6f5f1 --- /dev/null +++ b/nutritional_info/models/product_product.py @@ -0,0 +1,19 @@ +# Copyright 2023 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class ProductProduct(models.Model): + _inherit = "product.product" + + nutritional_reference_qty = fields.Float( + string="Nutritional reference quantity", default=100 + ) + nutritional_reference_uom = fields.Many2one( + comodel_name="uom.uom", + default=lambda x: x.env.ref("uom.product_uom_gram", raise_if_not_found=False), + ) + nutritional_value_ids = fields.One2many( + comodel_name="nutritional.value", + inverse_name="product_id", + ) diff --git a/nutritional_info/models/product_template.py b/nutritional_info/models/product_template.py new file mode 100644 index 00000000000..ff3da5c0d08 --- /dev/null +++ b/nutritional_info/models/product_template.py @@ -0,0 +1,73 @@ +# Copyright 2023 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import _, api, fields, models +from odoo.exceptions import UserError + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + nutritional_reference_qty = fields.Float( + string="Nutritional reference quantity", + compute="_compute_nutritional_reference_qty", + inverse="_inverse_nutritional_reference_qty", + ) + nutritional_reference_uom = fields.Many2one( + comodel_name="uom.uom", + compute="_compute_nutritional_reference_uom", + inverse="_inverse_nutritional_reference_uom", + ) + nutritional_value_ids = fields.One2many( + comodel_name="nutritional.value", + compute="_compute_nutritional_value_ids", + inverse="_inverse_nutritional_value_ids", + ) + + @api.depends("product_variant_ids.nutritional_value_ids") + def _compute_nutritional_value_ids(self): + for template in self: + if template.product_variant_count == 1: + variant = template.product_variant_ids + template.nutritional_value_ids = variant.nutritional_value_ids + + def _inverse_nutritional_value_ids(self): + for template in self: + if template.product_variant_count == 1: + variant = template.product_variant_ids + variant.nutritional_value_ids = template.nutritional_value_ids + + @api.depends("product_variant_ids.nutritional_reference_uom") + def _compute_nutritional_reference_uom(self): + for template in self: + if template.product_variant_count == 1: + variant = template.product_variant_ids + template.nutritional_reference_uom = variant.nutritional_reference_uom + + def _inverse_nutritional_reference_uom(self): + for template in self: + if template.product_variant_count == 1: + variant = template.product_variant_ids + variant.nutritional_reference_uom = template.nutritional_reference_uom + + @api.depends("product_variant_ids.nutritional_reference_qty") + def _compute_nutritional_reference_qty(self): + for template in self: + if template.product_variant_count == 1: + variant = template.product_variant_ids + template.nutritional_reference_qty = variant.nutritional_reference_qty + + def _inverse_nutritional_reference_qty(self): + for template in self: + if template.product_variant_count == 1: + variant = template.product_variant_ids + variant.nutritional_reference_qty = template.nutritional_reference_qty + + @api.constrains("nutritional_value_ids", "nutritional_value_ids.type_id") + def _check_nutritional_type_not_repeated(self): + for prod in self: + if prod.nutritional_value_ids and len(prod.nutritional_value_ids) != len( + prod.nutritional_value_ids.type_id + ): + raise UserError( + _("Repeating types of nutritional values is not allowed.") + ) diff --git a/nutritional_info/readme/CONFIGURE.rst b/nutritional_info/readme/CONFIGURE.rst new file mode 100644 index 00000000000..663af2ff543 --- /dev/null +++ b/nutritional_info/readme/CONFIGURE.rst @@ -0,0 +1,8 @@ +To define the nutritional information, you have to define first the type of information +that can be filled on the products. + +To achieve this: + +- Go to Settings > General Settings > Nutritional Information +- Click on Nutritional Product Types +- Create the types to be used in the order they should appear on reports. diff --git a/nutritional_info/readme/CONTRIBUTORS.rst b/nutritional_info/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..6171341bb21 --- /dev/null +++ b/nutritional_info/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* `Tecnativa `_ + + * Carlos Roca + * Sergio Teruel + * Carlos Dauden + * Pedro M. Baeza diff --git a/nutritional_info/readme/DESCRIPTION.rst b/nutritional_info/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..7ba2963df85 --- /dev/null +++ b/nutritional_info/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows to set the nutritional information for a given product. diff --git a/nutritional_info/readme/USAGE.rst b/nutritional_info/readme/USAGE.rst new file mode 100644 index 00000000000..60fd61babbf --- /dev/null +++ b/nutritional_info/readme/USAGE.rst @@ -0,0 +1,7 @@ +To use this module you have to: + +- Create or edit a product variant or product template with just a variant. +- Go to Nutrition page +- Select the type and the value for the given product. + +Now you can print the "Nutritional Info" report. diff --git a/nutritional_info/report/report_nutritional_info.xml b/nutritional_info/report/report_nutritional_info.xml new file mode 100644 index 00000000000..f4d65398688 --- /dev/null +++ b/nutritional_info/report/report_nutritional_info.xml @@ -0,0 +1,135 @@ + + + + + + + + Nutritional Info + product.product + + qweb-pdf + nutritional_info.product_product_nutritional_info_report + nutritional_info.product_product_nutritional_info_report + + + + + Nutritional Info + product.template + + qweb-pdf + nutritional_info.product_template_nutritional_info_report + nutritional_info.product_template_nutritional_info_report + + + diff --git a/nutritional_info/security/ir.model.access.csv b/nutritional_info/security/ir.model.access.csv new file mode 100644 index 00000000000..9298fbb4894 --- /dev/null +++ b/nutritional_info/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_nutritional_value_employee,access_nutritional_value_employee,model_nutritional_value,base.group_user,1,0,0,0 +access_nutritional_value_manager,access_nutritional_value_manager,model_nutritional_value,base.group_system,1,1,1,1 +access_nutritional_type_employee,access_nutritional_type_employee,model_nutritional_type,base.group_user,1,0,0,0 +access_nutritional_type_manager,access_nutritional_type_manager,model_nutritional_type,base.group_system,1,1,1,1 diff --git a/nutritional_info/static/description/index.html b/nutritional_info/static/description/index.html new file mode 100644 index 00000000000..7130fb3f4ca --- /dev/null +++ b/nutritional_info/static/description/index.html @@ -0,0 +1,450 @@ + + + + + + +Nutritional Info + + + +
+

Nutritional Info

+ + +

Production/Stable License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runboat

+

This module allows to set the nutritional information for a given product.

+

Table of contents

+ +
+

Configuration

+

To define the nutritional information, you have to define first the type of information +that can be filled on the products.

+

To achieve this:

+
    +
  • Go to Settings > General Settings > Nutritional Information
  • +
  • Click on Nutritional Product Types
  • +
  • Create the types to be used in the order they should appear on reports.
  • +
+
+
+

Usage

+

To use this module you have to:

+
    +
  • Create or edit a product variant or product template with just a variant.
  • +
  • Go to Nutrition page
  • +
  • Select the type and the value for the given product.
  • +
+

Now you can print the “Nutritional Info” report.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa
      +
    • Carlos Roca
    • +
    • Sergio Teruel
    • +
    • Carlos Dauden
    • +
    • Pedro M. Baeza
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

CarlosRoca13

+

This module is part of the OCA/product-attribute project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/nutritional_info/static/src/scss/nutrition_table_style.scss b/nutritional_info/static/src/scss/nutrition_table_style.scss new file mode 100644 index 00000000000..8e8b3702579 --- /dev/null +++ b/nutritional_info/static/src/scss/nutrition_table_style.scss @@ -0,0 +1,25 @@ +.nutrition-table { + border-collapse: collapse; + width: 100%; + border: 1px solid; + + th { + border: 1px solid; + background-color: #d3d3d3; + text-align: center; + } + + td { + border: 1px solid; + padding-left: 5px; + padding-right: 5px; + + &.col-left { + width: 60%; + } + + &.col-right { + width: 30%; + } + } +} diff --git a/nutritional_info/views/nutritional_type_view.xml b/nutritional_info/views/nutritional_type_view.xml new file mode 100644 index 00000000000..21c9a3e0907 --- /dev/null +++ b/nutritional_info/views/nutritional_type_view.xml @@ -0,0 +1,21 @@ + + + + + product.nutritional.type.tree + nutritional.type + + + + + + + + + Nutritional Types + ir.actions.act_window + nutritional.type + tree + + diff --git a/nutritional_info/views/product_views.xml b/nutritional_info/views/product_views.xml new file mode 100644 index 00000000000..6a2f4f9d636 --- /dev/null +++ b/nutritional_info/views/product_views.xml @@ -0,0 +1,65 @@ + + + + + product.product + + + + + + + + + + + + + + + + + + + + + + + + product.template + + + + + + + + + + + + + + + + + + + + + + diff --git a/nutritional_info/views/res_config_settings_view.xml b/nutritional_info/views/res_config_settings_view.xml new file mode 100644 index 00000000000..67311468ac4 --- /dev/null +++ b/nutritional_info/views/res_config_settings_view.xml @@ -0,0 +1,40 @@ + + + + res.config.settings.view.form.inherit.product.nutritional + res.config.settings + + + +

Nutritional Information

+
+
+
+
+
+ Configure your nutritional types +
+
+
+
+
+
+
+
+
+
+
diff --git a/nutritional_info_stock_lot/README.rst b/nutritional_info_stock_lot/README.rst new file mode 100644 index 00000000000..86f1059682a --- /dev/null +++ b/nutritional_info_stock_lot/README.rst @@ -0,0 +1,108 @@ +========================== +Nutritional Info Stock Lot +========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github + :target: https://github.com/OCA/product-attribute/tree/15.0/nutritional_info_stock_lot + :alt: OCA/product-attribute +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/product-attribute-15-0/product-attribute-15-0-nutritional_info_stock_lot + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/product-attribute&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to set the nutritional information for a given lot. +The report will take the data of the product by default and it will overwrite the +values defined in the lot. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Follow the steps defined on module nutritional_info. + +Usage +===== + +Follow the seteps of nutritional_info module to define the nutritional info on product +variants. + +After that you can define new values on lots by: + +- Create or edit a lot of that product. +- Go to Nutrition page. +- Select the type and the value for the given lot. + +Now you can print the "Nutritional Info" report with the data of the lot combined with +the product information. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_ + + * Carlos Roca + * Sergio Teruel + * Carlos Dauden + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-CarlosRoca13| image:: https://github.com/CarlosRoca13.png?size=40px + :target: https://github.com/CarlosRoca13 + :alt: CarlosRoca13 + +Current `maintainer `__: + +|maintainer-CarlosRoca13| + +This module is part of the `OCA/product-attribute `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/nutritional_info_stock_lot/__init__.py b/nutritional_info_stock_lot/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/nutritional_info_stock_lot/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/nutritional_info_stock_lot/__manifest__.py b/nutritional_info_stock_lot/__manifest__.py new file mode 100644 index 00000000000..d9a56c0ec23 --- /dev/null +++ b/nutritional_info_stock_lot/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2023 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Nutritional Info Stock Lot", + "summary": "Nutritional information for lots.", + "version": "15.0.1.0.0", + "development_status": "Production/Stable", + "category": "Technical Settings", + "website": "https://github.com/OCA/product-attribute", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["CarlosRoca13"], + "license": "AGPL-3", + "depends": ["nutritional_info", "stock"], + "data": [ + "security/ir.model.access.csv", + "report/report_nutritional_info.xml", + "views/stock_menu_views.xml", + "views/stock_production_lot_view.xml", + ], + "application": False, + "installable": True, +} diff --git a/nutritional_info_stock_lot/i18n/es.po b/nutritional_info_stock_lot/i18n/es.po new file mode 100644 index 00000000000..2db2711c4dd --- /dev/null +++ b/nutritional_info_stock_lot/i18n/es.po @@ -0,0 +1,119 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * nutritional_info_stock_lot +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-24 16:02+0000\n" +"PO-Revision-Date: 2024-01-24 17:03+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.4.1\n" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__id +msgid "ID" +msgstr "ID" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__write_uid +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__write_date +msgid "Last Updated on" +msgstr "Última actualización el" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__lot_id +msgid "Lot" +msgstr "Lote" + +#. module: nutritional_info_stock_lot +#: model:ir.model,name:nutritional_info_stock_lot.model_stock_production_lot +msgid "Lot/Serial" +msgstr "Lote/Número de serie" + +#. module: nutritional_info_stock_lot +#: model_terms:ir.ui.view,arch_db:nutritional_info_stock_lot.product_normal_form_view +msgid "Nutrition" +msgstr "Nutrición" + +#. module: nutritional_info_stock_lot +#: model:ir.actions.report,name:nutritional_info_stock_lot.action_nutritional_info_template_report +msgid "Nutritional Info" +msgstr "Información nutricional" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_stock_production_lot__nutritional_value_ids +msgid "Nutritional Value" +msgstr "Valor nutricional" + +#. module: nutritional_info_stock_lot +#: model:ir.ui.menu,name:nutritional_info_stock_lot.nutritional_value_menu +msgid "Nutritional Values" +msgstr "Valores nutricionales" + +#. module: nutritional_info_stock_lot +#: model:ir.model,name:nutritional_info_stock_lot.model_nutritional_value_lot +msgid "Nutritional values for a given lot" +msgstr "Valores nutricionales de un lote determinado" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__product_id +msgid "Product" +msgstr "Producto" + +#. module: nutritional_info_stock_lot +#: code:addons/nutritional_info_stock_lot/models/stock_production_lot.py:0 +#, python-format +msgid "Repeating types of nutritional values is not allowed." +msgstr "No está permitido repetir los tipos de los valores nutricionales." + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__sequence +msgid "Sequence" +msgstr "Secuencia" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__type_id +msgid "Type" +msgstr "Tipo" + +#. module: nutritional_info_stock_lot +#: model:ir.ui.menu,name:nutritional_info_stock_lot.nutritional_value_type_menu +msgid "Types" +msgstr "Tipos" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__value +msgid "Value" +msgstr "Valor" diff --git a/nutritional_info_stock_lot/i18n/nutritional_info_stock_lot.pot b/nutritional_info_stock_lot/i18n/nutritional_info_stock_lot.pot new file mode 100644 index 00000000000..563a40f05b5 --- /dev/null +++ b/nutritional_info_stock_lot/i18n/nutritional_info_stock_lot.pot @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * nutritional_info_stock_lot +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-24 16:02+0000\n" +"PO-Revision-Date: 2024-01-24 16:02+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__create_uid +msgid "Created by" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__create_date +msgid "Created on" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__display_name +msgid "Display Name" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__id +msgid "ID" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot____last_update +msgid "Last Modified on" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__write_date +msgid "Last Updated on" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__lot_id +msgid "Lot" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model,name:nutritional_info_stock_lot.model_stock_production_lot +msgid "Lot/Serial" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model_terms:ir.ui.view,arch_db:nutritional_info_stock_lot.product_normal_form_view +msgid "Nutrition" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.actions.report,name:nutritional_info_stock_lot.action_nutritional_info_template_report +msgid "Nutritional Info" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_stock_production_lot__nutritional_value_ids +msgid "Nutritional Value" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.ui.menu,name:nutritional_info_stock_lot.nutritional_value_menu +msgid "Nutritional Values" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model,name:nutritional_info_stock_lot.model_nutritional_value_lot +msgid "Nutritional values for a given lot" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__product_id +msgid "Product" +msgstr "" + +#. module: nutritional_info_stock_lot +#: code:addons/nutritional_info_stock_lot/models/stock_production_lot.py:0 +#, python-format +msgid "Repeating types of nutritional values is not allowed." +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__sequence +msgid "Sequence" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__type_id +msgid "Type" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.ui.menu,name:nutritional_info_stock_lot.nutritional_value_type_menu +msgid "Types" +msgstr "" + +#. module: nutritional_info_stock_lot +#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value_lot__value +msgid "Value" +msgstr "" diff --git a/nutritional_info_stock_lot/models/__init__.py b/nutritional_info_stock_lot/models/__init__.py new file mode 100644 index 00000000000..8b0c9dc09f6 --- /dev/null +++ b/nutritional_info_stock_lot/models/__init__.py @@ -0,0 +1,2 @@ +from . import nutritional_value +from . import stock_production_lot diff --git a/nutritional_info_stock_lot/models/nutritional_value.py b/nutritional_info_stock_lot/models/nutritional_value.py new file mode 100644 index 00000000000..aad7f3350cc --- /dev/null +++ b/nutritional_info_stock_lot/models/nutritional_value.py @@ -0,0 +1,11 @@ +# Copyright 2023 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class NutritionalValue(models.Model): + _inherit = "nutritional.value" + _name = "nutritional.value.lot" + _description = "Nutritional values for a given lot" + + lot_id = fields.Many2one(comodel_name="stock.production.lot") diff --git a/nutritional_info_stock_lot/models/stock_production_lot.py b/nutritional_info_stock_lot/models/stock_production_lot.py new file mode 100644 index 00000000000..58117c55196 --- /dev/null +++ b/nutritional_info_stock_lot/models/stock_production_lot.py @@ -0,0 +1,23 @@ +# Copyright 2023 Tecnativa - Carlos Roca +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import _, api, fields, models +from odoo.exceptions import UserError + + +class StockProductionLot(models.Model): + _inherit = "stock.production.lot" + + nutritional_value_ids = fields.One2many( + comodel_name="nutritional.value.lot", + inverse_name="lot_id", + ) + + @api.constrains("nutritional_value_ids", "nutritional_value_ids.type_id") + def _check_nutritional_type_not_repeated(self): + for lot in self: + if lot.nutritional_value_ids and len(lot.nutritional_value_ids) != len( + lot.nutritional_value_ids.type_id + ): + raise UserError( + _("Repeating types of nutritional values is not allowed.") + ) diff --git a/nutritional_info_stock_lot/readme/CONFIGURE.rst b/nutritional_info_stock_lot/readme/CONFIGURE.rst new file mode 100644 index 00000000000..0b01e8db2c4 --- /dev/null +++ b/nutritional_info_stock_lot/readme/CONFIGURE.rst @@ -0,0 +1 @@ +Follow the steps defined on module nutritional_info. diff --git a/nutritional_info_stock_lot/readme/CONTRIBUTORS.rst b/nutritional_info_stock_lot/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..6171341bb21 --- /dev/null +++ b/nutritional_info_stock_lot/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* `Tecnativa `_ + + * Carlos Roca + * Sergio Teruel + * Carlos Dauden + * Pedro M. Baeza diff --git a/nutritional_info_stock_lot/readme/DESCRIPTION.rst b/nutritional_info_stock_lot/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..6956318e85e --- /dev/null +++ b/nutritional_info_stock_lot/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows to set the nutritional information for a given lot. +The report will take the data of the product by default and it will overwrite the +values defined in the lot. diff --git a/nutritional_info_stock_lot/readme/USAGE.rst b/nutritional_info_stock_lot/readme/USAGE.rst new file mode 100644 index 00000000000..a1781217937 --- /dev/null +++ b/nutritional_info_stock_lot/readme/USAGE.rst @@ -0,0 +1,11 @@ +Follow the seteps of nutritional_info module to define the nutritional info on product +variants. + +After that you can define new values on lots by: + +- Create or edit a lot of that product. +- Go to Nutrition page. +- Select the type and the value for the given lot. + +Now you can print the "Nutritional Info" report with the data of the lot combined with +the product information. diff --git a/nutritional_info_stock_lot/report/report_nutritional_info.xml b/nutritional_info_stock_lot/report/report_nutritional_info.xml new file mode 100644 index 00000000000..f0f91d30a1f --- /dev/null +++ b/nutritional_info_stock_lot/report/report_nutritional_info.xml @@ -0,0 +1,33 @@ + + + + + + Nutritional Info + stock.production.lot + + qweb-pdf + nutritional_info_stock_lot.stock_lot_nutritional_info_report + nutritional_info_stock_lot.stock_lot_nutritional_info_report + + + diff --git a/nutritional_info_stock_lot/security/ir.model.access.csv b/nutritional_info_stock_lot/security/ir.model.access.csv new file mode 100644 index 00000000000..5c8f975ef59 --- /dev/null +++ b/nutritional_info_stock_lot/security/ir.model.access.csv @@ -0,0 +1,6 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_nutritional_value_lot_employee,access_nutritional_value_lot_employee,model_nutritional_value_lot,base.group_user,1,0,0,0 +access_nutritional_value_lot_manager,access_nutritional_value_lot_manager,model_nutritional_value_lot,base.group_system,1,1,1,1 +access_nutritional_value_lot_stock,access_nutritional_value_lot_stock,model_nutritional_value_lot,stock.group_stock_user,1,1,1,1 +access_nutritional_type_manager,access_nutritional_type_manager,nutritional_info.model_nutritional_type,stock.group_stock_user,1,1,1,1 +access_nutritional_value_manager,access_nutritional_value_manager,nutritional_info.model_nutritional_value,stock.group_stock_user,1,1,1,1 diff --git a/nutritional_info_stock_lot/static/description/index.html b/nutritional_info_stock_lot/static/description/index.html new file mode 100644 index 00000000000..b421510e005 --- /dev/null +++ b/nutritional_info_stock_lot/static/description/index.html @@ -0,0 +1,448 @@ + + + + + + +Nutritional Info Stock Lot + + + +
+

Nutritional Info Stock Lot

+ + +

Production/Stable License: AGPL-3 OCA/product-attribute Translate me on Weblate Try me on Runboat

+

This module allows to set the nutritional information for a given lot. +The report will take the data of the product by default and it will overwrite the +values defined in the lot.

+

Table of contents

+ +
+

Configuration

+

Follow the steps defined on module nutritional_info.

+
+
+

Usage

+

Follow the seteps of nutritional_info module to define the nutritional info on product +variants.

+

After that you can define new values on lots by:

+
    +
  • Create or edit a lot of that product.
  • +
  • Go to Nutrition page.
  • +
  • Select the type and the value for the given lot.
  • +
+

Now you can print the “Nutritional Info” report with the data of the lot combined with +the product information.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa
      +
    • Carlos Roca
    • +
    • Sergio Teruel
    • +
    • Carlos Dauden
    • +
    • Pedro M. Baeza
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

CarlosRoca13

+

This module is part of the OCA/product-attribute project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/nutritional_info_stock_lot/views/stock_menu_views.xml b/nutritional_info_stock_lot/views/stock_menu_views.xml new file mode 100644 index 00000000000..ecfd0db9eb5 --- /dev/null +++ b/nutritional_info_stock_lot/views/stock_menu_views.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/nutritional_info_stock_lot/views/stock_production_lot_view.xml b/nutritional_info_stock_lot/views/stock_production_lot_view.xml new file mode 100644 index 00000000000..dfb447dd56b --- /dev/null +++ b/nutritional_info_stock_lot/views/stock_production_lot_view.xml @@ -0,0 +1,24 @@ + + + + + stock.production.lot + + + + + + + + + + + + + + + + + + diff --git a/setup/nutritional_info/odoo/addons/nutritional_info b/setup/nutritional_info/odoo/addons/nutritional_info new file mode 120000 index 00000000000..fb108517a52 --- /dev/null +++ b/setup/nutritional_info/odoo/addons/nutritional_info @@ -0,0 +1 @@ +../../../../nutritional_info \ No newline at end of file diff --git a/setup/nutritional_info/setup.py b/setup/nutritional_info/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/nutritional_info/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/nutritional_info_stock_lot/odoo/addons/nutritional_info_stock_lot b/setup/nutritional_info_stock_lot/odoo/addons/nutritional_info_stock_lot new file mode 120000 index 00000000000..57464dbc246 --- /dev/null +++ b/setup/nutritional_info_stock_lot/odoo/addons/nutritional_info_stock_lot @@ -0,0 +1 @@ +../../../../nutritional_info_stock_lot \ No newline at end of file diff --git a/setup/nutritional_info_stock_lot/setup.py b/setup/nutritional_info_stock_lot/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/nutritional_info_stock_lot/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)