Browse Source

[FIX] update base action with new context

pull/347/head
Nicolas JEUDY 8 years ago
parent
commit
ac2ae00dd4
  1. 1
      partner_contact_in_several_companies/__manifest__.py
  2. 4
      partner_contact_in_several_companies/data/ir_actions.xml
  3. 13
      partner_contact_in_several_companies/models/ir_actions.py
  4. 3
      partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py

1
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",

4
partner_contact_in_several_companies/data/ir_actions.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<function model="ir.actions.act_window" name="_enable_context"/>
</odoo>

13
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

3
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,

Loading…
Cancel
Save