采购入库时,新增打印序列号方法

This commit is contained in:
jinling.yang
2024-01-24 17:30:59 +08:00
parent 2daeb01c4d
commit 8e3a316200
7 changed files with 430 additions and 527 deletions

View File

@@ -13,20 +13,23 @@ class StockMoveLine(models.Model):
picking_location_dest_id = fields.Many2one(related='picking_id.location_dest_id')
product_stock_quant_ids = fields.One2many('stock.quant', compute='_compute_product_stock_quant_ids')
product_packaging_id = fields.Many2one(related='move_id.product_packaging_id')
product_packaging_uom_qty = fields.Float('Packaging Quantity', compute='_compute_product_packaging_uom_qty', help="Quantity of the Packaging in the UoM of the Stock Move Line.")
product_packaging_uom_qty = fields.Float('Packaging Quantity', compute='_compute_product_packaging_uom_qty',
help="Quantity of the Packaging in the UoM of the Stock Move Line.")
is_completed = fields.Boolean(compute='_compute_is_completed', help="Check if the quantity done matches the demand")
@api.depends('product_id', 'product_id.stock_quant_ids')
def _compute_product_stock_quant_ids(self):
for line in self:
line.product_stock_quant_ids = line.product_id.stock_quant_ids.filtered(lambda q: q.company_id in self.env.companies and q.location_id.usage == 'internal')
line.product_stock_quant_ids = line.product_id.stock_quant_ids.filtered(
lambda q: q.company_id in self.env.companies and q.location_id.usage == 'internal')
def _compute_dummy_id(self):
self.dummy_id = ''
def _compute_product_packaging_uom_qty(self):
for sml in self:
sml.product_packaging_uom_qty = sml.product_packaging_id.product_uom_id._compute_quantity(sml.product_packaging_id.qty, sml.product_uom_id)
sml.product_packaging_uom_qty = sml.product_packaging_id.product_uom_id._compute_quantity(
sml.product_packaging_id.qty, sml.product_uom_id)
@api.depends('qty_done')
def _compute_is_completed(self):