diff --git a/addons/product/__init__.py b/addons/product/__init__.py index de3c67453a7..2609681a938 100644 --- a/addons/product/__init__.py +++ b/addons/product/__init__.py @@ -3,4 +3,3 @@ from . import models from . import report -from . import wizard diff --git a/addons/product/__manifest__.py b/addons/product/__manifest__.py index 3f595f62a78..b7c74f265e7 100644 --- a/addons/product/__manifest__.py +++ b/addons/product/__manifest__.py @@ -30,7 +30,6 @@ Print product labels with barcode. 'data/product_data.xml', 'security/product_security.xml', 'security/ir.model.access.csv', - 'wizard/product_price_list_views.xml', 'views/res_config_settings_views.xml', 'views/product_attribute_views.xml', 'views/product_views.xml', @@ -38,7 +37,6 @@ Print product labels with barcode. 'views/product_pricelist_views.xml', 'views/res_partner_views.xml', 'report/product_reports.xml', - 'report/product_pricelist_templates.xml', 'report/product_product_templates.xml', 'report/product_template_templates.xml', 'report/product_packaging.xml', diff --git a/addons/product/report/__init__.py b/addons/product/report/__init__.py deleted file mode 100644 index 84e96d32c23..00000000000 --- a/addons/product/report/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. -from . import product_pricelist diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py deleted file mode 100644 index abdb705c529..00000000000 --- a/addons/product/report/product_pricelist.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, models -from odoo.tools import float_round - - -class report_product_pricelist(models.AbstractModel): - _name = 'report.product.report_pricelist' - _description = 'Product Price List Report' - - @api.model - def _get_report_values(self, docids, data=None): - data = data if data is not None else {} - pricelist = self.env['product.pricelist'].browse(data.get('form', {}).get('price_list', False)) - products = self.env['product.product'].browse(data.get('ids', data.get('active_ids'))) - quantities = self._get_quantity(data) - return { - 'doc_ids': data.get('ids', data.get('active_ids')), - 'doc_model': 'product.pricelist', - 'docs': products, - 'data': dict( - data, - pricelist=pricelist, - quantities=quantities, - categories_data=self._get_categories(pricelist, products, quantities) - ), - } - - def _get_quantity(self, data): - form = data and data.get('form') or {} - return sorted([form[key] for key in form if key.startswith('qty') and form[key]]) - - def _get_categories(self, pricelist, products, quantities): - categ_data = [] - categories = self.env['product.category'] - for product in products: - categories |= product.categ_id - - for category in categories: - categ_products = products.filtered(lambda product: product.categ_id == category) - prices = {} - for categ_product in categ_products: - prices[categ_product.id] = dict.fromkeys(quantities, 0.0) - for quantity in quantities: - prices[categ_product.id][quantity] = self._get_price(pricelist, categ_product, quantity) - categ_data.append({ - 'category': category, - 'products': categ_products, - 'prices': prices, - }) - return categ_data - - def _get_price(self, pricelist, product, qty): - sale_price_digits = self.env['decimal.precision'].precision_get('Product Price') - price = pricelist.get_product_price(product, qty, False) - if not price: - price = product.list_price - return float_round(price, precision_digits=sale_price_digits) diff --git a/addons/product/report/product_pricelist_templates.xml b/addons/product/report/product_pricelist_templates.xml deleted file mode 100644 index 41ba6092f31..00000000000 --- a/addons/product/report/product_pricelist_templates.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - diff --git a/addons/product/tests/test_product_pricelist.py b/addons/product/tests/test_product_pricelist.py index 814d6595447..6fe59ff8c28 100644 --- a/addons/product/tests/test_product_pricelist.py +++ b/addons/product/tests/test_product_pricelist.py @@ -161,20 +161,3 @@ class TestProductPricelist(TransactionCase): partner = self.res_partner_4.with_context(context) msg = "Wrong cost price: LCD Monitor if more than 3 Unit.should be 785 instead of %s" % ipad_mini._select_seller(partner_id=partner, quantity=3.0).price self.assertEqual(float_compare(ipad_mini._select_seller(partner_id=partner, quantity=3.0).price, 785, precision_digits=2), 0, msg) - - # I print the sale prices report. - ctx = {'active_model': 'product.product', 'date': '2011-12-30', 'active_ids': [self.computer_SC234.id, self.ipad_retina_display.id, self.custom_computer_kit.id, self.ipad_mini.id]} - data_dict = { - 'qty1': 1, - 'qty2': 5, - 'qty3': 10, - 'qty4': 15, - 'qty5': 30, - 'price_list': self.customer_pricelist.id, - } - - with self.assertRaises(UserError): - test_reports.try_report_action(self.cr, self.uid, 'action_product_price_list', wiz_data=data_dict, context=ctx, our_module='product') - - self.env.company.external_report_layout_id = self.env.ref('web.external_layout_standard').id - test_reports.try_report_action(self.cr, self.uid, 'action_product_price_list', wiz_data=data_dict, context=ctx, our_module='product') diff --git a/addons/product/wizard/__init__.py b/addons/product/wizard/__init__.py deleted file mode 100644 index 0e9e3318439..00000000000 --- a/addons/product/wizard/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from . import product_price_list diff --git a/addons/product/wizard/product_price_list.py b/addons/product/wizard/product_price_list.py deleted file mode 100644 index a2c91a3d412..00000000000 --- a/addons/product/wizard/product_price_list.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import api, fields, models, _ -from odoo.exceptions import UserError - - -class product_price_list(models.TransientModel): - _name = 'product.price_list' - _description = 'Product Price per Unit Based on Pricelist Version' - - price_list = fields.Many2one('product.pricelist', 'PriceList', required=True) - qty1 = fields.Integer('Quantity-1', default=1) - qty2 = fields.Integer('Quantity-2', default=5) - qty3 = fields.Integer('Quantity-3', default=10) - qty4 = fields.Integer('Quantity-4', default=0) - qty5 = fields.Integer('Quantity-5', default=0) - - def print_report(self): - """ - To get the date and print the report - @return : return report - """ - if (not self.env.company.logo): - raise UserError(_("You have to set a logo or a layout for your company.")) - elif (not self.env.company.external_report_layout_id): - raise UserError(_("You have to set your reports's header and footer layout.")) - - datas = {'ids': self.env.context.get('active_ids', [])} - res = self.read(['price_list', 'qty1', 'qty2', 'qty3', 'qty4', 'qty5']) - res = res and res[0] or {} - res['price_list'] = res['price_list'][0] - datas['form'] = res - return self.env.ref('product.action_report_pricelist').report_action([], data=datas) diff --git a/addons/product/wizard/product_price_list_views.xml b/addons/product/wizard/product_price_list_views.xml deleted file mode 100644 index 37c59dac0f3..00000000000 --- a/addons/product/wizard/product_price_list_views.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - Price per unit - product.price_list - -
- - - - - - - - -
-
-
-
-
- - -