You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
690 B

# Copyright 2021 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import models
class Pricelist(models.Model):
_inherit = "product.pricelist"
def show_pricelist_partners(self):
if len(self) == 1:
domain = [("property_product_pricelist", "=", self.id)]
else:
domain = [("property_product_pricelist", "in", self.ids)]
partners = self.env["res.partner"].search(domain)
xmlid = "base.action_partner_form"
action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)
action["domain"] = [
("id", "in", partners.ids),
]
return action