+-
+ Create some action bindings for a non-existing model
+-
+ !python {model: ir.values }: |
+ self.set(cr, uid, 'action', 'tree_but_open', 'OnDblClick Action', ['unexisting_model'], 'ir.actions.act_window,10', isobject=True)
+ self.set(cr, uid, 'action', 'tree_but_open', 'OnDblClick Action 2', ['unexisting_model'], 'ir.actions.act_window,11', isobject=True)
+ self.set(cr, uid, 'action', 'client_action_multi', 'Side Wizard', ['unexisting_model'], 'ir.actions.act_window,12', isobject=True)
+ self.set(cr, uid, 'action', 'client_print_multi', 'Nice Report', ['unexisting_model'], 'ir.actions.report.xml,2', isobject=True)
+ self.set(cr, uid, 'action', 'client_action_relate', 'Related Stuff', ['unexisting_model'], 'ir.actions.act_window,14', isobject=True)
+-
+ Replace one action binding to set a new name
+-
+ !python {model: ir.values }: |
+ self.set(cr, uid, 'action', 'tree_but_open', 'OnDblClick Action New', ['unexisting_model'], 'ir.actions.act_window,10', isobject=True)
+-
+ Retrieve the action bindings and check they're correct
+-
+ !python {model: ir.values }: |
+ actions = self.get(cr, uid, 'action', 'tree_but_open', ['unexisting_model'])
+ assert len(actions) == 2, "Mismatching number of bound actions"
+ #first action
+ assert len(actions[0]) == 3, "Malformed action definition"
+ assert actions[0][1] == 'OnDblClick Action 2', 'Bound action does not match definition'
+ assert isinstance(actions[0][2], dict) and actions[0][2]['id'] == 11, 'Bound action does not match definition'
+ #second action - this ones comes last because it was re-created with a different name
+ assert len(actions[1]) == 3, "Malformed action definition"
+ assert actions[1][1] == 'OnDblClick Action New', 'Re-Registering an action should replace it'
+ assert isinstance(actions[1][2], dict) and actions[1][2]['id'] == 10, 'Bound action does not match definition'
+
+ actions = self.get(cr, uid, 'action', 'client_action_multi', ['unexisting_model'])
+ assert len(actions) == 1, "Mismatching number of bound actions"
+ assert len(actions[0]) == 3, "Malformed action definition"
+ assert actions[0][1] == 'Side Wizard', 'Bound action does not match definition'
+ assert isinstance(actions[0][2], dict) and actions[0][2]['id'] == 12, 'Bound action does not match definition'
+
+ actions = self.get(cr, uid, 'action', 'client_print_multi', ['unexisting_model'])
+ assert len(actions) == 1, "Mismatching number of bound actions"
+ assert len(actions[0]) == 3, "Malformed action definition"
+ assert actions[0][1] == 'Nice Report', 'Bound action does not match definition'
+ assert isinstance(actions[0][2], dict) and actions[0][2]['id'] == 2, 'Bound action does not match definition'