[MIG] product_update_price_last_purchase: Migration to 16.0
This commit is contained in:
parent
0d34939bf4
commit
6ecf2812a0
8 changed files with 4 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
'name': 'Product Update Price From Last Purchase',
|
'name': 'Product Update Price From Last Purchase',
|
||||||
'version': '12.0.2.1.0',
|
'version': "16.0.1.0.0",
|
||||||
'category': 'purchase',
|
'category': 'purchase',
|
||||||
'summary' : 'Product Update Price From Last Purchase',
|
'summary' : 'Product Update Price From Last Purchase',
|
||||||
'description' : """
|
'description' : """
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ _logger = logging.getLogger(__name__)
|
||||||
class IrActionsReport(models.Model):
|
class IrActionsReport(models.Model):
|
||||||
_inherit = 'ir.actions.report'
|
_inherit = 'ir.actions.report'
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def render_qweb_pdf(self, res_ids=None, data=None):
|
def render_qweb_pdf(self, res_ids=None, data=None):
|
||||||
_logger.debug("render_qweb_pdf : %s -- %s" %(res_ids, data))
|
_logger.debug("render_qweb_pdf : %s -- %s" %(res_ids, data))
|
||||||
if res_ids:
|
if res_ids:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ from odoo import api, models
|
||||||
class ProductPricelist(models.Model):
|
class ProductPricelist(models.Model):
|
||||||
_inherit = 'product.pricelist'
|
_inherit = 'product.pricelist'
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_price_rule(self, products_qty_partner, date=False, uom_id=False):
|
def _compute_price_rule(self, products_qty_partner, date=False, uom_id=False):
|
||||||
ProductPricelistItem = self.env['product.pricelist.item']
|
ProductPricelistItem = self.env['product.pricelist.item']
|
||||||
ProductProduct = self.env['product.product']
|
ProductProduct = self.env['product.product']
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,12 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.addons import decimal_precision as dp
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class ProductProduct(models.Model):
|
class ProductProduct(models.Model):
|
||||||
_inherit = "product.product"
|
_inherit = "product.product"
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
if vals.get('last_purchase_price'):
|
if vals.get('last_purchase_price'):
|
||||||
vals['list_price_updated'] = True
|
vals['list_price_updated'] = True
|
||||||
|
|
@ -22,5 +20,5 @@ class ProductProduct(models.Model):
|
||||||
class ProductPackaging(models.Model):
|
class ProductPackaging(models.Model):
|
||||||
_inherit = "product.packaging"
|
_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')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,12 @@ import math
|
||||||
|
|
||||||
from odoo import exceptions, models, fields, api, _
|
from odoo import exceptions, models, fields, api, _
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
from odoo.addons import decimal_precision as dp
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class ProductTemplate(models.Model):
|
class ProductTemplate(models.Model):
|
||||||
_inherit = "product.template"
|
_inherit = "product.template"
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_theoritical_price(self):
|
def _compute_theoritical_price(self):
|
||||||
partner = self.env['res.users'].browse(self.env.uid).partner_id
|
partner = self.env['res.users'].browse(self.env.uid).partner_id
|
||||||
pricelist_obj = self.env['product.pricelist']
|
pricelist_obj = self.env['product.pricelist']
|
||||||
|
|
@ -41,7 +39,7 @@ class ProductTemplate(models.Model):
|
||||||
list_price = fields.Float(
|
list_price = fields.Float(
|
||||||
string="Sale price with VAT",
|
string="Sale price with VAT",
|
||||||
help="Price calculated according to the configured pricelist, including 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(
|
list_price_updated = fields.Boolean(
|
||||||
|
|
@ -68,7 +66,7 @@ class ProductTemplate(models.Model):
|
||||||
string="Last purchase price",
|
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.",
|
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,
|
#readonly=True,
|
||||||
digits=dp.get_precision('Product Price')
|
digits='Product Price'
|
||||||
)
|
)
|
||||||
|
|
||||||
last_purchase_price_compute_type = fields.Selection([
|
last_purchase_price_compute_type = fields.Selection([
|
||||||
|
|
@ -95,7 +93,6 @@ class ProductTemplate(models.Model):
|
||||||
vals['list_price_updated'] = True
|
vals['list_price_updated'] = True
|
||||||
return super(ProductTemplate, self).create(vals)
|
return super(ProductTemplate, self).create(vals)
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
# Set supplier tax same than customer tax
|
# Set supplier tax same than customer tax
|
||||||
if vals.get('taxes_id'):
|
if vals.get('taxes_id'):
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ class ResConfigSettings(models.TransientModel):
|
||||||
"product_update_price_last_purchase.product_pricelist_automatic", default=0)
|
"product_update_price_last_purchase.product_pricelist_automatic", default=0)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def set_values(self):
|
def set_values(self):
|
||||||
super(ResConfigSettings, self).set_values()
|
super(ResConfigSettings, self).set_values()
|
||||||
config_obj = self.env["ir.config_parameter"]
|
config_obj = self.env["ir.config_parameter"]
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ _logger = logging.getLogger(__name__)
|
||||||
class StockMove(models.Model):
|
class StockMove(models.Model):
|
||||||
_inherit = 'stock.move'
|
_inherit = 'stock.move'
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def product_price_update_before_done(self):
|
def product_price_update_before_done(self):
|
||||||
super(StockMove, self).product_price_update_before_done()
|
super(StockMove, self).product_price_update_before_done()
|
||||||
for move in self.filtered(lambda move: move.location_id.usage == 'supplier'):
|
for move in self.filtered(lambda move: move.location_id.usage == 'supplier'):
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
<field name="name">Productos con PVP actualizable</field>
|
<field name="name">Productos con PVP actualizable</field>
|
||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">product.template</field>
|
<field name="res_model">product.template</field>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="view_id" ref="product.product_template_tree_view"/>
|
<field name="view_id" ref="product.product_template_tree_view"/>
|
||||||
<field name="domain">[]</field>
|
<field name="domain">[]</field>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue