From 4d5b64469158c62dd95fa441a327dfa4508e939d Mon Sep 17 00:00:00 2001 From: migration-bot-adhoc Date: Mon, 2 Mar 2026 18:15:27 +0000 Subject: [PATCH] [MIG] product_catalog_aeroo_report: Migration to 19.0 --- product_catalog_aeroo_report/__manifest__.py | 4 +-- .../demo/product_product_demo.xml | 1 - .../demo/product_template_demo.xml | 3 -- .../models/product_catalog_report.py | 2 +- product_catalog_aeroo_report/report/parser.py | 28 +++++++++++-------- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/product_catalog_aeroo_report/__manifest__.py b/product_catalog_aeroo_report/__manifest__.py index e72c3279a..42ffb4fa9 100644 --- a/product_catalog_aeroo_report/__manifest__.py +++ b/product_catalog_aeroo_report/__manifest__.py @@ -19,7 +19,7 @@ ############################################################################## { "name": "Product Catalog Aeroo Report", - "version": "18.0.1.0.0", + "version": "19.0.1.0.0", "category": "Aeroo Reporting", "sequence": 14, "summary": "", @@ -43,7 +43,7 @@ "demo/product_template_demo.xml", "demo/product_product_demo.xml", ], - "installable": False, + "installable": True, "auto_install": False, "application": True, } diff --git a/product_catalog_aeroo_report/demo/product_product_demo.xml b/product_catalog_aeroo_report/demo/product_product_demo.xml index 9244e237a..3bfb9b708 100644 --- a/product_catalog_aeroo_report/demo/product_product_demo.xml +++ b/product_catalog_aeroo_report/demo/product_product_demo.xml @@ -7,6 +7,5 @@ product.product - diff --git a/product_catalog_aeroo_report/demo/product_template_demo.xml b/product_catalog_aeroo_report/demo/product_template_demo.xml index 0eacd5975..f2e8d972f 100644 --- a/product_catalog_aeroo_report/demo/product_template_demo.xml +++ b/product_catalog_aeroo_report/demo/product_template_demo.xml @@ -8,7 +8,6 @@ product.template prod_per_line - @@ -19,7 +18,6 @@ product.template prod_list - @@ -30,7 +28,6 @@ product.template variants - diff --git a/product_catalog_aeroo_report/models/product_catalog_report.py b/product_catalog_aeroo_report/models/product_catalog_report.py index 6a5ea7588..0b0dff904 100644 --- a/product_catalog_aeroo_report/models/product_catalog_report.py +++ b/product_catalog_aeroo_report/models/product_catalog_report.py @@ -76,7 +76,7 @@ class ProductCatalogReport(models.Model): ) def prepare_report(self): - context = dict(self._context.copy()) + context = dict(self.env.context.copy()) categories = self.category_ids # because this value usually cames from wizard, if we call report from # this model, we add taxes_included parameter diff --git a/product_catalog_aeroo_report/report/parser.py b/product_catalog_aeroo_report/report/parser.py index 3261457f8..7d72605eb 100644 --- a/product_catalog_aeroo_report/report/parser.py +++ b/product_catalog_aeroo_report/report/parser.py @@ -3,6 +3,7 @@ # directory ############################################################################## from odoo import _, api, fields, models +from odoo.tools import formatLang class Parser(models.AbstractModel): @@ -13,20 +14,20 @@ class Parser(models.AbstractModel): @api.model def aeroo_report(self, docids, data): - self.env.print_product_uom = self._context.get("print_product_uom", False) - self.env.product_type = self._context.get("product_type", "product.product") - self.env.prod_display_type = self._context.get("prod_display_type", False) - pricelist_ids = self._context.get("pricelist_ids", []) - categories_order = self._context.get("categories_order", "") + self.env.print_product_uom = self.env.context.get("print_product_uom", False) + self.env.product_type = self.env.context.get("product_type", "product.product") + self.env.prod_display_type = self.env.context.get("prod_display_type", False) + pricelist_ids = self.env.context.get("pricelist_ids", []) + categories_order = self.env.context.get("categories_order", "") pricelists = self.env["product.pricelist"].browse(pricelist_ids) # Get categories ordered - category_type = self._context.get("category_type", False) + category_type = self.env.context.get("category_type", False) if category_type == "public_category": categories = self.env["product.public.category"] else: categories = self.env["product.category"] - category_ids = self._context.get("category_ids", []) + category_ids = self.env.context.get("category_ids", []) categories = categories.search([("id", "in", category_ids)], order=categories_order) products = self.get_products(category_ids) self = self.with_context( @@ -39,9 +40,10 @@ def aeroo_report(self, docids, data): prod_display_type=self.env.prod_display_type, today=fields.Date.today(), get_price=self.get_price, + get_formatted_price=self.get_formatted_price, get_description=self.get_description, get_products=self.get_products, - context=self._context, + context=self.env.context, field_value_get=self.field_value_get, ) return super().aeroo_report(docids, data) @@ -62,6 +64,10 @@ def get_price(self, product, pricelist): price = product_obj.browse([product.id])._get_contextual_price() return price + def get_formatted_price(self, product, pricelist): + price = self.get_price(product, pricelist) + return formatLang(self.env, price, currency_obj=pricelist.currency_id) + def get_description(self, product, print_product_uom): sale_uom = self.env["product.template"].fields_get(["sale_uom_ids"]) # we force to not print default code because it's already shown in the reports. @@ -84,9 +90,9 @@ def get_description(self, product, print_product_uom): def get_products(self, category_ids): if not isinstance(category_ids, list): category_ids = [category_ids] - order = self._context.get("products_order", "") - only_with_stock = self._context.get("only_with_stock", False) - category_type = self._context.get("category_type", False) + order = self.env.context.get("products_order", "") + only_with_stock = self.env.context.get("only_with_stock", False) + category_type = self.env.context.get("category_type", False) if category_type == "public_category": domain = [("public_categ_ids", "in", category_ids)] else: