Add monetary field
issue10598 review338511002
This commit is contained in:
1 parent
ceda63ac8e
commit
8674b33a25
3 files changed
+5
-5
No files matched your search
+3
-3
@@ -4,6 +4,7 @@ from trytond.model import fields
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval, If
|
||||
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.modules.product import price_digits, round_price
|
||||
|
||||
|
||||
@@ -37,9 +38,8 @@ class Line(metaclass=PoolMeta):
|
||||
},
|
||||
depends=['product_secondary_uom_category', 'type',
|
||||
'secondary_uom_factor', 'secondary_uom_rate', 'purchase_state'])
|
||||
secondary_unit_price = fields.Function(
|
||||
fields.Numeric(
|
||||
"Secondary Unit Price", digits=price_digits,
|
||||
secondary_unit_price = fields.Function(Monetary(
|
||||
"Secondary Unit Price", currency='currency', digits=price_digits,
|
||||
states={
|
||||
'invisible': ((Eval('type') != 'line')
|
||||
| ~Eval('secondary_unit')),
|
||||
|
||||
@@ -9,7 +9,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="secondary_unit" string="Unit:"/>
|
||||
<field name="secondary_unit"/>
|
||||
<label name="secondary_unit_price" string="Unit Price:"/>
|
||||
<field name="secondary_unit_price" symbol="currency"/>
|
||||
<field name="secondary_unit_price"/>
|
||||
<newline/>
|
||||
</xpath>
|
||||
</data>
|
||||
@@ -4,6 +4,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="//field[@name='unit_price']" position="after">
|
||||
<field name="secondary_quantity" symbol="secondary_unit"/>
|
||||
<field name="secondary_unit_price" symbol="currency"/>
|
||||
<field name="secondary_unit_price"/>
|
||||
</xpath>
|
||||
</data>
|
||||
Reference in new issue
Block a user