changeset 01df1c4401a8 in modules/sale:default
details: https://hg.tryton.org/modules/sale?cmd=changeset;node=01df1c4401a8
description:
Add symbol widget
issue9059
review276871002
diffstat:
message.xml | 3 +++
sale.py | 8 ++++++++
sale_reporting.py | 7 +++++++
view/move_list_shipment.xml | 3 +--
view/product_list_sale_line.xml | 5 ++---
view/sale_form.xml | 6 +++---
view/sale_line_form.xml | 4 ++--
view/sale_line_tree.xml | 7 +++----
view/sale_line_tree_sequence.xml | 7 +++----
view/sale_reporting_category_list.xml | 2 +-
view/sale_reporting_category_time_series_list.xml | 2 +-
view/sale_reporting_country_subdivision_time_series_list.xml | 2 +-
view/sale_reporting_country_time_series_list.xml | 2 +-
view/sale_reporting_customer_list.xml | 2 +-
view/sale_reporting_customer_time_series_list.xml | 2 +-
view/sale_reporting_product_list.xml | 2 +-
view/sale_reporting_product_time_series_list.xml | 2 +-
view/sale_reporting_region_tree.xml | 2 +-
view/sale_tree.xml | 3 +--
19 files changed, 42 insertions(+), 29 deletions(-)
diffs (260 lines):
diff -r b86e47ca890a -r 01df1c4401a8 message.xml
--- a/message.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/message.xml Fri Oct 09 19:09:05 2020 +0200
@@ -57,6 +57,9 @@
<record model="ir.message" id="msg_sale_reporting_revenue_trend">
<field name="text">Revenue Trend</field>
</record>
+ <record model="ir.message" id="msg_sale_reporting_currency">
+ <field name="text">Currency</field>
+ </record>
<record model="ir.message" id="msg_sale_reporting_currency_digits">
<field name="text">Currency Digits</field>
</record>
diff -r b86e47ca890a -r 01df1c4401a8 sale.py
--- a/sale.py Sun Oct 04 23:54:51 2020 +0200
+++ b/sale.py Fri Oct 09 19:09:05 2020 +0200
@@ -1118,6 +1118,9 @@
'invisible': ~Eval('type').in_(['line', 'subtotal']),
},
depends=['type', 'sale_state']), 'get_amount')
+ currency = fields.Function(
+ fields.Many2One('currency.currency', 'Currency'),
+ 'on_change_with_currency')
description = fields.Text('Description', size=None,
states={
'readonly': Eval('sale_state') != 'draft',
@@ -1389,6 +1392,11 @@
shipping_date = max(shipping_date, Date.today())
return shipping_date
+ @fields.depends('sale', '_parent_sale.currency')
+ def on_change_with_currency(self, name=None):
+ if self.sale:
+ return self.sale.currency.id
+
@property
@fields.depends('sale', '_parent_sale.shipping_date')
def shipping_planned_date(self):
diff -r b86e47ca890a -r 01df1c4401a8 sale_reporting.py
--- a/sale_reporting.py Sun Oct 04 23:54:51 2020 +0200
+++ b/sale_reporting.py Fri Oct 09 19:09:05 2020 +0200
@@ -43,6 +43,10 @@
'get_trend')
time_series = None
+ currency = fields.Function(fields.Many2One(
+ 'currency.currency',
+ lazy_gettext("sale.msg_sale_reporting_currency")),
+ 'get_currency')
currency_digits = fields.Function(
fields.Integer(
lazy_gettext("sale.msg_sale_reporting_currency_digits")),
@@ -171,6 +175,9 @@
for ts in self.time_series_all])
return chart.render_sparktext()
+ def get_currency(self, name):
+ return self.company.currency.id
+
def get_currency_digits(self, name):
return self.company.currency.digits
diff -r b86e47ca890a -r 01df1c4401a8 view/move_list_shipment.xml
--- a/view/move_list_shipment.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/move_list_shipment.xml Fri Oct 09 19:09:05 2020 +0200
@@ -5,8 +5,7 @@
<field name="product" expand="1"/>
<field name="from_location" expand="1"/>
<field name="to_location" expand="1"/>
- <field name="quantity"/>
- <field name="uom"/>
+ <field name="quantity" symbol="uom"/>
<field name="state"/>
<field name="sale_exception_state"/>
<button name="cancel"/>
diff -r b86e47ca890a -r 01df1c4401a8 view/product_list_sale_line.xml
--- a/view/product_list_sale_line.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/product_list_sale_line.xml Fri Oct 09 19:09:05 2020 +0200
@@ -7,7 +7,6 @@
<field name="sale_price_uom"/>
<field name="list_price_uom"/>
<field name="cost_price_uom"/>
- <field name="quantity"/>
- <field name="forecast_quantity"/>
- <field name="default_uom"/>
+ <field name="quantity" symbol="default_uom"/>
+ <field name="forecast_quantity" symbol="default_uom"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_form.xml
--- a/view/sale_form.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_form.xml Fri Oct 09 19:09:05 2020 +0200
@@ -48,11 +48,11 @@
</group>
<group col="2" colspan="2" id="amount" yfill="1">
<label name="untaxed_amount" xalign="1.0" xexpand="1"/>
- <field name="untaxed_amount" xalign="1.0" xexpand="0"/>
+ <field name="untaxed_amount" symbol="currency" xalign="1.0"
xexpand="0"/>
<label name="tax_amount" xalign="1.0" xexpand="1"/>
- <field name="tax_amount" xalign="1.0" xexpand="0"/>
+ <field name="tax_amount" symbol="currency" xalign="1.0"
xexpand="0"/>
<label name="total_amount" xalign="1.0" xexpand="1"/>
- <field name="total_amount" xalign="1.0" xexpand="0"/>
+ <field name="total_amount" symbol="currency" xalign="1.0"
xexpand="0"/>
</group>
</page>
<page string="Other Info" id="other">
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_line_form.xml
--- a/view/sale_line_form.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_line_form.xml Fri Oct 09 19:09:05 2020 +0200
@@ -19,9 +19,9 @@
<label name="unit"/>
<field name="unit"/>
<label name="unit_price"/>
- <field name="unit_price"/>
+ <field name="unit_price" symbol="currency"/>
<label name="amount"/>
- <field name="amount"/>
+ <field name="amount" symbol="currency"/>
<label name="shipping_date"/>
<field name="shipping_date"/>
<separator name="description" colspan="4"/>
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_line_tree.xml
--- a/view/sale_line_tree.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_line_tree.xml Fri Oct 09 19:09:05 2020 +0200
@@ -5,9 +5,8 @@
<field name="sale" expand="1"/>
<field name="type"/>
<field name="product" expand="1"/>
- <field name="quantity"/>
- <field name="unit"/>
- <field name="unit_price"/>
+ <field name="quantity" symbol="unit"/>
+ <field name="unit_price" symbol="currency"/>
<field name="taxes"/>
- <field name="amount"/>
+ <field name="amount" symbol="currency"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_line_tree_sequence.xml
--- a/view/sale_line_tree_sequence.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_line_tree_sequence.xml Fri Oct 09 19:09:05 2020 +0200
@@ -5,9 +5,8 @@
<field name="sale" expand="1"/>
<field name="type"/>
<field name="product" expand="1"/>
- <field name="quantity"/>
- <field name="unit"/>
- <field name="unit_price"/>
+ <field name="quantity" symbol="unit"/>
+ <field name="unit_price" symbol="currency"/>
<field name="taxes"/>
- <field name="amount"/>
+ <field name="amount" symbol="currency"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_reporting_category_list.xml
--- a/view/sale_reporting_category_list.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_reporting_category_list.xml Fri Oct 09 19:09:05 2020 +0200
@@ -4,6 +4,6 @@
<tree keyword_open="1">
<field name="category" expand="1"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
<field name="revenue_trend" expand="1"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8
view/sale_reporting_category_time_series_list.xml
--- a/view/sale_reporting_category_time_series_list.xml Sun Oct 04 23:54:51
2020 +0200
+++ b/view/sale_reporting_category_time_series_list.xml Fri Oct 09 19:09:05
2020 +0200
@@ -4,5 +4,5 @@
<tree>
<field name="date"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8
view/sale_reporting_country_subdivision_time_series_list.xml
--- a/view/sale_reporting_country_subdivision_time_series_list.xml Sun Oct
04 23:54:51 2020 +0200
+++ b/view/sale_reporting_country_subdivision_time_series_list.xml Fri Oct
09 19:09:05 2020 +0200
@@ -4,5 +4,5 @@
<tree>
<field name="date"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8
view/sale_reporting_country_time_series_list.xml
--- a/view/sale_reporting_country_time_series_list.xml Sun Oct 04 23:54:51
2020 +0200
+++ b/view/sale_reporting_country_time_series_list.xml Fri Oct 09 19:09:05
2020 +0200
@@ -4,5 +4,5 @@
<tree>
<field name="date"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_reporting_customer_list.xml
--- a/view/sale_reporting_customer_list.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_reporting_customer_list.xml Fri Oct 09 19:09:05 2020 +0200
@@ -4,6 +4,6 @@
<tree keyword_open="1">
<field name="customer" expand="1"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
<field name="revenue_trend" expand="1"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8
view/sale_reporting_customer_time_series_list.xml
--- a/view/sale_reporting_customer_time_series_list.xml Sun Oct 04 23:54:51
2020 +0200
+++ b/view/sale_reporting_customer_time_series_list.xml Fri Oct 09 19:09:05
2020 +0200
@@ -4,5 +4,5 @@
<tree>
<field name="date"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_reporting_product_list.xml
--- a/view/sale_reporting_product_list.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_reporting_product_list.xml Fri Oct 09 19:09:05 2020 +0200
@@ -4,6 +4,6 @@
<tree keyword_open="1">
<field name="product" expand="1"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
<field name="revenue_trend" expand="1"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8
view/sale_reporting_product_time_series_list.xml
--- a/view/sale_reporting_product_time_series_list.xml Sun Oct 04 23:54:51
2020 +0200
+++ b/view/sale_reporting_product_time_series_list.xml Fri Oct 09 19:09:05
2020 +0200
@@ -4,5 +4,5 @@
<tree>
<field name="date"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_reporting_region_tree.xml
--- a/view/sale_reporting_region_tree.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_reporting_region_tree.xml Fri Oct 09 19:09:05 2020 +0200
@@ -4,6 +4,6 @@
<tree keyword_open="1">
<field name="region" expand="1"/>
<field name="number"/>
- <field name="revenue"/>
+ <field name="revenue" symbol="currency"/>
<field name="revenue_trend" expand="1"/>
</tree>
diff -r b86e47ca890a -r 01df1c4401a8 view/sale_tree.xml
--- a/view/sale_tree.xml Sun Oct 04 23:54:51 2020 +0200
+++ b/view/sale_tree.xml Fri Oct 09 19:09:05 2020 +0200
@@ -7,8 +7,7 @@
<field name="sale_date"/>
<field name="party" expand="2"/>
<field name="warehouse"/>
- <field name="currency"/>
- <field name="untaxed_amount"/>
+ <field name="untaxed_amount" symbol="currency"/>
<field name="state"/>
<field name="invoice_state"/>
<field name="shipment_state"/>