Skip to content

Commit

Permalink
[ADD] nutritional_info_stock_lot: New module to add nutritional info …
Browse files Browse the repository at this point in the history
…at lots
  • Loading branch information
CarlosRoca13 committed Apr 27, 2023
1 parent 22d5f11 commit ad2fe11
Show file tree
Hide file tree
Showing 17 changed files with 779 additions and 0 deletions.
108 changes: 108 additions & 0 deletions nutritional_info_stock_lot/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/product-attribute/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 <https://github.com/OCA/product-attribute/issues/new?body=module:%20nutritional_info_stock_lot%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_

* 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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-CarlosRoca13|

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/15.0/nutritional_info_stock_lot>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions nutritional_info_stock_lot/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions nutritional_info_stock_lot/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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": [
"report/report_nutritional_info.xml",
"views/stock_production_lot_view.xml",
],
"application": False,
"installable": True,
}
48 changes: 48 additions & 0 deletions nutritional_info_stock_lot/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 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: 2023-04-27 13:22+0000\n"
"PO-Revision-Date: 2023-04-27 15:24+0200\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.2.2\n"

#. module: nutritional_info_stock_lot
#: model:ir.model.fields,field_description:nutritional_info_stock_lot.field_nutritional_value__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.model,name:nutritional_info_stock_lot.model_nutritional_value
msgid "Nutritional values for a given product"
msgstr "Valores nutricionales de un producto determinado"
46 changes: 46 additions & 0 deletions nutritional_info_stock_lot/i18n/nutritional_info_stock_lot.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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: 2023-04-27 13:22+0000\n"
"PO-Revision-Date: 2023-04-27 13:22+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_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.model,name:nutritional_info_stock_lot.model_nutritional_value
msgid "Nutritional values for a given product"
msgstr ""
2 changes: 2 additions & 0 deletions nutritional_info_stock_lot/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import nutritional_value
from . import stock_production_lot
9 changes: 9 additions & 0 deletions nutritional_info_stock_lot/models/nutritional_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 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"

lot_id = fields.Many2one(comodel_name="stock.production.lot")
12 changes: 12 additions & 0 deletions nutritional_info_stock_lot/models/stock_production_lot.py
Original file line number Diff line number Diff line change
@@ -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 StockProductionLot(models.Model):
_inherit = "stock.production.lot"

nutritional_value_ids = fields.One2many(
comodel_name="nutritional.value",
inverse_name="lot_id",
)
1 change: 1 addition & 0 deletions nutritional_info_stock_lot/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Follow the steps defined on module nutritional_info.
6 changes: 6 additions & 0 deletions nutritional_info_stock_lot/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* `Tecnativa <https://www.tecnativa.com>`_

* Carlos Roca
* Sergio Teruel
* Carlos Dauden
* Pedro M. Baeza
3 changes: 3 additions & 0 deletions nutritional_info_stock_lot/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions nutritional_info_stock_lot/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -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.
33 changes: 33 additions & 0 deletions nutritional_info_stock_lot/report/report_nutritional_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Tecnativa - Carlos Roca
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="stock_lot_nutritional_info_report">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<t t-foreach="docs" t-as="doc">
<h1><span t-field="doc.display_name" /> - <span
t-field="doc.product_id"
/></h1>
<t t-call="nutritional_info.nutritional_info_table">
<t t-set="main_object" t-value="doc" />
<t t-set="alt_object" t-value="doc.product_id" />
</t>
</t>
</t>
</t>
</template>
<record id="action_nutritional_info_template_report" model="ir.actions.report">
<field name="name">Nutritional Info</field>
<field name="model">stock.production.lot</field>
<field name="binding_model_id" ref="model_stock_production_lot" />
<field name="report_type">qweb-pdf</field>
<field
name="report_file"
>nutritional_info_stock_lot.stock_lot_nutritional_info_report</field>
<field
name="report_name"
>nutritional_info_stock_lot.stock_lot_nutritional_info_report</field>
<field name="paperformat_id" ref="base.paperformat_euro" />
</record>
</odoo>
Loading

0 comments on commit ad2fe11

Please sign in to comment.