diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index f255d28b..b68b0ea0 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -222,6 +222,22 @@ class ProductionLot(models.Model): _name = 'stock.lot' _inherit = ['stock.lot', 'printing.utils'] + rfid = fields.Char('Rfid', readonly=True) + product_material_name = fields.Char('刀具产品物料名称', related='product_id.cutting_tool_material_id.name') + product_specification = fields.Char('规格', compute='_compute_product_specification', store=True) + + @api.depends('product_id') + def _compute_product_specification(self): + for stock in self: + if stock: + if stock.product_id: + if stock.product_id.categ_id.name in '刀具': + stock.product_specification = stock.product_id.specification_id.name + elif stock.product_id.categ_id.name in '夹具': + stock.product_specification = stock.product_id.specification_fixture_id.name + else: + stock.product_specification = stock.product_id.default_code + @api.model def generate_lot_names1(self, display_name, first_lot, count): """Generate `lot_names` from a string.""" diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index 0ae0d95f..6ba78573 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -422,7 +422,8 @@
规格: - + +
[] diff --git a/sf_manufacturing/views/stock_lot_views.xml b/sf_manufacturing/views/stock_lot_views.xml index bd04005c..f7ef9c9b 100644 --- a/sf_manufacturing/views/stock_lot_views.xml +++ b/sf_manufacturing/views/stock_lot_views.xml @@ -13,6 +13,12 @@