From 6ecf2812a0a1fc7b56838d8d94fae82a0b7fa1c9 Mon Sep 17 00:00:00 2001 From: luis Date: Thu, 11 Jan 2024 10:42:00 +0100 Subject: [PATCH] [MIG] product_update_price_last_purchase: Migration to 16.0 --- product_update_price_last_purchase/__manifest__.py | 2 +- .../models/ir_actions_report.py | 1 - .../models/product_pricelist.py | 1 - .../models/product_product.py | 4 +--- .../models/product_template.py | 7 ++----- product_update_price_last_purchase/models/res_config.py | 1 - product_update_price_last_purchase/models/stock_move.py | 1 - product_update_price_last_purchase/views/actions.xml | 1 - 8 files changed, 4 insertions(+), 14 deletions(-) diff --git a/product_update_price_last_purchase/__manifest__.py b/product_update_price_last_purchase/__manifest__.py index 2aa78df..8e94770 100644 --- a/product_update_price_last_purchase/__manifest__.py +++ b/product_update_price_last_purchase/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Product Update Price From Last Purchase', - 'version': '12.0.2.1.0', + 'version': "16.0.1.0.0", 'category': 'purchase', 'summary' : 'Product Update Price From Last Purchase', 'description' : """ diff --git a/product_update_price_last_purchase/models/ir_actions_report.py b/product_update_price_last_purchase/models/ir_actions_report.py index b8bf3eb..4faf6d1 100644 --- a/product_update_price_last_purchase/models/ir_actions_report.py +++ b/product_update_price_last_purchase/models/ir_actions_report.py @@ -7,7 +7,6 @@ _logger = logging.getLogger(__name__) class IrActionsReport(models.Model): _inherit = 'ir.actions.report' - @api.multi def render_qweb_pdf(self, res_ids=None, data=None): _logger.debug("render_qweb_pdf : %s -- %s" %(res_ids, data)) if res_ids: diff --git a/product_update_price_last_purchase/models/product_pricelist.py b/product_update_price_last_purchase/models/product_pricelist.py index e568758..15ffb29 100644 --- a/product_update_price_last_purchase/models/product_pricelist.py +++ b/product_update_price_last_purchase/models/product_pricelist.py @@ -8,7 +8,6 @@ from odoo import api, models class ProductPricelist(models.Model): _inherit = 'product.pricelist' - @api.multi def _compute_price_rule(self, products_qty_partner, date=False, uom_id=False): ProductPricelistItem = self.env['product.pricelist.item'] ProductProduct = self.env['product.product'] diff --git a/product_update_price_last_purchase/models/product_product.py b/product_update_price_last_purchase/models/product_product.py index 51baf7d..aa2d836 100644 --- a/product_update_price_last_purchase/models/product_product.py +++ b/product_update_price_last_purchase/models/product_product.py @@ -5,14 +5,12 @@ import logging from odoo import models, fields, api -from odoo.addons import decimal_precision as dp _logger = logging.getLogger(__name__) class ProductProduct(models.Model): _inherit = "product.product" - @api.multi def write(self, vals): if vals.get('last_purchase_price'): vals['list_price_updated'] = True @@ -22,5 +20,5 @@ class ProductProduct(models.Model): class ProductPackaging(models.Model): _inherit = "product.packaging" - qty = fields.Float('Contained Quantity', help="The total number of products you can have per pallet or box.", digits=dp.get_precision('Product Unit of Measure')) + qty = fields.Float('Contained Quantity', help="The total number of products you can have per pallet or box.", digits='Product Unit of Measure') diff --git a/product_update_price_last_purchase/models/product_template.py b/product_update_price_last_purchase/models/product_template.py index fdaab14..d94e7e1 100644 --- a/product_update_price_last_purchase/models/product_template.py +++ b/product_update_price_last_purchase/models/product_template.py @@ -7,14 +7,12 @@ import math from odoo import exceptions, models, fields, api, _ from odoo.exceptions import UserError -from odoo.addons import decimal_precision as dp _logger = logging.getLogger(__name__) class ProductTemplate(models.Model): _inherit = "product.template" - @api.multi def _compute_theoritical_price(self): partner = self.env['res.users'].browse(self.env.uid).partner_id pricelist_obj = self.env['product.pricelist'] @@ -41,7 +39,7 @@ class ProductTemplate(models.Model): list_price = fields.Float( string="Sale price with VAT", help="Price calculated according to the configured pricelist, including VAT.", - digits=dp.get_precision('Product Price') + digits='Product Price' ) list_price_updated = fields.Boolean( @@ -68,7 +66,7 @@ class ProductTemplate(models.Model): string="Last purchase price", help="The last price at which the product was purchased. It is used as the base price field for calculating the product sale price.", #readonly=True, - digits=dp.get_precision('Product Price') + digits='Product Price' ) last_purchase_price_compute_type = fields.Selection([ @@ -95,7 +93,6 @@ class ProductTemplate(models.Model): vals['list_price_updated'] = True return super(ProductTemplate, self).create(vals) - @api.multi def write(self, vals): # Set supplier tax same than customer tax if vals.get('taxes_id'): diff --git a/product_update_price_last_purchase/models/res_config.py b/product_update_price_last_purchase/models/res_config.py index 338ad5c..5aa1510 100644 --- a/product_update_price_last_purchase/models/res_config.py +++ b/product_update_price_last_purchase/models/res_config.py @@ -18,7 +18,6 @@ class ResConfigSettings(models.TransientModel): "product_update_price_last_purchase.product_pricelist_automatic", default=0) return res - @api.multi def set_values(self): super(ResConfigSettings, self).set_values() config_obj = self.env["ir.config_parameter"] diff --git a/product_update_price_last_purchase/models/stock_move.py b/product_update_price_last_purchase/models/stock_move.py index b254f54..41a0b5e 100644 --- a/product_update_price_last_purchase/models/stock_move.py +++ b/product_update_price_last_purchase/models/stock_move.py @@ -16,7 +16,6 @@ _logger = logging.getLogger(__name__) class StockMove(models.Model): _inherit = 'stock.move' - @api.multi def product_price_update_before_done(self): super(StockMove, self).product_price_update_before_done() for move in self.filtered(lambda move: move.location_id.usage == 'supplier'): diff --git a/product_update_price_last_purchase/views/actions.xml b/product_update_price_last_purchase/views/actions.xml index bf22acc..b95ef88 100644 --- a/product_update_price_last_purchase/views/actions.xml +++ b/product_update_price_last_purchase/views/actions.xml @@ -23,7 +23,6 @@ Productos con PVP actualizable ir.actions.act_window product.template - form tree,form []