Sanjay Gohel (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-stage-action-rule-sgo into lp:openobject-addons.
Requested reviews: OpenERP Core Team (openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-stage-action-rule-sgo/+merge/135662 Hello, I have resolved the issue of when create automated action on lead/opprtunity for button pressed condition and set action to change the team. it will not working with click on stage. Thank You. Sanjay Gohel (sgo) -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-stage-action-rule-sgo/+merge/135662 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-stage-action-rule-sgo.
=== modified file 'base_status/base_stage.py' --- base_status/base_stage.py 2012-11-16 13:51:44 +0000 +++ base_status/base_stage.py 2012-11-22 12:29:22 +0000 @@ -202,9 +202,7 @@ def case_escalate(self, cr, uid, ids, context=None): """ Escalates case to parent level """ - cases = self.browse(cr, uid, ids, context=context) - cases[0].state # fill browse record cache, for _action having old and new values - for case in cases: + for case in self.browse(cr, uid, ids, context=context): data = {'active': True} if case.section_id.parent_id: data['section_id'] = case.section_id.parent_id.id @@ -215,8 +213,6 @@ raise osv.except_osv(_('Error!'), _("You are already at the top level of your sales-team category.\nTherefore you cannot escalate furthermore.")) self.write(cr, uid, [case.id], data, context=context) case.case_escalate_send_note(case.section_id.parent_id, context=context) - cases = self.browse(cr, uid, ids, context=context) - self._action(cr, uid, cases, 'escalate', context=context) return True def case_open(self, cr, uid, ids, context=None): @@ -256,8 +252,7 @@ def case_set(self, cr, uid, ids, new_state_name=None, values_to_update=None, new_stage_id=None, context=None): """ Generic method for setting case. This methods wraps the update - of the record, as well as call to _action and browse_record - case setting to fill the cache. + of the record. :params new_state_name: the new state of the record; this method will call ``stage_set_with_state_name`` @@ -271,7 +266,6 @@ update when writing values to the record. """ cases = self.browse(cr, uid, ids, context=context) - cases[0].state # fill browse record cache, for _action having old and new values # 1. update the stage if new_state_name: self.stage_set_with_state_name(cr, uid, cases, new_state_name, context=context) @@ -280,13 +274,14 @@ # 2. update values if values_to_update: self.write(cr, uid, ids, values_to_update, context=context) - # 3. call _action for base action rule - if new_state_name: - self._action(cr, uid, cases, new_state_name, context=context) - elif not (new_stage_id is None): - new_state_name = self.read(cr, uid, ids, ['state'], context=context)[0]['state'] - self._action(cr, uid, cases, new_state_name, context=context) return True + + def write(self, cr, uid, ids, vals, context=None): + res = super(base_stage,self).write(cr, uid, ids, vals, context) + if vals.get('stage_id'): + for case in self.browse(cr, uid, ids, context=context): + self._action(cr, uid, case, case.stage_id.state, context=context) + return res def _action(self, cr, uid, cases, state_to, scrit=None, context=None): if context is None:
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp