This commit is contained in:
2026-03-22 14:53:53 +01:00
parent 1326c8df4c
commit 090b4ea5c6
2 changed files with 30 additions and 1 deletions

View File

@@ -763,7 +763,9 @@ class AssayElement(ModelSQL, ModelView):
class PayableRule(ModelSQL, ModelView):
"Payable Rule"
__name__ = 'payable.rule'
_rec_name = 'name'
name = fields.Char("Name")
element = fields.Many2One('assay.element', "Element")
payable_percent = fields.Numeric("Payable %")
@@ -774,7 +776,9 @@ class PayableRule(ModelSQL, ModelView):
class PenaltyRule(ModelSQL, ModelView):
"Penalty Rule"
__name__ = 'penalty.rule'
_rec_name = 'name'
name = fields.Char("Name")
element = fields.Many2One('assay.element', "Element")
threshold = fields.Numeric("Treshold")
@@ -984,6 +988,14 @@ class Line(metaclass=PoolMeta):
quality_analysis = fields.One2Many('quality.analysis','line',"Quality analysis")
assays = fields.One2Many('assay.assay','line',"Assays")
terms = fields.One2Many('concentrate.term','line',"Terms")
term = fields.Many2One('document.incoming',"Contract")
update_pricing = fields.Boolean("Update pricing")
assay_state = fields.Selection([
(None, ''),
('provisional', 'Provisional'),
('final', 'Final'),
('umpire', 'Umpire'),
], "Type")
@classmethod
def default_finished(cls):
@@ -1247,6 +1259,15 @@ class Line(metaclass=PoolMeta):
TR.save([tr])
def check_pricing(self):
if self.terms and self.update_pricing:
Pricing = Pool().get('pricing.component')
pricings = Pricing.search(['line','=',self.id])
if pricings:
Pricing.delete(pricings)
for t in self.terms:
pc = Pricing()
pc.curve = t.curve
if self.price_components:
for pc in self.price_components:
if not pc.auto:

View File

@@ -61,6 +61,14 @@ this repository contains the full copyright notices and license terms. -->
<field name="assays" mode="tree,form" view_ids="purchase_trade.assay_view_tree,purchase_trade.assay_view_form"/>
</page>
<page string="Term" col="4" id="te">
<label name="term"/>
<field name="term"/>
<newline/>
<label name="update_pricing"/>
<field name="update_pricing"/>
<label name="assay_state"/>
<field name="assay_state"/>
<newline/>
<field name="terms" mode="tree,form" view_ids="purchase_trade.concentrate_view_tree,purchase_trade.concentrate_view_form"/>
</page>
</notebook>