[IMP] purchase: improve product purchase smart button view
Display the purchase order list instead of the analysis view opw-2976152 closes odoo/odoo#100758 X-original-commit: be438c80aaceed80b808945cadcc30fd8aba3a86 Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
@@ -35,12 +35,9 @@ class ProductTemplate(models.Model):
|
||||
return res
|
||||
|
||||
def action_view_po(self):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("purchase.action_purchase_order_report_all")
|
||||
action['domain'] = ['&', ('state', 'in', ['purchase', 'done']), ('product_tmpl_id', 'in', self.ids)]
|
||||
action['context'] = {
|
||||
'graph_measure': 'qty_ordered',
|
||||
'search_default_later_than_a_year_ago': True
|
||||
}
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("purchase.action_purchase_history")
|
||||
action['domain'] = ['&', ('state', 'in', ['purchase', 'done']), ('product_id', 'in', self.product_variant_ids.ids)]
|
||||
action['display_name'] = _("Purchase History for %s", self.display_name)
|
||||
return action
|
||||
|
||||
|
||||
@@ -67,12 +64,9 @@ class ProductProduct(models.Model):
|
||||
product.purchased_product_qty = float_round(purchased_data.get(product.id, 0), precision_rounding=product.uom_id.rounding)
|
||||
|
||||
def action_view_po(self):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("purchase.action_purchase_order_report_all")
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("purchase.action_purchase_history")
|
||||
action['domain'] = ['&', ('state', 'in', ['purchase', 'done']), ('product_id', 'in', self.ids)]
|
||||
action['context'] = {
|
||||
'graph_measure': 'qty_ordered',
|
||||
'search_default_later_than_a_year_ago': True
|
||||
}
|
||||
action['display_name'] = _("Purchase History for %s", self.display_name)
|
||||
return action
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user