33# directory
44##############################################################################
55from odoo import _ , api , fields , models
6+ from odoo .tools import formatLang
67
78
89class Parser (models .AbstractModel ):
@@ -13,20 +14,20 @@ class Parser(models.AbstractModel):
1314
1415 @api .model
1516 def aeroo_report (self , docids , data ):
16- self .env .print_product_uom = self ._context .get ("print_product_uom" , False )
17- self .env .product_type = self ._context .get ("product_type" , "product.product" )
18- self .env .prod_display_type = self ._context .get ("prod_display_type" , False )
19- pricelist_ids = self ._context .get ("pricelist_ids" , [])
20- categories_order = self ._context .get ("categories_order" , "" )
17+ self .env .print_product_uom = self .env . context .get ("print_product_uom" , False )
18+ self .env .product_type = self .env . context .get ("product_type" , "product.product" )
19+ self .env .prod_display_type = self .env . context .get ("prod_display_type" , False )
20+ pricelist_ids = self .env . context .get ("pricelist_ids" , [])
21+ categories_order = self .env . context .get ("categories_order" , "" )
2122 pricelists = self .env ["product.pricelist" ].browse (pricelist_ids )
2223
2324 # Get categories ordered
24- category_type = self ._context .get ("category_type" , False )
25+ category_type = self .env . context .get ("category_type" , False )
2526 if category_type == "public_category" :
2627 categories = self .env ["product.public.category" ]
2728 else :
2829 categories = self .env ["product.category" ]
29- category_ids = self ._context .get ("category_ids" , [])
30+ category_ids = self .env . context .get ("category_ids" , [])
3031 categories = categories .search ([("id" , "in" , category_ids )], order = categories_order )
3132 products = self .get_products (category_ids )
3233 self = self .with_context (
@@ -39,9 +40,10 @@ def aeroo_report(self, docids, data):
3940 prod_display_type = self .env .prod_display_type ,
4041 today = fields .Date .today (),
4142 get_price = self .get_price ,
43+ get_formatted_price = self .get_formatted_price ,
4244 get_description = self .get_description ,
4345 get_products = self .get_products ,
44- context = self ._context ,
46+ context = self .env . context ,
4547 field_value_get = self .field_value_get ,
4648 )
4749 return super ().aeroo_report (docids , data )
@@ -62,6 +64,10 @@ def get_price(self, product, pricelist):
6264 price = product_obj .browse ([product .id ])._get_contextual_price ()
6365 return price
6466
67+ def get_formatted_price (self , product , pricelist ):
68+ price = self .get_price (product , pricelist )
69+ return formatLang (self .env , price , currency_obj = pricelist .currency_id )
70+
6571 def get_description (self , product , print_product_uom ):
6672 sale_uom = self .env ["product.template" ].fields_get (["sale_uom_ids" ])
6773 # 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):
8490 def get_products (self , category_ids ):
8591 if not isinstance (category_ids , list ):
8692 category_ids = [category_ids ]
87- order = self ._context .get ("products_order" , "" )
88- only_with_stock = self ._context .get ("only_with_stock" , False )
89- category_type = self ._context .get ("category_type" , False )
93+ order = self .env . context .get ("products_order" , "" )
94+ only_with_stock = self .env . context .get ("only_with_stock" , False )
95+ category_type = self .env . context .get ("category_type" , False )
9096 if category_type == "public_category" :
9197 domain = [("public_categ_ids" , "in" , category_ids )]
9298 else :
0 commit comments