Skip to content

Commit

Permalink
[REF] connector_oxigesti: store the code of the unbuild orders in Odo…
Browse files Browse the repository at this point in the history
…o_Orden_Produccion
  • Loading branch information
FrankC013 committed Sep 28, 2023
1 parent 8199e91 commit 2e05ab3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions connector_oxigesti/models/mrp_production/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class MrpProductionAdapter(Component):
_apply_on = "oxigesti.mrp.production"

_sql = """select a.Id, a.CodigoOrdenProduccion, a.FechaProduccion,
a.EsMontaje, a.CodigoBotellaVacia, a.LoteBotellaVacia,
a.CodigoCilindro, a.LoteCilindro, a.CodigoValvula,
a.LoteValvula
a.CodigoOrdenDeconstruccion, a.CodigoBotellaVacia,
a.LoteBotellaVacia, a.CodigoCilindro, a.LoteCilindro,
a.CodigoValvula, a.LoteValvula
from %(schema)s.Odoo_Orden_Produccion a
"""

Expand Down
10 changes: 5 additions & 5 deletions connector_oxigesti/models/mrp_production/export_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ def CodigoBotellaVacia(self, record):
return {"CodigoBotellaVacia": record.product_id.default_code}

Check warning on line 28 in connector_oxigesti/models/mrp_production/export_mapper.py

View check run for this annotation

Codecov / codecov/patch

connector_oxigesti/models/mrp_production/export_mapper.py#L28

Added line #L28 was not covered by tests

@mapping
def EsMontaje(self, record):
unbuild_count = self.env["mrp.unbuild"].search(
def CodigoOrdenDeconstruccion(self, record):
unbuild = self.env["mrp.unbuild"].search(

Check warning on line 32 in connector_oxigesti/models/mrp_production/export_mapper.py

View check run for this annotation

Codecov / codecov/patch

connector_oxigesti/models/mrp_production/export_mapper.py#L32

Added line #L32 was not covered by tests
[("mo_id", "=", record.odoo_id.id), ("state", "=", "done")]
)
if len(unbuild_count) > 1:
if len(unbuild) > 1:
raise ValidationError(

Check warning on line 36 in connector_oxigesti/models/mrp_production/export_mapper.py

View check run for this annotation

Codecov / codecov/patch

connector_oxigesti/models/mrp_production/export_mapper.py#L36

Added line #L36 was not covered by tests
_("The production %s has more than one unbuild. %s")
% (record.name, unbuild_count.mapped("name"))
% (record.name, unbuild.mapped("name"))
)
return {"EsMontaje": 0 if len(unbuild_count) > 0 else 1}
return {"CodigoOrdenDeconstruccion": unbuild.name or None}

Check warning on line 40 in connector_oxigesti/models/mrp_production/export_mapper.py

View check run for this annotation

Codecov / codecov/patch

connector_oxigesti/models/mrp_production/export_mapper.py#L40

Added line #L40 was not covered by tests

@mapping
def Componentes(self, record):
Expand Down

0 comments on commit 2e05ab3

Please sign in to comment.