diff options
| author | Victor Feyens <vfe@odoo.com> | 2020-06-04 15:51:37 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-09-02 13:33:57 +0000 |
| commit | 9c1c848ad1e8fef11320e2a162b008de7e304bcb (patch) | |
| tree | c8a97aef0a041d961aa896e6663cfe96054b0b26 | |
| parent | 90f8e9255fa46c408763346ed135d9e561ae7fd5 (diff) | |
[FIX] various: enforce currency presence for monetary widgets
When a field is specified as widget="monetary" it makes sense to have the
currency actually shows. It won't happen if currency field is not present
within the view.
An heuristic to detect missing currency field presence when using monetary
fields or monetary widget tag will land soon in master. As this commit targets
a stable version only view fixes are provided.
Task ID-2329114
PR #56946
| -rw-r--r-- | addons/account/views/partner_view.xml | 1 | ||||
| -rw-r--r-- | addons/lunch/views/lunch_product_views.xml | 1 | ||||
| -rw-r--r-- | addons/payment/views/payment_views.xml | 1 | ||||
| -rw-r--r-- | addons/point_of_sale/views/pos_order_view.xml | 6 | ||||
| -rw-r--r-- | addons/purchase/views/purchase_views.xml | 1 | ||||
| -rw-r--r-- | addons/repair/models/repair.py | 5 | ||||
| -rw-r--r-- | addons/repair/views/repair_views.xml | 5 | ||||
| -rw-r--r-- | addons/sale/views/sale_views.xml | 1 |
8 files changed, 21 insertions, 0 deletions
diff --git a/addons/account/views/partner_view.xml b/addons/account/views/partner_view.xml index 1b1fdae71c3..b232c4e96bf 100644 --- a/addons/account/views/partner_view.xml +++ b/addons/account/views/partner_view.xml @@ -105,6 +105,7 @@ context="{'default_partner_id': active_id}"> <div class="o_form_field o_stat_info"> <span class="o_stat_value"> + <field name="currency_id" invisible="1"/> <field name="total_invoiced" widget='monetary' options="{'currency_field': 'currency_id'}"/> </span> <span class="o_stat_text">Invoiced</span> diff --git a/addons/lunch/views/lunch_product_views.xml b/addons/lunch/views/lunch_product_views.xml index b84f1d6b933..99f002c958d 100644 --- a/addons/lunch/views/lunch_product_views.xml +++ b/addons/lunch/views/lunch_product_views.xml @@ -104,6 +104,7 @@ <field name="description"/> <field name="product_id" invisible="1"/> <field name="price" widget="monetary"/> + <field name="currency_id" invisible="1"/> </tree> </field> </record> diff --git a/addons/payment/views/payment_views.xml b/addons/payment/views/payment_views.xml index 63f26f2b7a8..9925b8d1a86 100644 --- a/addons/payment/views/payment_views.xml +++ b/addons/payment/views/payment_views.xml @@ -279,6 +279,7 @@ <div class="col-6"> <span class="float-right"> <field name="amount" widget="monetary"/> + <field name="currency_id" invisible="1"/> </span> </div> </div> diff --git a/addons/point_of_sale/views/pos_order_view.xml b/addons/point_of_sale/views/pos_order_view.xml index 2ac3b9c17c5..ce080eda8b1 100644 --- a/addons/point_of_sale/views/pos_order_view.xml +++ b/addons/point_of_sale/views/pos_order_view.xml @@ -55,6 +55,7 @@ <field name="tax_ids" widget="many2many_tags" invisible="1"/> <field name="price_subtotal" widget="monetary" force_save="1"/> <field name="price_subtotal_incl" widget="monetary" force_save="1"/> + <field name="currency_id" invisible="1"/> </tree> <form string="Order lines"> <group col="4"> @@ -68,6 +69,7 @@ <field name="tax_ids" widget="many2many_tags" invisible="1"/> <field name="pack_lot_ids" widget="many2many_tags" groups="stock.group_production_lot"/> <field name="notice"/> + <field name="currency_id" invisible="1"/> </group> </form> </field> @@ -90,6 +92,7 @@ class="oe_subtotal_footer_separator" widget="monetary" attrs="{'invisible': [('amount_paid','=', 'amount_total')]}"/> + <field name="currency_id" invisible="1"/> </group> <div class="oe_clear"/> </page> @@ -274,6 +277,7 @@ <field name="price_subtotal" readonly="1" sum="Sum of subtotals" widget="monetary"/> <field name="price_subtotal_incl" readonly="1" sum="Sum of subtotals" widget="monetary"/> <field name="create_date" readonly="1"/> + <field name="currency_id" invisible="1"/> </tree> </field> </record> @@ -289,6 +293,7 @@ <field name="discount" widget="monetary"/> <field name="price_unit" widget="monetary"/> <field name="create_date" /> + <field name="currency_id"/> </group> </form> </field> @@ -329,6 +334,7 @@ <field name="product_id" /> <field name="qty" /> <field name="price_unit" widget="monetary"/> + <field name="currency_id" invisible="1"/> </tree> </field> </record> diff --git a/addons/purchase/views/purchase_views.xml b/addons/purchase/views/purchase_views.xml index 46689223a91..db50323004d 100644 --- a/addons/purchase/views/purchase_views.xml +++ b/addons/purchase/views/purchase_views.xml @@ -674,6 +674,7 @@ <field name="product_qty"/> <field name="product_uom" groups="uom.group_uom"/> <field name="price_subtotal" widget="monetary"/> + <field name="currency_id" invisible="1"/> <field name="date_planned" widget="date"/> </tree> </field> diff --git a/addons/repair/models/repair.py b/addons/repair/models/repair.py index b5a6f4f75ca..80e66e23209 100644 --- a/addons/repair/models/repair.py +++ b/addons/repair/models/repair.py @@ -79,6 +79,7 @@ class Repair(models.Model): 'product.pricelist', 'Pricelist', default=lambda self: self.env['product.pricelist'].search([('company_id', 'in', [self.env.company.id, False])], limit=1).id, help='Pricelist of the selected partner.', check_company=True) + currency_id = fields.Many2one(related='pricelist_id.currency_id') partner_invoice_id = fields.Many2one('res.partner', 'Invoicing Address', check_company=True) invoice_method = fields.Selection([ ("none", "No Invoice"), @@ -602,6 +603,8 @@ class RepairLine(models.Model): index=True, ondelete='cascade', check_company=True) company_id = fields.Many2one( related='repair_id.company_id', store=True, index=True) + currency_id = fields.Many2one( + related='repair_id.currency_id') type = fields.Selection([ ('add', 'Add'), ('remove', 'Remove')], 'Type', required=True) @@ -737,6 +740,8 @@ class RepairFee(models.Model): index=True, ondelete='cascade', required=True) company_id = fields.Many2one( related="repair_id.company_id", index=True, store=True) + currency_id = fields.Many2one( + related="repair_id.currency_id") name = fields.Text('Description', index=True, required=True) product_id = fields.Many2one( 'product.product', 'Product', check_company=True, diff --git a/addons/repair/views/repair_views.xml b/addons/repair/views/repair_views.xml index c39ecb0ff55..8c59e6964cb 100644 --- a/addons/repair/views/repair_views.xml +++ b/addons/repair/views/repair_views.xml @@ -84,6 +84,7 @@ <field name="partner_invoice_id" attrs="{'invisible':[('invoice_method','=', 'none')],'required':[('invoice_method','!=','none')]}" groups="sale.group_delivery_invoice_address"/> <field name="pricelist_id" groups="product.group_product_pricelist" context="{'product_id':product_id}" attrs="{'invisible':[('invoice_method','=', 'none')]}"/> <field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create_edit': True}"/> + <field name="currency_id" invisible="1"/> </group> </group> <notebook> @@ -106,6 +107,7 @@ <field name="tax_id" widget="many2many_tags"/> <field name="invoiced" invisible="1"/> <field name="price_subtotal" widget="monetary" invisible="1"/> + <field name="currency_id" invisible="1"/> </group> <group> <field name="lot_id" context="{'default_product_id': product_id, 'default_company_id': company_id}" groups="stock.group_production_lot"/> @@ -132,6 +134,7 @@ <field name="price_unit"/> <field name="tax_id" widget="many2many_tags" optional="show"/> <field name="price_subtotal" widget="monetary"/> + <field name="currency_id" invisible="1"/> </tree> </field> <group class="oe_subtotal_footer oe_right"> @@ -162,6 +165,7 @@ <field name="price_unit"/> <field widget="many2many_tags" name="tax_id"/> <field name="price_subtotal" widget="monetary" invisible="1"/> + <field name="currency_id" invisible="1"/> </group> </form> <tree string="Fees" editable="bottom"> @@ -174,6 +178,7 @@ <field name="price_unit"/> <field name="tax_id" widget="many2many_tags" optional="show"/> <field name="price_subtotal" widget="monetary"/> + <field name="currency_id" invisible="1"/> </tree> </field> </page> diff --git a/addons/sale/views/sale_views.xml b/addons/sale/views/sale_views.xml index d8b338914a0..46f5e2d291f 100644 --- a/addons/sale/views/sale_views.xml +++ b/addons/sale/views/sale_views.xml @@ -1015,6 +1015,7 @@ <field name="qty_to_invoice"/> <field name="product_uom" string="Unit of Measure" groups="uom.group_uom"/> <field name="price_subtotal" sum="Total" widget="monetary"/> + <field name="currency_id" invisible="1"/> </tree> </field> </record> |
