交货数量修改

This commit is contained in:
guanhuan
2025-07-08 15:46:32 +08:00
parent 925c59e1fe
commit a2b2efed7d
2 changed files with 11 additions and 2 deletions

View File

@@ -62,7 +62,7 @@ class SfDemandPlan(models.Model):
model_machining_precision = fields.Selection(related='product_id.model_machining_precision', string='精度')
inventory_quantity_auto_apply = fields.Float(
string="成品库存",
compute='_compute_inventory_quantity_auto_apply', store=True
compute='_compute_inventory_quantity_auto_apply'
)
priority = fields.Selection([

View File

@@ -77,7 +77,7 @@ class SfProductionDemandPlan(models.Model):
qty_delivered = fields.Float(
"交货数量", related='sale_order_line_id.qty_delivered')
qty_to_deliver = fields.Float(
"待交货数量", related='sale_order_line_id.qty_to_deliver')
"待交货数量", compute='_compute_qty_to_deliver', store=True)
model_long = fields.Char('尺寸(mm)', compute='_compute_model_long')
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
related='product_id.blank_type')
@@ -212,6 +212,15 @@ class SfProductionDemandPlan(models.Model):
else:
line.supply_method = line.new_supply_method
@api.depends('sale_order_line_id.qty_to_deliver')
def _compute_qty_to_deliver(self):
for line in self:
if float_compare(line.sale_order_line_id.qty_to_deliver, 0,
precision_rounding=line.product_id.uom_id.rounding) == -1:
line.qty_to_deliver = 0
else:
line.qty_to_deliver = line.sale_order_line_id.qty_to_deliver
@api.depends('supply_method')
def _compute_route_ids(self):
for pdp in self: