This commit is contained in:
gsinghpal
2026-04-20 01:16:12 -04:00
parent 8217bb0ff6
commit 54e56ed0e6
39 changed files with 5600 additions and 1131 deletions

View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
"""Add the configurator-side `pricing_rule_ids` field to process nodes.
Lives here (not in core fusion_plating) so the core module doesn't have
to depend on the configurator.
"""
from odoo import fields, models
class FpProcessNode(models.Model):
_inherit = 'fusion.plating.process.node'
pricing_rule_ids = fields.Many2many(
'fp.pricing.rule',
relation='fp_process_node_pricing_rule_rel',
column1='node_id',
column2='rule_id',
string='Price Builders',
help='Pricing rules to apply when this recipe is selected on a '
'quotation (mirrors Steelhead "Use Price Builders").',
)

View File

@@ -439,10 +439,28 @@ class FpQuoteConfigurator(models.Model):
Scores rules by specificity -- most specific match wins.
If no rule matches filters, returns None.
When the chosen coating config points at a recipe and that recipe
has `pricing_rule_ids` configured, the search is constrained to
those rules ("Use Price Builders" semantics). Otherwise the
whole active rule set is considered as before.
"""
rules = self.env['fp.pricing.rule'].search(
[('active', '=', True)], order='sequence, id'
recipe = (
self.coating_config_id.recipe_id
if self.coating_config_id and self.coating_config_id.recipe_id
else False
)
builder_rules = (
recipe.pricing_rule_ids if recipe else self.env['fp.pricing.rule']
)
if builder_rules:
rules = builder_rules.filtered('active').sorted(
lambda r: (r.sequence, r.id)
)
else:
rules = self.env['fp.pricing.rule'].search(
[('active', '=', True)], order='sequence, id'
)
cert_level = (
self.coating_config_id.certification_level
if self.coating_config_id else False