[FIX] sale: display related SO for intermediate contacts
Current behaviour: In the context of a multilevel contact hierarchy, if a contact is creating an SO, only that contact and it's commercial partner (usually the first company when going up in hierarchy from that contact) can see the SO. The other contacts that are in that hierarchy could see the number of related SO on the smart button, but once clicking on it, no SO were shown. Expected behaviour: Every direct or indirect parent of a contact should be able to see the SO, as shown in the smart button count. Steps to reproduce: - Create 3 contacts with the following hierarchy: Company -> Contact 1 -> Contact 2 (Company is the root) - Create an SO with Contact 2 as a customer - On each of the contacts, click on the SO smart button, all of them have 1 SO shown on the button, but only Constact 1 has none shown once clicked. (Regardless if Contact 1 is an Individual or Company) Fix: Simplify domain search to only take into account the children's ids. There is no need to make a distinction between a contact that is a company or not, since all commercial_partners are also partners by default. Affected versions: - 14.0 - 15.0 - saas-15.2 - saas-15.3 - master opw-2961030 closes odoo/odoo#100544 X-original-commit: c34e0200b2db3ad191ee08f91f9293404a2c3340 Signed-off-by: Piryns Victor (pivi) <pivi@odoo.com>
This commit is contained in:
@@ -51,8 +51,5 @@ class ResPartner(models.Model):
|
||||
def action_view_sale_order(self):
|
||||
action = self.env['ir.actions.act_window']._for_xml_id('sale.act_res_partner_2_sale_order')
|
||||
all_child = self.with_context(active_test=False).search([('id', 'child_of', self.ids)])
|
||||
if self.is_company:
|
||||
action['domain'] = [('partner_id.commercial_partner_id', '=', self.id), ('partner_id', 'in', all_child.ids)]
|
||||
else:
|
||||
action['domain'] = [('partner_id', '=', self.id), ('partner_id', 'in', all_child.ids)]
|
||||
action["domain"] = [("partner_id", "in", all_child.ids)]
|
||||
return action
|
||||
|
||||
Reference in New Issue
Block a user