01.04.26
This commit is contained in:
@@ -1087,14 +1087,17 @@ class Line(metaclass=PoolMeta):
|
|||||||
enable_linked_currency = fields.Boolean("Linked currencies")
|
enable_linked_currency = fields.Boolean("Linked currencies")
|
||||||
linked_price = fields.Numeric("Price", digits='unit',states={
|
linked_price = fields.Numeric("Price", digits='unit',states={
|
||||||
'invisible': (~Eval('enable_linked_currency')),
|
'invisible': (~Eval('enable_linked_currency')),
|
||||||
|
'required': Eval('enable_linked_currency'),
|
||||||
'readonly': Eval('price_type') == 'basis',
|
'readonly': Eval('price_type') == 'basis',
|
||||||
}, depends=['enable_linked_currency', 'price_type'])
|
}, depends=['enable_linked_currency', 'price_type'])
|
||||||
linked_currency = fields.Many2One('currency.linked',"Currency",states={
|
linked_currency = fields.Many2One('currency.linked',"Currency",states={
|
||||||
'invisible': (~Eval('enable_linked_currency')),
|
'invisible': (~Eval('enable_linked_currency')),
|
||||||
})
|
'required': Eval('enable_linked_currency'),
|
||||||
linked_unit = fields.Many2One('product.uom', 'Unit',states={
|
}, depends=['enable_linked_currency'])
|
||||||
'invisible': (~Eval('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')
|
premium = fields.Numeric("Premium/Discount",digits='unit')
|
||||||
fee_ = fields.Many2One('fee.fee',"Fee")
|
fee_ = fields.Many2One('fee.fee',"Fee")
|
||||||
|
|
||||||
|
|||||||
@@ -632,14 +632,17 @@ class SaleLine(metaclass=PoolMeta):
|
|||||||
enable_linked_currency = fields.Boolean("Linked currencies")
|
enable_linked_currency = fields.Boolean("Linked currencies")
|
||||||
linked_price = fields.Numeric("Price", digits='unit',states={
|
linked_price = fields.Numeric("Price", digits='unit',states={
|
||||||
'invisible': (~Eval('enable_linked_currency')),
|
'invisible': (~Eval('enable_linked_currency')),
|
||||||
|
'required': Eval('enable_linked_currency'),
|
||||||
'readonly': Eval('price_type') == 'basis',
|
'readonly': Eval('price_type') == 'basis',
|
||||||
}, depends=['enable_linked_currency', 'price_type'])
|
}, depends=['enable_linked_currency', 'price_type'])
|
||||||
linked_currency = fields.Many2One('currency.linked',"Currency",states={
|
linked_currency = fields.Many2One('currency.linked',"Currency",states={
|
||||||
'invisible': (~Eval('enable_linked_currency')),
|
'invisible': (~Eval('enable_linked_currency')),
|
||||||
})
|
'required': Eval('enable_linked_currency'),
|
||||||
linked_unit = fields.Many2One('product.uom', 'Unit',states={
|
}, depends=['enable_linked_currency'])
|
||||||
'invisible': (~Eval('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')
|
premium = fields.Numeric("Premium/Discount",digits='unit')
|
||||||
fee_ = fields.Many2One('fee.fee',"Fee")
|
fee_ = fields.Many2One('fee.fee',"Fee")
|
||||||
|
|
||||||
@@ -1095,14 +1098,15 @@ class SaleLine(metaclass=PoolMeta):
|
|||||||
return super().copy(lines, default=default)
|
return super().copy(lines, default=default)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def validate(cls, salelines):
|
def validate(cls, salelines):
|
||||||
LotQtHist = Pool().get('lot.qt.hist')
|
LotQtHist = Pool().get('lot.qt.hist')
|
||||||
LotQtType = Pool().get('lot.qt.type')
|
LotQtType = Pool().get('lot.qt.type')
|
||||||
super(SaleLine, cls).validate(salelines)
|
Pnl = Pool().get('valuation.valuation')
|
||||||
for line in salelines:
|
super(SaleLine, cls).validate(salelines)
|
||||||
if line.price_components:
|
for line in salelines:
|
||||||
for pc in line.price_components:
|
if line.price_components:
|
||||||
if pc.triggers:
|
for pc in line.price_components:
|
||||||
|
if pc.triggers:
|
||||||
for tr in pc.triggers:
|
for tr in pc.triggers:
|
||||||
line.check_from_to(tr)
|
line.check_from_to(tr)
|
||||||
line.check_pricing()
|
line.check_pricing()
|
||||||
@@ -1139,18 +1143,22 @@ class SaleLine(metaclass=PoolMeta):
|
|||||||
fl.sale_line = line.id
|
fl.sale_line = line.id
|
||||||
FeeLots.save([fl])
|
FeeLots.save([fl])
|
||||||
|
|
||||||
#generate valuation for purchase and sale
|
#generate valuation for purchase and sale
|
||||||
LotQt = Pool().get('lot.qt')
|
LotQt = Pool().get('lot.qt')
|
||||||
if line.lots:
|
line = cls(line.id)
|
||||||
for lot in line.lots:
|
generated_purchase_side = False
|
||||||
lqts = LotQt.search([('lot_s','=',lot.id),('lot_p','>',0)])
|
if line.lots:
|
||||||
logger.info("VALIDATE_SL:%s",lqts)
|
for lot in line.lots:
|
||||||
if lqts:
|
lqts = LotQt.search([('lot_s','=',lot.id),('lot_p','>',0)])
|
||||||
purchase_lines = [e.lot_p.line for e in lqts]
|
logger.info("VALIDATE_SL:%s",lqts)
|
||||||
if purchase_lines:
|
if lqts:
|
||||||
for pl in purchase_lines:
|
generated_purchase_side = True
|
||||||
Pnl = Pool().get('valuation.valuation')
|
purchase_lines = [e.lot_p.line for e in lqts]
|
||||||
Pnl.generate(pl)
|
if purchase_lines:
|
||||||
|
for pl in purchase_lines:
|
||||||
|
Pnl.generate(pl)
|
||||||
|
if line.lots and not generated_purchase_side:
|
||||||
|
Pnl.generate_from_sale_line(line)
|
||||||
|
|
||||||
class SaleCreatePurchase(Wizard):
|
class SaleCreatePurchase(Wizard):
|
||||||
"Create mirror purchase"
|
"Create mirror purchase"
|
||||||
|
|||||||
@@ -2,37 +2,37 @@
|
|||||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<data>
|
<data>
|
||||||
<xpath expr="/form/notebook/page[@id='general']/field[@name='unit']" position="after">
|
<xpath expr="/form/notebook/page[@id='general']/field[@name='unit']" position="after">
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="quantity_theorical"/>
|
<label name="quantity_theorical"/>
|
||||||
<field name="quantity_theorical"/>
|
<field name="quantity_theorical"/>
|
||||||
<label name="finished"/>
|
<label name="finished"/>
|
||||||
<field name="finished"/>
|
<field name="finished"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="enable_linked_currency"/>
|
<label name="price_type"/>
|
||||||
<field name="enable_linked_currency"/>
|
<field name="price_type"/>
|
||||||
<newline/>
|
<label name="enable_linked_currency"/>
|
||||||
<label name="linked_price"/>
|
<field name="enable_linked_currency"/>
|
||||||
<field name="linked_price"/>
|
<newline/>
|
||||||
<label name="linked_currency"/>
|
<label name="linked_currency"/>
|
||||||
<field name="linked_currency"/>
|
<field name="linked_currency"/>
|
||||||
<label name="linked_unit"/>
|
<label name="linked_unit"/>
|
||||||
<field name="linked_unit"/>
|
<field name="linked_unit"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
</xpath>
|
<label name="linked_price"/>
|
||||||
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
|
<field name="linked_price"/>
|
||||||
<newline/>
|
<label name="premium"/>
|
||||||
<label name="price_type"/>
|
<field name="premium"/>
|
||||||
<field name="price_type"/>
|
<newline/>
|
||||||
<label name="progress"/>
|
</xpath>
|
||||||
<field name="progress" widget="progressbar"/>
|
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="premium"/>
|
<label name="progress"/>
|
||||||
<field name="premium"/>
|
<field name="progress" widget="progressbar"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="inherit_tol"/>
|
<label name="inherit_tol"/>
|
||||||
<field name="inherit_tol"/>
|
<field name="inherit_tol"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="tol_min"/>
|
<label name="tol_min"/>
|
||||||
<field name="tol_min"/>
|
<field name="tol_min"/>
|
||||||
<label name="tol_min_v"/>
|
<label name="tol_min_v"/>
|
||||||
@@ -105,4 +105,4 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<field name="optional" />
|
<field name="optional" />
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<data>
|
<data>
|
||||||
<xpath expr="//field[@name='product']" position="after">
|
<xpath expr="//field[@name='product']" position="after">
|
||||||
<field name="premium"/>
|
|
||||||
<field name="del_period"/>
|
<field name="del_period"/>
|
||||||
<field name="from_del"/>
|
<field name="from_del"/>
|
||||||
<field name="to_del"/>
|
<field name="to_del"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='unit_price']" position="after">
|
||||||
|
<field name="premium"/>
|
||||||
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -2,37 +2,37 @@
|
|||||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<data>
|
<data>
|
||||||
<xpath expr="/form/notebook/page[@id='general']/field[@name='unit']" position="after">
|
<xpath expr="/form/notebook/page[@id='general']/field[@name='unit']" position="after">
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="quantity_theorical"/>
|
<label name="quantity_theorical"/>
|
||||||
<field name="quantity_theorical"/>
|
<field name="quantity_theorical"/>
|
||||||
<label name="finished"/>
|
<label name="finished"/>
|
||||||
<field name="finished"/>
|
<field name="finished"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="enable_linked_currency"/>
|
<label name="price_type"/>
|
||||||
<field name="enable_linked_currency"/>
|
<field name="price_type"/>
|
||||||
<newline/>
|
<label name="enable_linked_currency"/>
|
||||||
<label name="linked_price"/>
|
<field name="enable_linked_currency"/>
|
||||||
<field name="linked_price"/>
|
<newline/>
|
||||||
<label name="linked_currency"/>
|
<label name="linked_currency"/>
|
||||||
<field name="linked_currency"/>
|
<field name="linked_currency"/>
|
||||||
<label name="linked_unit"/>
|
<label name="linked_unit"/>
|
||||||
<field name="linked_unit"/>
|
<field name="linked_unit"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
</xpath>
|
<label name="linked_price"/>
|
||||||
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
|
<field name="linked_price"/>
|
||||||
<newline/>
|
<label name="premium"/>
|
||||||
<label name="price_type"/>
|
<field name="premium"/>
|
||||||
<field name="price_type"/>
|
<newline/>
|
||||||
<label name="progress"/>
|
</xpath>
|
||||||
<field name="progress" widget="progressbar"/>
|
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="premium"/>
|
<label name="progress"/>
|
||||||
<field name="premium"/>
|
<field name="progress" widget="progressbar"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="inherit_tol"/>
|
<label name="inherit_tol"/>
|
||||||
<field name="inherit_tol"/>
|
<field name="inherit_tol"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="tol_min"/>
|
<label name="tol_min"/>
|
||||||
<field name="tol_min"/>
|
<field name="tol_min"/>
|
||||||
<label name="tol_min_v"/>
|
<label name="tol_min_v"/>
|
||||||
@@ -91,4 +91,4 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<field name="estimated_date" />
|
<field name="estimated_date" />
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<data>
|
<data>
|
||||||
<xpath expr="//field[@name='product']" position="after">
|
<xpath expr="//field[@name='product']" position="after">
|
||||||
<field name="premium"/>
|
|
||||||
<field name="del_period"/>
|
<field name="del_period"/>
|
||||||
<field name="from_del"/>
|
<field name="from_del"/>
|
||||||
<field name="to_del"/>
|
<field name="to_del"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='unit_price']" position="after">
|
||||||
|
<field name="premium"/>
|
||||||
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Reference in New Issue
Block a user