Skip to content

Commit

Permalink
[ADD] oxigen_mrp: new module
Browse files Browse the repository at this point in the history
  • Loading branch information
eantones committed Aug 30, 2023
1 parent bfb39a3 commit 542756c
Show file tree
Hide file tree
Showing 15 changed files with 737 additions and 0 deletions.
59 changes: 59 additions & 0 deletions oxigen_mrp/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
==========
Oxigen MRP
==========

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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-oxigensalud%2Fodoo--addons-lightgray.png?logo=github
:target: https://github.com/oxigensalud/odoo-addons/tree/14.0/oxigen_mrp
:alt: oxigensalud/odoo-addons

|badge1| |badge2| |badge3|

* Added lot dates, product types and the logic to keep the integrity

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/oxigensalud/odoo-addons/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/oxigensalud/odoo-addons/issues/new?body=module:%20oxigen_mrp%0Aversion:%2014.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
~~~~~~~

* NuoBiT Solutions SL

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

* `NuoBiT <https://www.nuobit.com>`_:

* Eric Antones <[email protected]>

Maintainers
~~~~~~~~~~~

This module is part of the `oxigensalud/odoo-addons <https://github.com/oxigensalud/odoo-addons/tree/14.0/oxigen_mrp>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions oxigen_mrp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions oxigen_mrp/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright NuoBiT Solutions - Eric Antones <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

{
"name": "Oxigen MRP",
"summary": "Customizations for Oxigen in MRP application",
"version": "14.0.1.0.0",
"author": "NuoBiT Solutions SL",
"website": "https://github.com/oxigensalud/odoo-addons",
"category": "Manufacturing/Manufacturing",
"depends": ["mrp"],
"installable": True,
"license": "AGPL-3",
"data": [
"views/product_template.xml",
"views/stock_production_lot_views.xml",
],
}
100 changes: 100 additions & 0 deletions oxigen_mrp/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * oxigen_mrp
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-08-30 20:57+0000\n"
"PO-Revision-Date: 2023-08-30 20:57+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: oxigen_mrp
#: model:ir.model.fields.selection,name:oxigen_mrp.selection__product_template__mrp_type__cylinder
msgid "Cylinder"
msgstr "Cilindro"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_product_template__display_name
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__display_name
msgid "Display Name"
msgstr "Nombre mostrado"

#. module: oxigen_mrp
#: model:ir.model.fields.selection,name:oxigen_mrp.selection__product_template__mrp_type__empty_cylinder
msgid "Empty Cylinder"
msgstr "Cilindro vacío"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_product_template__id
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__id
msgid "ID"
msgstr ""

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_product_template____last_update
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot____last_update
msgid "Last Modified on"
msgstr "Última modificación el"

#. module: oxigen_mrp
#: model:ir.model,name:oxigen_mrp.model_stock_production_lot
msgid "Lot/Serial"
msgstr "Lote/Número de serie"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_product_product__mrp_type
#: model:ir.model.fields,field_description:oxigen_mrp.field_product_template__mrp_type
msgid "Type (MRP)"
msgstr "Tipo (MRP)"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__manufacture_date
msgid "Manufacture Date"
msgstr "Fecha fabricación"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__manufacturer
msgid "Manufacturer"
msgstr "Fabricante"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__mrp_fields_allowed
msgid "Mrp Fields Allowed"
msgstr ""

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__next_retesting_date
msgid "Next Retesting Date"
msgstr "Fecha próximo retimbrado"

#. module: oxigen_mrp
#: model:ir.model,name:oxigen_mrp.model_product_template
msgid "Product Template"
msgstr "Plantilla de producto"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__retesting_date
msgid "Retesting Date"
msgstr "Fecha retimbrado"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__valid_until_date
msgid "Valid Until Date"
msgstr "Fecha límite de uso"

#. module: oxigen_mrp
#: model:ir.model.fields.selection,name:oxigen_mrp.selection__product_template__mrp_type__valve
msgid "Valve"
msgstr "Válvula"

#. module: oxigen_mrp
#: model:ir.model.fields,field_description:oxigen_mrp.field_stock_production_lot__weight
msgid "Weight"
msgstr "Peso"
2 changes: 2 additions & 0 deletions oxigen_mrp/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import product_template
from . import stock_production_lot
15 changes: 15 additions & 0 deletions oxigen_mrp/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

mrp_type = fields.Selection(
string="Type (MRP)",
selection=[
("cylinder", "Cylinder"),
("valve", "Valve"),
("empty_cylinder", "Empty Cylinder"),
],
)
51 changes: 51 additions & 0 deletions oxigen_mrp/models/stock_production_lot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright NuoBiT Solutions - Eric Antones <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
import json

from odoo import api, fields, models

from odoo.addons.base_sparse_field.models.fields import Serialized


class ProductionLot(models.Model):
_inherit = "stock.production.lot"

def _get_product_mrp_workflow(self):
return {
"cylinder": {
"manufacturer",
"weight",
"manufacture_date",
"retesting_date",
"next_retesting_date",
},
"valve": {"manufacturer", "manufacture_date", "valid_until_date"},
"empty_cylinder": {
"manufacturer",
"manufacture_date",
"retesting_date",
"next_retesting_date",
},
}

manufacturer = fields.Many2one(
comodel_name="res.partner",
)
weight = fields.Float()
manufacture_date = fields.Date()
retesting_date = fields.Date()
next_retesting_date = fields.Date()
valid_until_date = fields.Date()

mrp_fields_allowed = Serialized(compute="_compute_mrp_fields_allowed")

@api.depends("product_id")
def _compute_mrp_fields_allowed(self):
allowed_fields = self._get_product_mrp_workflow()
for rec in self:
rec.mrp_fields_allowed = json.dumps(
list(allowed_fields.get(rec.product_id.mrp_type, set()))
)

# TODO: write and create methods to check the fields allowed and/or
# constraints to check the fields allowed
3 changes: 3 additions & 0 deletions oxigen_mrp/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `NuoBiT <https://www.nuobit.com>`_:

* Eric Antones <[email protected]>
1 change: 1 addition & 0 deletions oxigen_mrp/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Added lot dates, product types and the logic to keep the integrity
Binary file added oxigen_mrp/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 542756c

Please sign in to comment.