changeset 900420d1976e in modules/project_invoice:default
details:
https://hg.tryton.org/modules/project_invoice?cmd=changeset&node=900420d1976e
description:
Add monetary field
issue10598
review338511002
diffstat:
project.py | 14 ++++++++------
tryton.cfg | 1 +
view/work_form.xml | 4 ++--
3 files changed, 11 insertions(+), 8 deletions(-)
diffs (66 lines):
diff -r bcc920901b30 -r 900420d1976e project.py
--- a/project.py Fri Aug 06 09:43:58 2021 +0200
+++ b/project.py Sat Aug 21 09:09:55 2021 +0200
@@ -21,6 +21,8 @@
from trytond.wizard import Wizard, StateAction
from trytond.tools import reduce_ids, grouped_slice
+from trytond.modules.currency.fields import Monetary
+
from .exceptions import InvoicingError
@@ -354,19 +356,19 @@
'on_change_with_invoice_method')
quantity_to_invoice = fields.Function(
fields.Float("Quantity to Invoice"), '_get_invoice_values')
- amount_to_invoice = fields.Function(fields.Numeric("Amount to Invoice",
- digits=(16, Eval('currency_digits', 2)),
+ amount_to_invoice = fields.Function(Monetary(
+ "Amount to Invoice", currency='currency', digits='currency',
states={
'invisible': Eval('invoice_method') == 'manual',
},
- depends=['currency_digits', 'invoice_method']),
+ depends=['invoice_method']),
'get_total')
- invoiced_amount = fields.Function(fields.Numeric('Invoiced Amount',
- digits=(16, Eval('currency_digits', 2)),
+ invoiced_amount = fields.Function(Monetary(
+ "Invoiced Amount", currency='currency', digits='currency',
states={
'invisible': Eval('invoice_method') == 'manual',
},
- depends=['currency_digits', 'invoice_method']),
+ depends=['invoice_method']),
'get_total')
invoice_line = fields.Many2One('account.invoice.line', 'Invoice Line',
readonly=True)
diff -r bcc920901b30 -r 900420d1976e tryton.cfg
--- a/tryton.cfg Fri Aug 06 09:43:58 2021 +0200
+++ b/tryton.cfg Sat Aug 21 09:09:55 2021 +0200
@@ -1,6 +1,7 @@
[tryton]
version=6.1.0
depends:
+ currency
ir
project
project_revenue
diff -r bcc920901b30 -r 900420d1976e view/work_form.xml
--- a/view/work_form.xml Fri Aug 06 09:43:58 2021 +0200
+++ b/view/work_form.xml Sat Aug 21 09:09:55 2021 +0200
@@ -14,11 +14,11 @@
</xpath>
<xpath
expr="/form/notebook/page[@id='general']/field[@name='total_effort']"
position="after">
<label name="amount_to_invoice"/>
- <field name="amount_to_invoice" symbol="currency"/>
+ <field name="amount_to_invoice"/>
</xpath>
<xpath expr="/form/notebook/page[@id='general']/field[@name='revenue']"
position="after">
<label name="invoiced_amount"/>
- <field name="invoiced_amount" symbol="currency"/>
+ <field name="invoiced_amount"/>
</xpath>
<xpath expr="/form/notebook/page[@id='general']/group/group[@id='buttons']"
position="inside">