From 40fb37b943070f10a050f3ff5eef0a3e6b66f34f Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Thu, 4 Jun 2020 15:51:37 +0000 Subject: [PATCH] [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 X-original-commit: 9c1c848ad1e8fef11320e2a162b008de7e304bcb --- addons/account/views/partner_view.xml | 1 + addons/lunch/views/lunch_product_views.xml | 1 + addons/payment/views/payment_views.xml | 1 + addons/point_of_sale/views/pos_order_view.xml | 6 ++++++ addons/purchase/views/purchase_views.xml | 1 + addons/repair/models/repair.py | 5 +++++ addons/repair/views/repair_views.xml | 5 +++++ addons/sale/views/sale_views.xml | 1 + 8 files changed, 21 insertions(+) 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}">
+ Invoiced 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 @@ + 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 @@
+
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 @@ +
@@ -68,6 +69,7 @@ +
@@ -90,6 +92,7 @@ class="oe_subtotal_footer_separator" widget="monetary" attrs="{'invisible': [('amount_paid','=', 'amount_total')]}"/> +
@@ -274,6 +277,7 @@ + @@ -289,6 +293,7 @@ + @@ -329,6 +334,7 @@ + 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 @@ + 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 @@ + @@ -106,6 +107,7 @@ + @@ -132,6 +134,7 @@ + @@ -162,6 +165,7 @@ + @@ -174,6 +178,7 @@ + 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 @@ +