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'),
|
||||||
|
}, depends=['enable_linked_currency'])
|
||||||
linked_unit = fields.Many2One('product.uom', 'Unit',states={
|
linked_unit = fields.Many2One('product.uom', 'Unit',states={
|
||||||
'invisible': (~Eval('enable_linked_currency')),
|
'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'),
|
||||||
|
}, depends=['enable_linked_currency'])
|
||||||
linked_unit = fields.Many2One('product.uom', 'Unit',states={
|
linked_unit = fields.Many2One('product.uom', 'Unit',states={
|
||||||
'invisible': (~Eval('enable_linked_currency')),
|
'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")
|
||||||
|
|
||||||
@@ -1098,6 +1101,7 @@ class SaleLine(metaclass=PoolMeta):
|
|||||||
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')
|
||||||
|
Pnl = Pool().get('valuation.valuation')
|
||||||
super(SaleLine, cls).validate(salelines)
|
super(SaleLine, cls).validate(salelines)
|
||||||
for line in salelines:
|
for line in salelines:
|
||||||
if line.price_components:
|
if line.price_components:
|
||||||
@@ -1141,16 +1145,20 @@ class SaleLine(metaclass=PoolMeta):
|
|||||||
|
|
||||||
#generate valuation for purchase and sale
|
#generate valuation for purchase and sale
|
||||||
LotQt = Pool().get('lot.qt')
|
LotQt = Pool().get('lot.qt')
|
||||||
|
line = cls(line.id)
|
||||||
|
generated_purchase_side = False
|
||||||
if line.lots:
|
if line.lots:
|
||||||
for lot in line.lots:
|
for lot in line.lots:
|
||||||
lqts = LotQt.search([('lot_s','=',lot.id),('lot_p','>',0)])
|
lqts = LotQt.search([('lot_s','=',lot.id),('lot_p','>',0)])
|
||||||
logger.info("VALIDATE_SL:%s",lqts)
|
logger.info("VALIDATE_SL:%s",lqts)
|
||||||
if lqts:
|
if lqts:
|
||||||
|
generated_purchase_side = True
|
||||||
purchase_lines = [e.lot_p.line for e in lqts]
|
purchase_lines = [e.lot_p.line for e in lqts]
|
||||||
if purchase_lines:
|
if purchase_lines:
|
||||||
for pl in purchase_lines:
|
for pl in purchase_lines:
|
||||||
Pnl = Pool().get('valuation.valuation')
|
|
||||||
Pnl.generate(pl)
|
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"
|
||||||
|
|||||||
@@ -9,27 +9,27 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<label name="finished"/>
|
<label name="finished"/>
|
||||||
<field name="finished"/>
|
<field name="finished"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
<label name="price_type"/>
|
||||||
|
<field name="price_type"/>
|
||||||
<label name="enable_linked_currency"/>
|
<label name="enable_linked_currency"/>
|
||||||
<field name="enable_linked_currency"/>
|
<field name="enable_linked_currency"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="linked_price"/>
|
|
||||||
<field name="linked_price"/>
|
|
||||||
<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/>
|
||||||
|
<label name="linked_price"/>
|
||||||
|
<field name="linked_price"/>
|
||||||
|
<label name="premium"/>
|
||||||
|
<field name="premium"/>
|
||||||
|
<newline/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
|
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="price_type"/>
|
|
||||||
<field name="price_type"/>
|
|
||||||
<label name="progress"/>
|
<label name="progress"/>
|
||||||
<field name="progress" widget="progressbar"/>
|
<field name="progress" widget="progressbar"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="premium"/>
|
|
||||||
<field name="premium"/>
|
|
||||||
<newline/>
|
|
||||||
<label name="inherit_tol"/>
|
<label name="inherit_tol"/>
|
||||||
<field name="inherit_tol"/>
|
<field name="inherit_tol"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -9,27 +9,27 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<label name="finished"/>
|
<label name="finished"/>
|
||||||
<field name="finished"/>
|
<field name="finished"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
<label name="price_type"/>
|
||||||
|
<field name="price_type"/>
|
||||||
<label name="enable_linked_currency"/>
|
<label name="enable_linked_currency"/>
|
||||||
<field name="enable_linked_currency"/>
|
<field name="enable_linked_currency"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="linked_price"/>
|
|
||||||
<field name="linked_price"/>
|
|
||||||
<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/>
|
||||||
|
<label name="linked_price"/>
|
||||||
|
<field name="linked_price"/>
|
||||||
|
<label name="premium"/>
|
||||||
|
<field name="premium"/>
|
||||||
|
<newline/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
|
<xpath expr="/form/notebook/page[@id='general']/field[@name='amount']" position="after">
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="price_type"/>
|
|
||||||
<field name="price_type"/>
|
|
||||||
<label name="progress"/>
|
<label name="progress"/>
|
||||||
<field name="progress" widget="progressbar"/>
|
<field name="progress" widget="progressbar"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="premium"/>
|
|
||||||
<field name="premium"/>
|
|
||||||
<newline/>
|
|
||||||
<label name="inherit_tol"/>
|
<label name="inherit_tol"/>
|
||||||
<field name="inherit_tol"/>
|
<field name="inherit_tol"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
|||||||
@@ -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