fix(promote-customer-spec): leftover has_cost_data ref in _compute_margin
Phase E removed the coating-rollup loop but left a stale `has_cost_data` reference in the percent computation. NameError on every SO list / form load. Margin is "not available" until recipe-level cost data exists (backlog item). Set all three margin fields to 0 / False explicitly so no stale references remain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -563,11 +563,8 @@ class SaleOrder(models.Model):
|
||||
"""
|
||||
for rec in self:
|
||||
rec.x_fc_margin_available = False
|
||||
rec.x_fc_margin_amount = (rec.amount_untaxed or 0)
|
||||
rec.x_fc_margin_percent = (
|
||||
(rec.x_fc_margin_amount / rec.amount_untaxed)
|
||||
if (rec.amount_untaxed and has_cost_data) else 0.0
|
||||
)
|
||||
rec.x_fc_margin_amount = 0.0
|
||||
rec.x_fc_margin_percent = 0.0
|
||||
|
||||
@api.onchange('upload_rfq_file')
|
||||
def _onchange_upload_rfq_file(self):
|
||||
|
||||
Reference in New Issue
Block a user