Merge lp:~bcim/openobject-addons/7.0-fix-date_closed into lp:openobject-addons/7.0

Proposed by Martin Trigaux (OpenERP)
Status: Needs review
Proposed branch: lp:~bcim/openobject-addons/7.0-fix-date_closed
Merge into: lp:openobject-addons/7.0
Diff against target: 11 lines (+1/-1)
1 file modified
crm/crm_lead.py (+1/-1)
To merge this branch: bzr merge lp:~bcim/openobject-addons/7.0-fix-date_closed
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Needs Fixing
Review via email: mp+216258@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Hello,

Instead of depending on the state, it's probably better to backport the behaviour of trunk: calling onchange_stage_id in the write method which will set a value to date_closed in case of valid probability.

Regards

review: Needs Fixing

Unmerged revisions

9892. By Jacques-Etienne Baudoux

[FIX] crm: write a value to date_closed field as well if change directly the stage instead of using buttons (opw 603537) - fix of commit 9888

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'crm/crm_lead.py'
2--- crm/crm_lead.py 2014-04-02 12:20:23 +0000
3+++ crm/crm_lead.py 2014-04-17 07:19:59 +0000
4@@ -932,7 +932,7 @@
5 # change probability of lead(s) if required by stage
6 vals['probability'] = stage.probability
7 # set closed date when won or lost
8- if not vals.get('date_closed') and (vals.get('probability', 0) >= 100 or stage.state == 'canceled'):
9+ if not vals.get('date_closed') and stage.state in ('done', 'cancel'):
10 vals['date_closed'] = fields.datetime.now()
11 return super(crm_lead, self).write(cr, uid, ids, vals, context=context)
12