diff --git a/partner_contact_in_several_companies/__manifest__.py b/partner_contact_in_several_companies/__manifest__.py index 1a544f1c7..b24028bd2 100644 --- a/partner_contact_in_several_companies/__manifest__.py +++ b/partner_contact_in_several_companies/__manifest__.py @@ -29,6 +29,7 @@ ], "data": [ "views/res_partner.xml", + "data/ir_actions.xml", ], "demo": [ "demo/res_partner.xml", diff --git a/partner_contact_in_several_companies/data/ir_actions.xml b/partner_contact_in_several_companies/data/ir_actions.xml new file mode 100644 index 000000000..2128d7d59 --- /dev/null +++ b/partner_contact_in_several_companies/data/ir_actions.xml @@ -0,0 +1,4 @@ + + + + diff --git a/partner_contact_in_several_companies/models/ir_actions.py b/partner_contact_in_several_companies/models/ir_actions.py index 5352bc815..599dd1e22 100644 --- a/partner_contact_in_several_companies/models/ir_actions.py +++ b/partner_contact_in_several_companies/models/ir_actions.py @@ -21,3 +21,16 @@ class IRActionsWindow(models.Model): "{'is_set': True, 'set_value': False},"), 1) return actions + + @api.model + def _enable_context(self): + action = self.env.ref('base.action_partner_form') + if 'search_show_all_positions' not in action.context: + + action_ctx = action.context.replace( + '{', + ("{'search_show_all_positions': " + "{'is_set': True, 'set_value': False},"), + 1) + action.write({'context': action_ctx}) + return True diff --git a/partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py b/partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py index 30165c80a..04b8aac94 100644 --- a/partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py +++ b/partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py @@ -198,9 +198,8 @@ class PartnerContactInSeveralCompaniesCase(common.TransactionCase): """ new_context_val = "'search_show_all_positions': " \ - "{'is_set': True, 'set_value': False}," + "{'is_set': True, 'set_value': False}" details = self.env.ref('base.action_partner_form') - self.assertIn( new_context_val, details.context,