From 2e05ab30c79182d194eb7738bc0ed49c9852edc3 Mon Sep 17 00:00:00 2001 From: FrankC013 Date: Thu, 28 Sep 2023 10:14:47 +0200 Subject: [PATCH] [REF] connector_oxigesti: store the code of the unbuild orders in Odoo_Orden_Produccion --- connector_oxigesti/models/mrp_production/adapter.py | 6 +++--- .../models/mrp_production/export_mapper.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/connector_oxigesti/models/mrp_production/adapter.py b/connector_oxigesti/models/mrp_production/adapter.py index 0d3c2832b..085db875e 100644 --- a/connector_oxigesti/models/mrp_production/adapter.py +++ b/connector_oxigesti/models/mrp_production/adapter.py @@ -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 """ diff --git a/connector_oxigesti/models/mrp_production/export_mapper.py b/connector_oxigesti/models/mrp_production/export_mapper.py index c5e60262b..3e4b2f6e5 100644 --- a/connector_oxigesti/models/mrp_production/export_mapper.py +++ b/connector_oxigesti/models/mrp_production/export_mapper.py @@ -28,16 +28,16 @@ def CodigoBotellaVacia(self, record): return {"CodigoBotellaVacia": record.product_id.default_code} @mapping - def EsMontaje(self, record): - unbuild_count = self.env["mrp.unbuild"].search( + def CodigoOrdenDeconstruccion(self, record): + unbuild = self.env["mrp.unbuild"].search( [("mo_id", "=", record.odoo_id.id), ("state", "=", "done")] ) - if len(unbuild_count) > 1: + if len(unbuild) > 1: raise ValidationError( _("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} @mapping def Componentes(self, record):