diff --git a/sale_product_smart_buttons/__manifest__.py b/sale_product_smart_buttons/__manifest__.py index 2d8b9a38a..db09350bd 100644 --- a/sale_product_smart_buttons/__manifest__.py +++ b/sale_product_smart_buttons/__manifest__.py @@ -2,7 +2,7 @@ { 'name': 'Sale Product Smart Buttons', - 'version': '12.0.0.0.1', + 'version': '13.0.0.0.1', 'sequence': 1, 'author': 'Serpent Consulting Services Pvt. Ltd.', 'maintainer': 'Serpent Consulting Services Pvt. Ltd.', @@ -20,7 +20,7 @@ 'license': 'AGPL-3', 'depends': ['sale_management'], 'data': [ - 'views/product_view.xml', + 'views/product_view.xml', ], 'installable': True, 'application': False, diff --git a/sale_product_smart_buttons/models/product.py b/sale_product_smart_buttons/models/product.py index b018afd92..d3cddfef1 100644 --- a/sale_product_smart_buttons/models/product.py +++ b/sale_product_smart_buttons/models/product.py @@ -6,12 +6,11 @@ class ProductTemplate(models.Model): _inherit = 'product.template' - @api.multi @api.depends('product_variant_ids.sales_amt') def _sales_amt(self): for product in self: product.sales_amt = sum([p.sales_amt - for p in product.product_variant_ids]) + for p in product.product_variant_ids]) sales_amt = fields.Float(compute='_sales_amt', string='Sales amt') @@ -19,20 +18,23 @@ def _sales_amt(self): class ProductProduct(models.Model): _inherit = 'product.product' - @api.multi def _sales_amt(self): res = {} amt = 0.00 + sales_amount = 0.0 domain = [ ('order_id.state', 'in', ['sale', 'done']), ('product_id', 'in', self.ids), ] order_lines = self.env['sale.order.line'].search(domain) + for line in order_lines: amt += line.price_subtotal res[line.product_id.id] = {'amt': amt} for product in self: if res: - product.sales_amt = res.get(product.id, 0).get('amt', 0) + sales_amount = res[product.id].get( + 'amt', 0.0) if product.id in res else 0.0 + self.sales_amt = sales_amount sales_amt = fields.Float(compute='_sales_amt', string='# Sales amt') diff --git a/sale_product_smart_buttons/static/description/icecream.png b/sale_product_smart_buttons/static/description/icecream.png new file mode 100644 index 000000000..c1070a24a Binary files /dev/null and b/sale_product_smart_buttons/static/description/icecream.png differ diff --git a/sale_product_smart_buttons/static/description/index.html b/sale_product_smart_buttons/static/description/index.html index 4a22a8ab8..dfe4587f1 100644 --- a/sale_product_smart_buttons/static/description/index.html +++ b/sale_product_smart_buttons/static/description/index.html @@ -7,7 +7,7 @@