[REF] product price history action
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, fields
|
from odoo import models, fields
|
||||||
|
from odoo.tools.safe_eval import safe_eval
|
||||||
|
|
||||||
|
|
||||||
class ProductProduct(models.Model):
|
class ProductProduct(models.Model):
|
||||||
@@ -40,9 +41,8 @@ class ProductProduct(models.Model):
|
|||||||
|
|
||||||
def show_product_price_history(self):
|
def show_product_price_history(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
action = self.env.ref(['ir.actions.act_window'].for_xml_id(
|
action = self.env.ref(
|
||||||
'product_usability', 'product_price_history_action')
|
'product_usability.product_price_history_action').read()[0]
|
||||||
action.update({
|
action['domain'] = safe_eval(action['domain'])
|
||||||
'domain': "[('product_id', '=', %d)]" % self.ids[0],
|
action['domain'].append(('product_id', '=', self.id))
|
||||||
})
|
|
||||||
return action
|
return action
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class ProductTemplate(models.Model):
|
|||||||
|
|
||||||
purchase_ok = fields.Boolean(
|
purchase_ok = fields.Boolean(
|
||||||
track_visibility='onchange')
|
track_visibility='onchange')
|
||||||
|
|
||||||
active = fields.Boolean(
|
active = fields.Boolean(
|
||||||
track_visibility='onchange')
|
track_visibility='onchange')
|
||||||
|
|
||||||
@@ -34,9 +34,7 @@ class ProductTemplate(models.Model):
|
|||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
products = self.env['product.product'].search(
|
products = self.env['product.product'].search(
|
||||||
[('product_tmpl_id', '=', self._context['active_id'])])
|
[('product_tmpl_id', '=', self._context['active_id'])])
|
||||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
action = self.env.ref(
|
||||||
'product_usability', 'product_price_history_action')
|
'product_usability.product_price_history_action').read()[0]
|
||||||
action.update({
|
action['domain'] = [('product_id', 'in', products.ids)]
|
||||||
'domain': "[('product_id', 'in', %s)]" % products.ids,
|
|
||||||
})
|
|
||||||
return action
|
return action
|
||||||
|
|||||||
Reference in New Issue
Block a user