From dba5a8388dfd3743df43609990c4648c0179a830 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 31 Aug 2020 15:47:19 +0000 Subject: [PATCH] [FIX] sale, sale_product_configurator: Quantity not copied from Configurator to Rental Wizard Steps to reproduce the bug: - Let's consider a rental product RP with variants - Configure product configurator - Create a rental order - Select RP and set a quantity in the product configurator - Click on Add Bug: When the rental.wizard was opened, the quantity was not taken into account and was reset to 1. opw:2321357 closes odoo/odoo#56913 X-original-commit: afe0f0d5566df9bccc28535e85dec98d3c7587b4 Related: odoo/enterprise#12871 Signed-off-by: Simon Goffin (sig) --- addons/sale/models/product_template.py | 5 +++++ addons/sale_product_configurator/views/templates.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/sale/models/product_template.py b/addons/sale/models/product_template.py index 4f4e31f3515..25c6aaa16f5 100644 --- a/addons/sale/models/product_template.py +++ b/addons/sale/models/product_template.py @@ -33,6 +33,7 @@ class ProductTemplate(models.Model): "With this option, a validated expense can be re-invoice to a customer at its cost or sales price.") visible_expense_policy = fields.Boolean("Re-Invoice Policy visible", compute='_compute_visible_expense_policy', default=lambda self: self._default_visible_expense_policy()) sales_count = fields.Float(compute='_compute_sales_count', string='Sold') + visible_qty_configurator = fields.Boolean("Quantity visible in configurator", compute='_compute_visible_qty_configurator') invoice_policy = fields.Selection([ ('order', 'Ordered quantities'), ('delivery', 'Delivered quantities')], string='Invoicing Policy', @@ -40,6 +41,10 @@ class ProductTemplate(models.Model): 'Delivered Quantity: Invoice quantities delivered to the customer.', default='order') + def _compute_visible_qty_configurator(self): + for product_template in self: + product_template.visible_qty_configurator = True + @api.depends('name') def _compute_visible_expense_policy(self): visibility = self.user_has_groups('analytic.group_analytic_accounting') diff --git a/addons/sale_product_configurator/views/templates.xml b/addons/sale_product_configurator/views/templates.xml index 5386d4bd787..11ad527cd18 100644 --- a/addons/sale_product_configurator/views/templates.xml +++ b/addons/sale_product_configurator/views/templates.xml @@ -37,7 +37,7 @@ "display_currency": (pricelist or product).currency_id }'/> -
+