This commit is contained in:
2026-04-01 21:40:32 +02:00
parent ac988a714a
commit ea2627c9ae
6 changed files with 109 additions and 94 deletions

View File

@@ -1087,14 +1087,17 @@ class Line(metaclass=PoolMeta):
enable_linked_currency = fields.Boolean("Linked currencies")
linked_price = fields.Numeric("Price", digits='unit',states={
'invisible': (~Eval('enable_linked_currency')),
'required': Eval('enable_linked_currency'),
'readonly': Eval('price_type') == 'basis',
}, depends=['enable_linked_currency', 'price_type'])
linked_currency = fields.Many2One('currency.linked',"Currency",states={
'invisible': (~Eval('enable_linked_currency')),
})
'required': Eval('enable_linked_currency'),
}, depends=['enable_linked_currency'])
linked_unit = fields.Many2One('product.uom', 'Unit',states={
'invisible': (~Eval('enable_linked_currency')),
})
'required': Eval('enable_linked_currency'),
}, depends=['enable_linked_currency'])
premium = fields.Numeric("Premium/Discount",digits='unit')
fee_ = fields.Many2One('fee.fee',"Fee")

View File

@@ -632,14 +632,17 @@ class SaleLine(metaclass=PoolMeta):
enable_linked_currency = fields.Boolean("Linked currencies")
linked_price = fields.Numeric("Price", digits='unit',states={
'invisible': (~Eval('enable_linked_currency')),
'required': Eval('enable_linked_currency'),
'readonly': Eval('price_type') == 'basis',
}, depends=['enable_linked_currency', 'price_type'])
linked_currency = fields.Many2One('currency.linked',"Currency",states={
'invisible': (~Eval('enable_linked_currency')),
})
'required': Eval('enable_linked_currency'),
}, depends=['enable_linked_currency'])
linked_unit = fields.Many2One('product.uom', 'Unit',states={
'invisible': (~Eval('enable_linked_currency')),
})
'required': Eval('enable_linked_currency'),
}, depends=['enable_linked_currency'])
premium = fields.Numeric("Premium/Discount",digits='unit')
fee_ = fields.Many2One('fee.fee',"Fee")
@@ -1098,6 +1101,7 @@ class SaleLine(metaclass=PoolMeta):
def validate(cls, salelines):
LotQtHist = Pool().get('lot.qt.hist')
LotQtType = Pool().get('lot.qt.type')
Pnl = Pool().get('valuation.valuation')
super(SaleLine, cls).validate(salelines)
for line in salelines:
if line.price_components:
@@ -1141,16 +1145,20 @@ class SaleLine(metaclass=PoolMeta):
#generate valuation for purchase and sale
LotQt = Pool().get('lot.qt')
line = cls(line.id)
generated_purchase_side = False
if line.lots:
for lot in line.lots:
lqts = LotQt.search([('lot_s','=',lot.id),('lot_p','>',0)])
logger.info("VALIDATE_SL:%s",lqts)
if lqts:
generated_purchase_side = True
purchase_lines = [e.lot_p.line for e in lqts]
if purchase_lines:
for pl in purchase_lines:
Pnl = Pool().get('valuation.valuation')
Pnl.generate(pl)
if line.lots and not generated_purchase_side:
Pnl.generate_from_sale_line(line)
class SaleCreatePurchase(Wizard):
"Create mirror purchase"

View File

@@ -9,27 +9,27 @@ this repository contains the full copyright notices and license terms. -->
<label name="finished"/>
<field name="finished"/>
<newline/>
<label name="price_type"/>
<field name="price_type"/>
<label name="enable_linked_currency"/>
<field name="enable_linked_currency"/>
<newline/>
<label name="linked_price"/>
<field name="linked_price"/>
<label name="linked_currency"/>
<field name="linked_currency"/>
<label name="linked_unit"/>
<field name="linked_unit"/>
<newline/>
<label name="linked_price"/>
<field name="linked_price"/>
<label name="premium"/>
<field name="premium"/>
<newline/>
</xpath>
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
<newline/>
<label name="price_type"/>
<field name="price_type"/>
<label name="progress"/>
<field name="progress" widget="progressbar"/>
<newline/>
<label name="premium"/>
<field name="premium"/>
<newline/>
<label name="inherit_tol"/>
<field name="inherit_tol"/>
<newline/>

View File

@@ -3,9 +3,11 @@
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="//field[@name='product']" position="after">
<field name="premium"/>
<field name="del_period"/>
<field name="from_del"/>
<field name="to_del"/>
</xpath>
<xpath expr="//field[@name='unit_price']" position="after">
<field name="premium"/>
</xpath>
</data>

View File

@@ -9,27 +9,27 @@ this repository contains the full copyright notices and license terms. -->
<label name="finished"/>
<field name="finished"/>
<newline/>
<label name="price_type"/>
<field name="price_type"/>
<label name="enable_linked_currency"/>
<field name="enable_linked_currency"/>
<newline/>
<label name="linked_price"/>
<field name="linked_price"/>
<label name="linked_currency"/>
<field name="linked_currency"/>
<label name="linked_unit"/>
<field name="linked_unit"/>
<newline/>
<label name="linked_price"/>
<field name="linked_price"/>
<label name="premium"/>
<field name="premium"/>
<newline/>
</xpath>
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
<newline/>
<label name="price_type"/>
<field name="price_type"/>
<label name="progress"/>
<field name="progress" widget="progressbar"/>
<newline/>
<label name="premium"/>
<field name="premium"/>
<newline/>
<label name="inherit_tol"/>
<field name="inherit_tol"/>
<newline/>

View File

@@ -3,9 +3,11 @@
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="//field[@name='product']" position="after">
<field name="premium"/>
<field name="del_period"/>
<field name="from_del"/>
<field name="to_del"/>
</xpath>
<xpath expr="//field[@name='unit_price']" position="after">
<field name="premium"/>
</xpath>
</data>