fix(configurator): lot pricing robust in totals + SO-create (not reliant on onchange)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -403,6 +403,8 @@ class FpDirectOrderWizard(models.Model):
|
||||
@api.depends(
|
||||
'line_ids.quantity',
|
||||
'line_ids.unit_price',
|
||||
'line_ids.is_lot_priced',
|
||||
'line_ids.lot_total',
|
||||
'charge_amount',
|
||||
'tooling_charge',
|
||||
'tax_id',
|
||||
@@ -419,7 +421,8 @@ class FpDirectOrderWizard(models.Model):
|
||||
"""
|
||||
for rec in self:
|
||||
subtotal = sum(
|
||||
(l.quantity or 0) * (l.unit_price or 0.0)
|
||||
(l.lot_total or 0.0) if l.is_lot_priced
|
||||
else (l.quantity or 0) * (l.unit_price or 0.0)
|
||||
for l in rec.line_ids
|
||||
)
|
||||
charge = rec.charge_amount or rec.tooling_charge or 0.0
|
||||
@@ -853,7 +856,11 @@ class FpDirectOrderWizard(models.Model):
|
||||
'product_id': product.id,
|
||||
'name': line_desc,
|
||||
'product_uom_qty': line.quantity,
|
||||
'price_unit': line.unit_price or 0.0,
|
||||
'price_unit': (
|
||||
(line.lot_total / line.quantity)
|
||||
if line.is_lot_priced and line.quantity
|
||||
else (line.unit_price or 0.0)
|
||||
),
|
||||
'x_fc_part_catalog_id': part.id,
|
||||
'x_fc_description_template_id': line.description_template_id.id or False,
|
||||
'x_fc_internal_description': line.internal_description or False,
|
||||
|
||||
Reference in New Issue
Block a user