Merge lp:~openerp-dev/openobject-addons/trunk-stage-vs-status-aja into lp:openobject-addons
- trunk-stage-vs-status-aja
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-addons/trunk-stage-vs-status-aja |
Merge into: | lp:openobject-addons |
Diff against target: |
3398 lines (+208/-1131) 69 files modified
base_status/base_stage.py (+1/-1) crm/board_crm_view.xml (+2/-2) crm/crm.py (+0/-4) crm/crm_action_rule_demo.xml (+1/-1) crm/crm_case_section_view.xml (+1/-1) crm/crm_lead.py (+16/-51) crm/crm_lead_data.xml (+16/-24) crm/crm_lead_demo.xml (+0/-45) crm/crm_lead_view.xml (+14/-29) crm/crm_view.xml (+0/-2) crm/report/crm_lead_report.py (+1/-11) crm/report/crm_lead_report_view.xml (+3/-7) crm/res_partner.py (+1/-2) crm/test/crm_lead_cancel.yml (+1/-25) crm/test/crm_lead_onchange.yml (+2/-2) crm/test/lead2opportunity2win.yml (+3/-10) crm/wizard/crm_lead_to_opportunity.py (+3/-3) crm/wizard/crm_merge_opportunities.py (+2/-2) crm_claim/crm_claim.py (+1/-20) crm_claim/crm_claim_data.xml (+4/-8) crm_claim/crm_claim_view.xml (+1/-12) crm_claim/report/crm_claim_report.py (+1/-11) crm_claim/report/crm_claim_report_view.xml (+1/-8) crm_claim/test/process/claim.yml (+0/-28) crm_partner_assign/report/crm_lead_report.py (+0/-9) crm_partner_assign/report/crm_lead_report_view.xml (+1/-2) crm_partner_assign/res_partner_view.xml (+5/-22) crm_todo/crm_todo_view.xml (+3/-7) hr_recruitment/board_hr_recruitment_statistical_view.xml (+1/-1) hr_recruitment/hr_recruitment.py (+27/-73) hr_recruitment/hr_recruitment_data.xml (+0/-6) hr_recruitment/hr_recruitment_view.xml (+9/-17) hr_recruitment/report/hr_recruitment_report.py (+0/-11) hr_recruitment/report/hr_recruitment_report_view.xml (+0/-6) hr_recruitment/test/recruitment_process.yml (+4/-31) pad_project/project_task.xml (+1/-1) portal_project_issue/portal_project_issue_view.xml (+0/-3) project/__openerp__.py (+0/-1) project/board_project_view.xml (+1/-2) project/project.py (+26/-129) project/project_data.xml (+6/-14) project/project_demo.xml (+0/-10) project/project_view.xml (+18/-35) project/report/project_report.py (+0/-3) project/report/project_report_view.xml (+0/-7) project/res_partner_view.xml (+0/-3) project/test/task_process.yml (+2/-52) project/wizard/__init__.py (+0/-1) project/wizard/project_task_reevaluate.py (+0/-84) project/wizard/project_task_reevaluate_view.xml (+0/-32) project_gtd/project_gtd_view.xml (+0/-4) project_gtd/wizard/project_gtd_empty.py (+1/-1) project_issue/__openerp__.py (+0/-1) project_issue/board_project_issue_view.xml (+2/-3) project_issue/project_issue.py (+9/-20) project_issue/project_issue_view.xml (+6/-19) project_issue/report/project_issue_report.py (+1/-9) project_issue/report/project_issue_report_view.xml (+1/-6) project_issue/test/cancel_issue.yml (+0/-60) project_issue/test/issue_process.yml (+0/-45) project_long_term/project_long_term_view.xml (+0/-1) project_long_term/test/phase_process.yml (+0/-45) project_long_term/test/task_process.yml (+1/-1) project_mrp/project_mrp.py (+3/-17) project_mrp/project_mrp_view.xml (+1/-1) project_mrp/project_procurement.py (+1/-1) project_mrp/test/project_task_procurement.yml (+0/-15) project_timesheet/test/worktask_entry_to_timesheetline_entry.yml (+0/-9) sale_crm/sale_crm_view.xml (+3/-2) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-addons/trunk-stage-vs-status-aja |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+156327@code.launchpad.net |
Commit message
Description of the change
Hello,
Remove the state field from hr_applicant , crm lead/opportunity and project issue/task.
Thank You.
- 8649. By ajay javiya (OpenERP)
-
[REM]: Related status from task type
- 8650. By ajay javiya (OpenERP)
-
Merge with trunk
- 8651. By ajay javiya (OpenERP)
-
[REM]: Related state from crm
- 8652. By ajay javiya (OpenERP)
-
[IMP]:code in project
- 8653. By ajay javiya (OpenERP)
-
[ADD]:Project task start and end date on stage change
- 8654. By ajay javiya (OpenERP)
-
[ADD]: Stage in search view
- 8655. By ajay javiya (OpenERP)
-
[MERGE]: with trunk
- 8656. By ajay javiya (OpenERP)
-
[IMP]:Exception message and code, remove traceback
- 8657. By ajay javiya (OpenERP)
-
[MERGE]: With trunk
- 8658. By ajay javiya (OpenERP)
-
[IMP]:Test cases
- 8659. By ajay javiya (OpenERP)
-
[REM]:Unwanted changes
- 8660. By ajay javiya (OpenERP)
-
[IMP]: Exception message , stage is only visible when button click to related stage in crm and calculate work progress based on remaining hours
- 8661. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8662. By ajay javiya (OpenERP)
-
[MRG]: with latest trunk
- 8663. By ajay javiya (OpenERP)
-
[MERG]:With main trunk
- 8664. By ajay javiya (OpenERP)
-
[FIX]: fix issue of stage
- 8665. By ajay javiya (OpenERP)
-
[MERG]: with trunk
- 8666. By ajay javiya (OpenERP)
-
[IMP]:Go to the team configuration should go to the team kanban view.
- 8667. By ajay javiya (OpenERP)
-
[MERGE]: with trunk
Unmerged revisions
- 8667. By ajay javiya (OpenERP)
-
[MERGE]: with trunk
- 8666. By ajay javiya (OpenERP)
-
[IMP]:Go to the team configuration should go to the team kanban view.
- 8665. By ajay javiya (OpenERP)
-
[MERG]: with trunk
- 8664. By ajay javiya (OpenERP)
-
[FIX]: fix issue of stage
- 8663. By ajay javiya (OpenERP)
-
[MERG]:With main trunk
- 8662. By ajay javiya (OpenERP)
-
[MRG]: with latest trunk
- 8661. By Turkesh Patel (openERP)
-
[MRG] merge with lp:openobject-addons
- 8660. By ajay javiya (OpenERP)
-
[IMP]: Exception message , stage is only visible when button click to related stage in crm and calculate work progress based on remaining hours
- 8659. By ajay javiya (OpenERP)
-
[REM]:Unwanted changes
- 8658. By ajay javiya (OpenERP)
-
[IMP]:Test cases
Preview Diff
1 | === modified file 'base_status/base_stage.py' |
2 | --- base_status/base_stage.py 2012-12-21 13:48:10 +0000 |
3 | +++ base_status/base_stage.py 2013-06-05 13:32:29 +0000 |
4 | @@ -108,7 +108,7 @@ |
5 | |
6 | def _get_default_stage_id(self, cr, uid, context=None): |
7 | """ Gives default stage_id """ |
8 | - return self.stage_find(cr, uid, [], None, [('state', '=', 'draft')], context=context) |
9 | + return self.stage_find(cr, uid, [], None, [], context=context)# get default stage with lower priority |
10 | |
11 | def stage_find(self, cr, uid, cases, section_id, domain=[], order='sequence', context=None): |
12 | """ Find stage, with a given (optional) domain on the search, |
13 | |
14 | === modified file 'crm/board_crm_view.xml' |
15 | --- crm/board_crm_view.xml 2012-11-30 17:11:30 +0000 |
16 | +++ crm/board_crm_view.xml 2013-06-05 13:32:29 +0000 |
17 | @@ -19,7 +19,7 @@ |
18 | <field name="view_type">form</field> |
19 | <field name="view_mode">graph,tree,form</field> |
20 | <field name="view_id" ref="view_crm_opportunity_stage_graph"/> |
21 | - <field name="domain">[('state', 'not in', ('done', 'cancel')), ('type', '=', 'opportunity')]</field> |
22 | + <field name="domain">[('stage_sequence', 'not in', (6,7,8)), ('type', '=', 'opportunity')]</field> |
23 | <field name="context">{'search_default_Stage':1}</field> |
24 | </record> |
25 | |
26 | @@ -43,7 +43,7 @@ |
27 | <field name="view_type">form</field> |
28 | <field name="view_mode">graph,tree,form</field> |
29 | <field name="view_id" ref="view_crm_opportunity_user_stage_graph"/> |
30 | - <field name="domain">[('state','!=','cancel'),('opening_date','>',context_today().strftime("%Y-%m-%d"))]</field> |
31 | + <field name="domain">[('stage_sequence','not in',[7,8]),('opening_date','>',context_today().strftime("%Y-%m-%d"))]</field> |
32 | <field name="context">{'search_default_Stage':1}</field> |
33 | </record> |
34 | |
35 | |
36 | === modified file 'crm/crm.py' |
37 | --- crm/crm.py 2013-05-31 15:31:00 +0000 |
38 | +++ crm/crm.py 2013-06-05 13:32:29 +0000 |
39 | @@ -74,9 +74,6 @@ |
40 | 'requirements': fields.text('Requirements'), |
41 | 'section_ids':fields.many2many('crm.case.section', 'section_stage_rel', 'stage_id', 'section_id', string='Sections', |
42 | help="Link between stages and sales teams. When set, this limitate the current stage to the selected sales teams."), |
43 | - 'state': fields.selection(AVAILABLE_STATES, 'Related Status', required=True, |
44 | - help="The status of your document will automatically change regarding the selected stage. " \ |
45 | - "For example, if a stage is related to the status 'Close', when your document reaches this stage, it is automatically closed."), |
46 | 'case_default': fields.boolean('Default to New Sales Team', |
47 | help="If you check this field, this stage will be proposed by default on each sales team. It will not assign this stage to existing teams."), |
48 | 'fold': fields.boolean('Fold by Default', |
49 | @@ -91,7 +88,6 @@ |
50 | _defaults = { |
51 | 'sequence': lambda *args: 1, |
52 | 'probability': lambda *args: 0.0, |
53 | - 'state': 'open', |
54 | 'fold': False, |
55 | 'type': 'both', |
56 | 'case_default': True, |
57 | |
58 | === modified file 'crm/crm_action_rule_demo.xml' |
59 | --- crm/crm_action_rule_demo.xml 2013-03-04 09:49:51 +0000 |
60 | +++ crm/crm_action_rule_demo.xml 2013-06-05 13:32:29 +0000 |
61 | @@ -5,7 +5,7 @@ |
62 | <record id="filter_draft_lead" model="ir.filters"> |
63 | <field name="name">Draft Leads</field> |
64 | <field name="model_id">crm.lead</field> |
65 | - <field name="domain">[('state','=','draft')]</field> |
66 | + <field name="domain">[('stage_sequence','=',1)]</field> |
67 | <field name="user_id" eval="False"/> |
68 | </record> |
69 | <record id="action_email_reminder_lead" model="ir.actions.server"> |
70 | |
71 | === modified file 'crm/crm_case_section_view.xml' |
72 | --- crm/crm_case_section_view.xml 2013-06-04 11:51:59 +0000 |
73 | +++ crm/crm_case_section_view.xml 2013-06-05 13:32:29 +0000 |
74 | @@ -299,4 +299,4 @@ |
75 | parent="base.menu_sales" |
76 | groups="base.group_multi_salesteams"/> |
77 | </data> |
78 | -</openerp> |
79 | \ No newline at end of file |
80 | +</openerp> |
81 | |
82 | === modified file 'crm/crm_lead.py' |
83 | --- crm/crm_lead.py 2013-05-22 14:50:42 +0000 |
84 | +++ crm/crm_lead.py 2013-06-05 13:32:29 +0000 |
85 | @@ -62,11 +62,6 @@ |
86 | 'email_from', |
87 | 'email_cc', |
88 | 'partner_name'] |
89 | -CRM_LEAD_PENDING_STATES = ( |
90 | - crm.AVAILABLE_STATES[2][0], # Cancelled |
91 | - crm.AVAILABLE_STATES[3][0], # Done |
92 | - crm.AVAILABLE_STATES[4][0], # Pending |
93 | -) |
94 | |
95 | class crm_lead(base_stage, format_address, osv.osv): |
96 | """ CRM Lead Case """ |
97 | @@ -76,13 +71,8 @@ |
98 | _inherit = ['mail.thread', 'ir.needaction_mixin'] |
99 | |
100 | _track = { |
101 | - 'state': { |
102 | - 'crm.mt_lead_create': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'new', |
103 | - 'crm.mt_lead_won': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', |
104 | - 'crm.mt_lead_lost': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'cancel', |
105 | - }, |
106 | 'stage_id': { |
107 | - 'crm.mt_lead_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'cancel', 'done'], |
108 | + 'crm.mt_lead_stage': lambda self, cr, uid, obj, ctx=None: obj['stage_id'] != False, |
109 | }, |
110 | } |
111 | |
112 | @@ -112,7 +102,7 @@ |
113 | def _get_default_stage_id(self, cr, uid, context=None): |
114 | """ Gives default stage_id """ |
115 | section_id = self._get_default_section_id(cr, uid, context=context) |
116 | - return self.stage_find(cr, uid, [], section_id, [('state', '=', 'draft')], context=context) |
117 | + return self.stage_find(cr, uid, [], section_id, [], context=context) |
118 | |
119 | def _resolve_section_id_from_context(self, cr, uid, context=None): |
120 | """ Returns ID of section based on the value of 'section_id' |
121 | @@ -274,8 +264,7 @@ |
122 | 'type':fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), ],'Type', help="Type is used to separate Leads and Opportunities"), |
123 | 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), |
124 | 'date_closed': fields.datetime('Closed', readonly=True), |
125 | - 'stage_id': fields.many2one('crm.case.stage', 'Stage', track_visibility='onchange', |
126 | - domain="['&', ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"), |
127 | + 'stage_id': fields.many2one('crm.case.stage', 'Stage', track_visibility='onchange'), |
128 | 'user_id': fields.many2one('res.users', 'Salesperson', select=True, track_visibility='onchange'), |
129 | 'referred': fields.char('Referred By', size=64), |
130 | 'date_open': fields.datetime('Opened', readonly=True), |
131 | @@ -283,10 +272,7 @@ |
132 | multi='day_open', type="float", store=True), |
133 | 'day_close': fields.function(_compute_day, string='Days to Close', \ |
134 | multi='day_close', type="float", store=True), |
135 | - 'state': fields.related('stage_id', 'state', type="selection", store=True, |
136 | - selection=crm.AVAILABLE_STATES, string="Status", readonly=True, |
137 | - help='The Status is set to \'Draft\', when a case is created. If the case is in progress the Status is set to \'Open\'. When the case is over, the Status is set to \'Done\'. If the case needs to be reviewed then the Status is set to \'Pending\'.'), |
138 | - |
139 | + 'stage_sequence': fields.related('stage_id','sequence',type='integer', string='Stage Sequence'), |
140 | # Only used for type opportunity |
141 | 'probability': fields.float('Success Rate (%)',group_operator="avg"), |
142 | 'planned_revenue': fields.float('Expected Revenue', track_visibility='always'), |
143 | @@ -374,22 +360,6 @@ |
144 | section_id = section_ids[0] |
145 | return {'value': {'section_id': section_id}} |
146 | |
147 | - def _check(self, cr, uid, ids=False, context=None): |
148 | - """ Override of the base.stage method. |
149 | - Function called by the scheduler to process cases for date actions |
150 | - Only works on not done and cancelled cases |
151 | - """ |
152 | - cr.execute('select * from crm_case \ |
153 | - where (date_action_last<%s or date_action_last is null) \ |
154 | - and (date_action_next<=%s or date_action_next is null) \ |
155 | - and state not in (\'cancel\',\'done\')', |
156 | - (time.strftime("%Y-%m-%d %H:%M:%S"), |
157 | - time.strftime('%Y-%m-%d %H:%M:%S'))) |
158 | - |
159 | - ids2 = map(lambda x: x[0], cr.fetchall() or []) |
160 | - cases = self.browse(cr, uid, ids2, context=context) |
161 | - return self._action(cr, uid, cases, False, context=context) |
162 | - |
163 | def stage_find(self, cr, uid, cases, section_id, domain=None, order='sequence', context=None): |
164 | """ Override of the base.stage method |
165 | Parameter of the stage search taken from the lead: |
166 | @@ -431,32 +401,24 @@ |
167 | return stage_ids[0] |
168 | return False |
169 | |
170 | - def case_cancel(self, cr, uid, ids, context=None): |
171 | - """ Overrides case_cancel from base_stage to set probability """ |
172 | - res = super(crm_lead, self).case_cancel(cr, uid, ids, context=context) |
173 | - self.write(cr, uid, ids, {'probability' : 0.0}, context=context) |
174 | - return res |
175 | - |
176 | - def case_reset(self, cr, uid, ids, context=None): |
177 | - """ Overrides case_reset from base_stage to set probability """ |
178 | - res = super(crm_lead, self).case_reset(cr, uid, ids, context=context) |
179 | - self.write(cr, uid, ids, {'probability': 0.0}, context=context) |
180 | - return res |
181 | - |
182 | def case_mark_lost(self, cr, uid, ids, context=None): |
183 | """ Mark the case as lost: state=cancel and probability=0 """ |
184 | for lead in self.browse(cr, uid, ids): |
185 | stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 0.0),('on_change','=',True)], context=context) |
186 | if stage_id: |
187 | self.case_set(cr, uid, [lead.id], values_to_update={'probability': 0.0}, new_stage_id=stage_id, context=context) |
188 | + else: |
189 | + raise self.pool.get('res.config.settings').get_config_warning(cr, _("To relieve your sales pipe and group all Lost opportunities, configure one of your sales stage as follow .\nProbability = 0 percentage (chance to Lost the opportunity) And change probability automatically \n You can create a specific column or edit an existing one from the menu %(menu:crm.menu_crm_case_section_act)s") ,context=context) |
190 | return True |
191 | |
192 | def case_mark_won(self, cr, uid, ids, context=None): |
193 | - """ Mark the case as won: state=done and probability=100 """ |
194 | + """ Mark the case as won: probability=100 """ |
195 | for lead in self.browse(cr, uid, ids): |
196 | stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 100.0),('on_change','=',True)], context=context) |
197 | if stage_id: |
198 | self.case_set(cr, uid, [lead.id], values_to_update={'probability': 100.0}, new_stage_id=stage_id, context=context) |
199 | + else: |
200 | + raise self.pool.get('res.config.settings').get_config_warning(cr, _("To relieve your sales pipe and group all won opportunities, configure one of your sales stage as follow .\nProbability = 100 percentage (chance to won the opportunity) And change probability automatically \n You can create a specific column or edit an existing one from the menu %(menu:crm.menu_crm_case_section_act)s") ,context=context) |
201 | return True |
202 | |
203 | def set_priority(self, cr, uid, ids, priority): |
204 | @@ -648,7 +610,7 @@ |
205 | sequenced_opps = [] |
206 | for opportunity in opportunities: |
207 | sequence = -1 |
208 | - if opportunity.stage_id and opportunity.stage_id.state != 'cancel': |
209 | + if opportunity.stage_id and opportunity.stage_id.sequence not in (7,8): |
210 | sequence = opportunity.stage_id.sequence |
211 | sequenced_opps.append(((int(sequence != -1 and opportunity.type == 'opportunity'), sequence, -opportunity.id), opportunity)) |
212 | |
213 | @@ -703,7 +665,7 @@ |
214 | 'phone': customer and customer.phone or lead.phone, |
215 | } |
216 | if not lead.stage_id or lead.stage_id.type=='lead': |
217 | - val['stage_id'] = self.stage_find(cr, uid, [lead], section_id, [('state', '=', 'draft'),('type', 'in', ('opportunity','both'))], context=context) |
218 | + val['stage_id'] = self.stage_find(cr, uid, [lead], section_id, [('type', 'in', ('opportunity','both'))], context=context) |
219 | return val |
220 | |
221 | def convert_opportunity(self, cr, uid, ids, partner_id, user_ids=False, section_id=False, context=None): |
222 | @@ -712,7 +674,7 @@ |
223 | partner = self.pool.get('res.partner') |
224 | customer = partner.browse(cr, uid, partner_id, context=context) |
225 | for lead in self.browse(cr, uid, ids, context=context): |
226 | - if lead.state in ('done', 'cancel'): |
227 | + if lead.stage_sequence in (6,7,8): |
228 | continue |
229 | vals = self._convert_opportunity_data(cr, uid, lead, customer, section_id, context=context) |
230 | self.write(cr, uid, [lead.id], vals, context=context) |
231 | @@ -931,11 +893,14 @@ |
232 | return res |
233 | |
234 | def write(self, cr, uid, ids, vals, context=None): |
235 | + stage_pool=self.pool.get('crm.case.stage') |
236 | if vals.get('stage_id') and not vals.get('probability'): |
237 | # change probability of lead(s) if required by stage |
238 | - stage = self.pool.get('crm.case.stage').browse(cr, uid, vals['stage_id'], context=context) |
239 | + stage = stage_pool.browse(cr, uid, vals['stage_id'], context=context) |
240 | if stage.on_change: |
241 | vals['probability'] = stage.probability |
242 | + if vals.get('probability') == 100: |
243 | + vals['stage_id'] = stage_pool.search(cr, uid, [('probability','=',100.0)],order='sequence')[0] |
244 | return super(crm_lead, self).write(cr, uid, ids, vals, context=context) |
245 | |
246 | def new_mail_send(self, cr, uid, ids, context=None): |
247 | |
248 | === modified file 'crm/crm_lead_data.xml' |
249 | --- crm/crm_lead_data.xml 2013-04-05 11:10:48 +0000 |
250 | +++ crm/crm_lead_data.xml 2013-06-05 13:32:29 +0000 |
251 | @@ -6,75 +6,67 @@ |
252 | <record model="crm.case.stage" id="stage_lead1"> |
253 | <field name="name">New</field> |
254 | <field eval="1" name="case_default"/> |
255 | - <field name="state">draft</field> |
256 | + <field eval="'1'" name="sequence"/> |
257 | <field eval="0" name="probability"/> |
258 | - <field eval="10" name="sequence"/> |
259 | <field name="type">both</field> |
260 | </record> |
261 | <record model="crm.case.stage" id="stage_lead2"> |
262 | <field name="name">Opportunity</field> |
263 | <field eval="1" name="case_default"/> |
264 | - <field name="state">open</field> |
265 | <field eval="20" name="probability"/> |
266 | - <field eval="20" name="sequence"/> |
267 | - <field name="type">lead</field> |
268 | - </record> |
269 | - <record model="crm.case.stage" id="stage_lead7"> |
270 | - <field name="name">Dead</field> |
271 | - <field eval="1" name="case_default"/> |
272 | - <field eval="False" name="fold"/> |
273 | - <field name="state">cancel</field> |
274 | - <field eval="0" name="probability"/> |
275 | - <field eval="30" name="sequence"/> |
276 | + <field eval="2" name="sequence"/> |
277 | <field name="type">lead</field> |
278 | </record> |
279 | <record model="crm.case.stage" id="stage_lead3"> |
280 | <field name="name">Qualification</field> |
281 | <field eval="1" name="case_default"/> |
282 | - <field name="state">open</field> |
283 | <field eval="20" name="probability"/> |
284 | - <field eval="100" name="sequence"/> |
285 | + <field eval="3" name="sequence"/> |
286 | <field name="type">opportunity</field> |
287 | </record> |
288 | <record model="crm.case.stage" id="stage_lead4"> |
289 | <field name="name">Proposition</field> |
290 | <field eval="1" name="case_default"/> |
291 | - <field name="state">open</field> |
292 | <field eval="40" name="probability"/> |
293 | - <field eval="110" name="sequence"/> |
294 | + <field eval="4" name="sequence"/> |
295 | <field name="type">opportunity</field> |
296 | </record> |
297 | <record model="crm.case.stage" id="stage_lead5"> |
298 | <field name="name">Negotiation</field> |
299 | <field eval="1" name="case_default"/> |
300 | - <field name="state">open</field> |
301 | <field eval="60" name="probability"/> |
302 | - <field eval="120" name="sequence"/> |
303 | + <field eval="5" name="sequence"/> |
304 | <field name="type">opportunity</field> |
305 | </record> |
306 | <record model="crm.case.stage" id="stage_lead6"> |
307 | <field name="name">Won</field> |
308 | <field eval="True" name="fold"/> |
309 | <field eval="1" name="case_default"/> |
310 | - <field name="state">done</field> |
311 | <field eval="100" name="probability"/> |
312 | - <field eval="130" name="sequence"/> |
313 | + <field eval="6" name="sequence"/> |
314 | <field eval="1" name="on_change"/> |
315 | <field name="type">opportunity</field> |
316 | </record> |
317 | + <record model="crm.case.stage" id="stage_lead7"> |
318 | + <field name="name">Dead</field> |
319 | + <field eval="1" name="case_default"/> |
320 | + <field eval="False" name="fold"/> |
321 | + <field eval="'0'" name="probability"/> |
322 | + <field eval="'7'" name="sequence"/> |
323 | + <field name="type">lead</field> |
324 | + </record> |
325 | <record model="crm.case.stage" id="stage_lead8"> |
326 | <field name="name">Lost</field> |
327 | <field eval="1" name="case_default"/> |
328 | <field eval="True" name="fold"/> |
329 | <field eval="1" name="on_change"/> |
330 | - <field name="state">cancel</field> |
331 | <field eval="0" name="probability"/> |
332 | - <field eval="140" name="sequence"/> |
333 | + <field eval="8" name="sequence"/> |
334 | <field name="type">opportunity</field> |
335 | </record> |
336 | |
337 | <record model="crm.case.section" id="section_sales_department"> |
338 | - <field name="stage_ids" eval="[ (4, ref('stage_lead1')), (4, ref('stage_lead2')), |
339 | + <field name="stage_ids" eval="[ (4, ref('stage_lead1')), |
340 | (4, ref('stage_lead3')), (4, ref('stage_lead4')), |
341 | (4, ref('stage_lead5')), (4, ref('stage_lead6')), |
342 | (4, ref('stage_lead7')), (4, ref('stage_lead8'))]"/> |
343 | |
344 | === modified file 'crm/crm_lead_demo.xml' |
345 | --- crm/crm_lead_demo.xml 2013-04-19 10:36:00 +0000 |
346 | +++ crm/crm_lead_demo.xml 2013-06-05 13:32:29 +0000 |
347 | @@ -50,25 +50,6 @@ |
348 | <field eval="1" name="active"/> |
349 | </record> |
350 | |
351 | - <record id="crm_case_3" model="crm.lead"> |
352 | - <field name="type">lead</field> |
353 | - <field name="name">Need Info about Web Design</field> |
354 | - <field name="contact_name">John Miller</field> |
355 | - <field name="partner_name">The Kompany</field> |
356 | - <field name="email_from">contact@thkompany.com</field> |
357 | - <field name="partner_id" ref=""/> |
358 | - <field name="country_id" ref="base.us"/> |
359 | - <field name="city">New-York</field> |
360 | - <field name="type_id" ref="type_lead5"/> |
361 | - <field name="categ_ids" eval="[(6, 0, [categ_oppor4])]"/> |
362 | - <field name="channel_id" ref=""/> |
363 | - <field name="priority">2</field> |
364 | - <field name="section_id" ref="crm_case_section_1"/> |
365 | - <field name="user_id" ref="base.user_demo"/> |
366 | - <field name="stage_id" ref="stage_lead2"/> |
367 | - <field eval="1" name="active"/> |
368 | - </record> |
369 | - |
370 | <record id="crm_case_4" model="crm.lead"> |
371 | <field name="type">lead</field> |
372 | <field name="name">Need a New Website</field> |
373 | @@ -244,32 +225,6 @@ |
374 | <field eval="1" name="active"/> |
375 | </record> |
376 | |
377 | - <record id="crm_case_12" model="crm.lead"> |
378 | - <field name="type">lead</field> |
379 | - <field name="name">Need Quotation for 100 PC and 100 Keyboards</field> |
380 | - <field name="contact_name">Bojing Hú</field> |
381 | - <field name="partner_name">Incom Corporation</field> |
382 | - <field name="email_from">bhu.a100@gmail.com</field> |
383 | - <field name="partner_id" ref="base.res_partner_1"/> |
384 | - <field name="country_id" ref="base.cn"/> |
385 | - <field name="city">Shenzhen</field> |
386 | - <field name="type_id" ref="type_lead3"/> |
387 | - <field name="categ_ids" eval="[(6, 0, [categ_oppor1])]"/> |
388 | - <field name="channel_id" ref="crm_case_channel_website"/> |
389 | - <field name="priority">2</field> |
390 | - <field name="section_id" ref="section_sales_department"/> |
391 | - <field name="user_id" ref="base.user_demo"/> |
392 | - <field name="stage_id" ref="stage_lead2"/> |
393 | - <field eval="1" name="active"/> |
394 | - </record> |
395 | - |
396 | - <!-- Call Function to Cancel the leads (set as Dead) --> |
397 | - <function model="crm.lead" name="case_cancel" |
398 | - eval="[ ref('crm_case_12'), ref('crm_case_7'), |
399 | - ref('crm_case_3'), ref('crm_case_8')], |
400 | - {'install_mode': True}" |
401 | - /> |
402 | - |
403 | <!-- Call Function to set the leads as Unread --> |
404 | <function model="crm.lead" name="message_mark_as_unread" |
405 | eval="[ ref('crm_case_1'), ref('crm_case_2'), |
406 | |
407 | === modified file 'crm/crm_lead_view.xml' |
408 | --- crm/crm_lead_view.xml 2013-06-04 10:56:48 +0000 |
409 | +++ crm/crm_lead_view.xml 2013-06-05 13:32:29 +0000 |
410 | @@ -13,7 +13,6 @@ |
411 | <field name="arch" type="xml"> |
412 | <search string="Stage Search"> |
413 | <field name="name" string="Stage Name"/> |
414 | - <field name="state"/> |
415 | <field name="type"/> |
416 | </search> |
417 | </field> |
418 | @@ -93,15 +92,9 @@ |
419 | <field name="arch" type="xml"> |
420 | <form string="Leads Form" version="7.0"> |
421 | <header> |
422 | - <button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action" |
423 | - states="draft,open,pending" help="Convert to Opportunity" class="oe_highlight"/> |
424 | - <button name="case_reset" string="Reset" type="object" |
425 | - states="cancel"/> |
426 | - <button name="case_cancel" string="Cancel Case" type="object" |
427 | - states="draft,open,pending"/> |
428 | + <button name="%(crm.action_crm_lead2opportunity_partner)d" string="Convert to Opportunity" type="action" attrs="{'invisible':[('stage_sequence','in',[6,7,8])]}" help="Convert to Opportunity" class="oe_highlight"/> |
429 | <field name="stage_id" widget="statusbar" clickable="True" |
430 | - domain="['&', '|', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]" |
431 | - on_change="onchange_stage_id(stage_id)"/> |
432 | + domain="['&', '|', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"/> |
433 | </header> |
434 | <sheet> |
435 | <div class="oe_right oe_button_box" name="buttons"> |
436 | @@ -157,9 +150,7 @@ |
437 | <label for="section_id" groups="base.group_multi_salesteams"/> |
438 | <div groups="base.group_multi_salesteams"> |
439 | <field name="section_id"/> |
440 | - <button name="case_escalate" string="Escalate" |
441 | - type="object" class="oe_link" |
442 | - attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/> |
443 | + <button name="case_escalate" string="Escalate" type="object" attrs="{'invisible': ['|', ('section_id','=',False), ('stage_sequence', 'in', [6,7,8])]}" class="oe_link"/> |
444 | </div> |
445 | <field name="type" invisible="1"/> |
446 | </group> |
447 | @@ -182,7 +173,7 @@ |
448 | <field name="company_id" |
449 | groups="base.group_multi_company" |
450 | widget="selection" colspan="2"/> |
451 | - <field name="state" groups="base.group_no_one"/> |
452 | + <field name="stage_sequence" invisible="1"/> |
453 | </group> |
454 | <group string="Mailings"> |
455 | <field name="opt_out"/> |
456 | @@ -220,7 +211,7 @@ |
457 | <field name="name">Leads</field> |
458 | <field name="model">crm.lead</field> |
459 | <field name="arch" type="xml"> |
460 | - <tree string="Leads" fonts="bold:message_unread==True" colors="grey:state in ('cancel', 'done')"> |
461 | + <tree string="Leads" fonts="bold:message_unread==True"> |
462 | <field name="date_deadline" invisible="1"/> |
463 | <field name="create_date"/> |
464 | <field name="name"/> |
465 | @@ -232,7 +223,6 @@ |
466 | <field name="user_id" invisible="1"/> |
467 | <field name="partner_id" invisible="1"/> |
468 | <field name="section_id" invisible="context.get('invisible_section', True)" groups="base.group_multi_salesteams"/> |
469 | - <field name="state" invisible="1"/> |
470 | <field name="type_id" invisible="1"/> |
471 | <field name="referred" invisible="1"/> |
472 | <field name="channel_id" invisible="1"/> |
473 | @@ -262,7 +252,7 @@ |
474 | <field name="model">crm.lead</field> |
475 | <field name="arch" type="xml"> |
476 | <kanban default_group_by="stage_id"> |
477 | - <field name="state" groups="base.group_no_one"/> |
478 | + <field name="stage_sequence" invisible="1"/> |
479 | <field name="stage_id"/> |
480 | <field name="color"/> |
481 | <field name="priority"/> |
482 | @@ -335,8 +325,6 @@ |
483 | <field name="create_date"/> |
484 | <field name="country_id" context="{'invisible_country': False}"/> |
485 | <separator/> |
486 | - <filter string="Open" name="open" domain="[('state','!=','cancel')]" help="Open Leads"/> |
487 | - <filter string="Dead" name="dead" domain="[('state','=','cancel')]"/> |
488 | <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/> |
489 | <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/> |
490 | <filter string="Assigned to Me" |
491 | @@ -383,10 +371,10 @@ |
492 | <form string="Opportunities" version="7.0"> |
493 | <header> |
494 | <button name="case_mark_won" string="Mark Won" type="object" |
495 | - states="draft,open,pending" class="oe_highlight"/> |
496 | + attrs="{'invisible':[('stage_sequence','in',[6,7,8])]}" class="oe_highlight"/> |
497 | <button name="case_mark_lost" string="Mark Lost" type="object" |
498 | - states="draft,open" class="oe_highlight"/> |
499 | - <field name="stage_id" widget="statusbar" clickable="True"/> |
500 | + attrs="{'invisible':[('stage_sequence','in',[6,7,8])]}" class="oe_highlight"/> |
501 | + <field name="stage_id" widget="statusbar" clickable="True" domain="['&', ('case_default', '=', True), ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"/> |
502 | </header> |
503 | <sheet> |
504 | <div class="oe_right oe_button_box"> |
505 | @@ -434,7 +422,7 @@ |
506 | <label for="section_id" groups="base.group_multi_salesteams"/> |
507 | <div groups="base.group_multi_salesteams"> |
508 | <field name="section_id" widget="selection"/> |
509 | - <button name="case_escalate" string="Escalate" type="object" class="oe_link" attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/> |
510 | + <button name="case_escalate" string="Escalate" type="object" class="oe_link" attrs="{'invisible': ['|', ('section_id','=',False), ('stage_sequence', 'in', [6,7,8])]}"/> |
511 | </div> |
512 | </group> |
513 | <group> |
514 | @@ -485,8 +473,8 @@ |
515 | <field name="day_open" groups="base.group_no_one"/> |
516 | <field name="day_close" groups="base.group_no_one"/> |
517 | <field name="referred"/> |
518 | - <field name="state" invisible="1"/> |
519 | <field name="type" invisible="1"/> |
520 | + <field name="stage_sequence" invisible="1" /> |
521 | </group> |
522 | <group string="References"> |
523 | <field name="ref"/> |
524 | @@ -515,7 +503,7 @@ |
525 | <field name="name">Opportunities Tree</field> |
526 | <field name="model">crm.lead</field> |
527 | <field name="arch" type="xml"> |
528 | - <tree string="Opportunities" fonts="bold:message_unread==True" colors="gray:state in ('cancel', 'done');red:date_deadline and (date_deadline < current_date)"> |
529 | + <tree string="Opportunities" fonts="bold:message_unread==True" colors="red:date_deadline and (date_deadline < current_date)"> |
530 | <field name="date_deadline" invisible="1"/> |
531 | <field name="create_date"/> |
532 | <field name="name" string="Opportunity"/> |
533 | @@ -533,7 +521,6 @@ |
534 | <field name="referred" invisible="1"/> |
535 | <field name="priority" invisible="1"/> |
536 | <field name="message_unread" invisible="1"/> |
537 | - <field name="state" invisible="1"/> |
538 | </tree> |
539 | </field> |
540 | </record> |
541 | @@ -549,12 +536,10 @@ |
542 | <field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike', self)]"/> |
543 | <field name="section_id" context="{'invisible_section': False}" groups="base.group_multi_salesteams"/> |
544 | <field name="user_id"/> |
545 | + |
546 | <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/> |
547 | + <field name="stage_id"/> |
548 | <separator/> |
549 | - <filter string="New" name="new" domain="[('state','=','draft')]" help="New Opportunities"/> |
550 | - <filter string="In Progress" name="open" domain="[('state','=','open')]" help="Open Opportunities"/> |
551 | - <filter string="Won" name="won" domain="[('state','=','done')]"/> |
552 | - <filter string="Lost" name="lost" domain="[('state','=','cancel')]"/> |
553 | <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/> |
554 | <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/> |
555 | <filter string="My Opportunities" name="assigned_to_me" |
556 | |
557 | === modified file 'crm/crm_view.xml' |
558 | --- crm/crm_view.xml 2013-05-22 09:40:33 +0000 |
559 | +++ crm/crm_view.xml 2013-06-05 13:32:29 +0000 |
560 | @@ -80,7 +80,6 @@ |
561 | <field name="sequence" widget="handle"/> |
562 | <field name="name"/> |
563 | <field name="probability"/> |
564 | - <field name="state"/> |
565 | <field name="type"/> |
566 | </tree> |
567 | </field> |
568 | @@ -96,7 +95,6 @@ |
569 | <form string="Stage" version="7.0"> |
570 | <group col="4"> |
571 | <field name="name"/> |
572 | - <field name="state"/> |
573 | <field name="probability"/> |
574 | <field name="type"/> |
575 | <field name="on_change"/> |
576 | |
577 | === modified file 'crm/report/crm_lead_report.py' |
578 | --- crm/report/crm_lead_report.py 2013-04-15 10:23:49 +0000 |
579 | +++ crm/report/crm_lead_report.py 2013-06-05 13:32:29 +0000 |
580 | @@ -23,14 +23,6 @@ |
581 | from openerp import tools |
582 | from .. import crm |
583 | |
584 | -AVAILABLE_STATES = [ |
585 | - ('draft','Draft'), |
586 | - ('open','Open'), |
587 | - ('cancel', 'Cancelled'), |
588 | - ('done', 'Closed'), |
589 | - ('pending','Pending') |
590 | -] |
591 | - |
592 | MONTHS = [ |
593 | ('01', 'January'), |
594 | ('02', 'February'), |
595 | @@ -79,12 +71,12 @@ |
596 | 'section_id':fields.many2one('crm.case.section', 'Sales Team', readonly=True), |
597 | 'channel_id':fields.many2one('crm.case.channel', 'Channel', readonly=True), |
598 | 'type_id':fields.many2one('crm.case.resource.type', 'Campaign', readonly=True), |
599 | - 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), |
600 | 'company_id': fields.many2one('res.company', 'Company', readonly=True), |
601 | 'probability': fields.float('Probability',digits=(16,2),readonly=True, group_operator="avg"), |
602 | 'planned_revenue': fields.float('Planned Revenue',digits=(16,2),readonly=True), |
603 | 'probable_revenue': fields.float('Probable Revenue', digits=(16,2),readonly=True), |
604 | 'stage_id': fields.many2one ('crm.case.stage', 'Stage', readonly=True, domain="[('section_ids', '=', section_id)]"), |
605 | + 'stage_sequence': fields.related('stage_id','sequence',type='integer', string='Stage Sequence'), |
606 | 'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True), |
607 | 'nbr': fields.integer('# of Cases', readonly=True), |
608 | 'company_id': fields.many2one('res.company', 'Company', readonly=True), |
609 | @@ -120,8 +112,6 @@ |
610 | |
611 | to_char(c.date_open, 'YYYY-MM-DD') as opening_date, |
612 | to_char(c.date_closed, 'YYYY-mm-dd') as date_closed, |
613 | - |
614 | - c.state, |
615 | c.user_id, |
616 | c.probability, |
617 | c.stage_id, |
618 | |
619 | === modified file 'crm/report/crm_lead_report_view.xml' |
620 | --- crm/report/crm_lead_report_view.xml 2013-05-21 14:27:53 +0000 |
621 | +++ crm/report/crm_lead_report_view.xml 2013-06-05 13:32:29 +0000 |
622 | @@ -13,8 +13,8 @@ |
623 | <field name="creation_month" invisible="1"/> |
624 | <field name="creation_day" invisible="1"/> |
625 | <field name="deadline_month" invisible="1"/> |
626 | - <field name="state" invisible="1"/> |
627 | <field name="stage_id" invisible="1"/> |
628 | + <field name="stage_sequence" invisible="1"/> |
629 | <field name="type_id" invisible="1"/> |
630 | <field name="channel_id" invisible="1"/> |
631 | <field name="type" invisible="1"/> |
632 | @@ -69,10 +69,6 @@ |
633 | <filter icon="terp-personal" name="lead" string="Lead" domain="[('type','=', 'lead')]" help="Show only lead"/> |
634 | <filter icon="terp-personal+" string="Opportunity" name="opportunity" domain="[('type','=','opportunity')]" help="Show only opportunity"/> |
635 | <separator/> |
636 | - <filter icon="terp-check" string="New" domain="[('state','=','draft')]" help="Leads/Opportunities which are in New state"/> |
637 | - <filter icon="terp-camera_test" string="Open" domain="[('state','=','open')]" help="Leads/Opportunities which are in open state"/> |
638 | - <filter icon="gtk-media-pause" string="Pending" domain="[('state','=','pending')]" help="Leads/Opportunities which are in pending state"/> |
639 | - <filter icon="terp-dialog-close" string="Closed" domain="[('state','=','done')]" help="Leads/Opportunities which are in done state"/> |
640 | <separator/> |
641 | <filter string="My Sales Team(s)" icon="terp-personal+" context="{'invisible_section': False}" domain="[('section_id.user_id','=',uid)]" |
642 | help="Leads/Opportunities that are assigned to one of the sale teams I manage" groups="base.group_multi_salesteams"/> |
643 | @@ -131,7 +127,7 @@ |
644 | <field name="name">crm.lead.report.tree</field> |
645 | <field name="model">crm.lead.report</field> |
646 | <field name="arch" type="xml"> |
647 | - <tree colors="blue:state == 'draft';black:state in ('open','pending','done');gray:state == 'cancel' " create="false" string="Opportunities Analysis"> |
648 | + <tree create="false" string="Opportunities Analysis"> |
649 | <field name="creation_year" invisible="1"/> |
650 | <field name="creation_month" invisible="1"/> |
651 | <field name="creation_day" invisible="1"/> |
652 | @@ -141,8 +137,8 @@ |
653 | <field name="user_id" invisible="1"/> |
654 | <field name="partner_id" invisible="1"/> |
655 | <field name="country_id" invisible="1"/> |
656 | - <field name="state" invisible="1"/> |
657 | <field name="stage_id" invisible="1"/> |
658 | + <field name="stage_sequence" invisible="1"/> |
659 | <field name="priority" invisible="1"/> |
660 | <field name="type_id" invisible="1"/> |
661 | <field name="channel_id" invisible="1"/> |
662 | |
663 | === modified file 'crm/res_partner.py' |
664 | --- crm/res_partner.py 2013-04-15 10:23:49 +0000 |
665 | +++ crm/res_partner.py 2013-06-05 13:32:29 +0000 |
666 | @@ -41,7 +41,7 @@ |
667 | _columns = { |
668 | 'section_id': fields.many2one('crm.case.section', 'Sales Team'), |
669 | 'opportunity_ids': fields.one2many('crm.lead', 'partner_id',\ |
670 | - 'Leads and Opportunities', domain=[('state','in', ('draft','open','pending'))]), |
671 | + 'Leads and Opportunities', domain=[('stage_sequence','not in', (6,7,8))]), |
672 | 'meeting_ids': fields.many2many('crm.meeting', 'crm_meeting_partner_rel','partner_id', 'meeting_id', |
673 | 'Meetings'), |
674 | 'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id',\ |
675 | @@ -87,7 +87,6 @@ |
676 | 'probability' : probability, |
677 | 'partner_id' : partner_id, |
678 | 'categ_ids' : categ_ids and categ_ids[0:1] or [], |
679 | - 'state' :'draft', |
680 | 'type': 'opportunity' |
681 | }, context=context) |
682 | opportunity_ids[partner_id] = opportunity_id |
683 | |
684 | === modified file 'crm/test/crm_lead_cancel.yml' |
685 | --- crm/test/crm_lead_cancel.yml 2013-04-19 15:25:55 +0000 |
686 | +++ crm/test/crm_lead_cancel.yml 2013-06-05 13:32:29 +0000 |
687 | @@ -4,38 +4,14 @@ |
688 | !python {model: crm.lead}: | |
689 | section_id = self.pool.get('crm.case.section').create(cr, uid, {'name': "Phone Marketing", 'parent_id': ref("crm.crm_case_section_2")}) |
690 | self.write(cr, uid, [ref("crm_case_1")], {'section_id': section_id}) |
691 | - self.case_cancel(cr, uid, [ref("crm_case_1")]) |
692 | - |
693 | I check cancelled lead. |
694 | - |
695 | !python {model: crm.lead}: | |
696 | - lead = self.browse(cr, uid, ref('crm_case_1')) |
697 | + lead = self.browse(cr, uid, ref('crm_case_8')) |
698 | assert lead.stage_id.id == ref('crm.stage_lead7'), "Stage should be 'Dead' and is %s." % (lead.stage_id.name) |
699 | - assert lead.state == 'cancel', "Opportunity is not in 'cancel' state." |
700 | assert lead.probability == 0.0, 'Opportunity is probably wrong and should be 0.0.' |
701 | - |
702 | - I reset cancelled lead into unqualified lead. |
703 | -- |
704 | - !python {model: crm.lead}: | |
705 | - self.case_reset(cr, uid, [ref("crm_case_1")]) |
706 | -- |
707 | - I check unqualified lead after reset. |
708 | -- |
709 | - !assert {model: crm.lead, id: crm.crm_case_1, string: Lead is in draft state}: |
710 | - - state == "draft" |
711 | -- |
712 | - I re-open the lead |
713 | -- |
714 | - !python {model: crm.lead}: | |
715 | - self.case_open(cr, uid, [ref("crm_case_1")]) |
716 | -- |
717 | - I check stage and state of the re-opened lead |
718 | -- |
719 | - !python {model: crm.lead}: | |
720 | - lead = self.browse(cr, uid, ref('crm.crm_case_1')) |
721 | - assert lead.stage_id.id == ref('crm.stage_lead2'), "Opportunity stage should be 'Qualification'." |
722 | - assert lead.state == 'open', "Opportunity should be in 'open' state." |
723 | -- |
724 | I escalate the lead to parent team. |
725 | - |
726 | !python {model: crm.lead}: | |
727 | |
728 | === modified file 'crm/test/crm_lead_onchange.yml' |
729 | --- crm/test/crm_lead_onchange.yml 2013-03-21 11:26:47 +0000 |
730 | +++ crm/test/crm_lead_onchange.yml 2013-06-05 13:32:29 +0000 |
731 | @@ -6,14 +6,14 @@ |
732 | partner_id: base.res_partner_2 |
733 | type: opportunity |
734 | stage_id: crm.stage_lead1 |
735 | - state: draft |
736 | + stage_sequence : 1 |
737 | - |
738 | I create a lead record to call a mailing opt-out onchange method. |
739 | - |
740 | !record {model: crm.lead, id: crm_case_18}: |
741 | name: 'Need 20 Days of Consultancy' |
742 | type: opportunity |
743 | - state: draft |
744 | + stage_sequence : 1 |
745 | opt_out: True |
746 | - |
747 | I create a phonecall record to call a partner onchange method. |
748 | |
749 | === modified file 'crm/test/lead2opportunity2win.yml' |
750 | --- crm/test/lead2opportunity2win.yml 2013-03-21 11:26:47 +0000 |
751 | +++ crm/test/lead2opportunity2win.yml 2013-06-05 13:32:29 +0000 |
752 | @@ -1,15 +1,10 @@ |
753 | - |
754 | In order to test the conversion of a lead into a opportunity, |
755 | - |
756 | - I open a lead. |
757 | + I set lead to open stage. |
758 | - |
759 | !python {model: crm.lead}: | |
760 | - self.case_open(cr, uid, [ref("crm_case_4")]) |
761 | -- |
762 | - I check if the lead state is "Open". |
763 | -- |
764 | - !assert {model: crm.lead, id: crm.crm_case_4, string: Lead state is Open}: |
765 | - - state == "open" |
766 | + self.write(cr, uid, [ref("crm_case_4")], {'stage_sequence' : 2}) |
767 | - |
768 | I convert lead into opportunity for exiting customer. |
769 | - |
770 | @@ -59,7 +54,6 @@ |
771 | !python {model: crm.lead}: | |
772 | lead = self.browse(cr, uid, ref('crm_case_4')) |
773 | assert lead.stage_id.id == ref('crm.stage_lead6'), "Opportunity stage should be 'Won'." |
774 | - assert lead.state == 'done', "Opportunity is not in 'done' state!" |
775 | assert lead.probability == 100.0, "Revenue probability should be 100.0!" |
776 | - |
777 | I convert mass lead into opportunity customer. |
778 | @@ -95,9 +89,8 @@ |
779 | I check details of the opportunity after the loose |
780 | - |
781 | !python {model: crm.lead}: | |
782 | - lead = self.browse(cr, uid, ref('crm_case_2')) |
783 | + lead = self.browse(cr, uid, ref('crm_case_21')) |
784 | assert lead.stage_id.id == ref('crm.stage_lead8'), "Opportunity stage should be 'Lost'." |
785 | - assert lead.state == 'cancel', "Lost opportunity is not in 'cancel' state!" |
786 | assert lead.probability == 0.0, "Revenue probability should be 0.0!" |
787 | - |
788 | I confirm review needs meeting. |
789 | |
790 | === modified file 'crm/wizard/crm_lead_to_opportunity.py' |
791 | --- crm/wizard/crm_lead_to_opportunity.py 2013-02-08 10:47:13 +0000 |
792 | +++ crm/wizard/crm_lead_to_opportunity.py 2013-06-05 13:32:29 +0000 |
793 | @@ -58,11 +58,11 @@ |
794 | |
795 | if partner_id: |
796 | # Search for opportunities that have the same partner and that arent done or cancelled |
797 | - ids = lead_obj.search(cr, uid, [('partner_id', '=', partner_id), ('state', '!=', 'done')]) |
798 | + ids = lead_obj.search(cr, uid, [('partner_id', '=', partner_id), ('stage_sequence', '!=', 6)]) |
799 | for id in ids: |
800 | tomerge.add(id) |
801 | if email: |
802 | - ids = lead_obj.search(cr, uid, [('email_from', 'ilike', email[0]), ('state', '!=', 'done')]) |
803 | + ids = lead_obj.search(cr, uid, [('email_from', 'ilike', email[0]), ('stage_sequence', '!=', 6)]) |
804 | for id in ids: |
805 | tomerge.add(id) |
806 | |
807 | @@ -85,7 +85,7 @@ |
808 | context = {} |
809 | lead_obj = self.pool.get('crm.lead') |
810 | for lead in lead_obj.browse(cr, uid, context.get('active_ids', []), context=context): |
811 | - if lead.state in ['done', 'cancel']: |
812 | + if lead.stage_sequence in [6,7,8]: |
813 | raise osv.except_osv(_("Warning !"), _("Closed/Cancelled leads cannot be converted into opportunities.")) |
814 | return False |
815 | |
816 | |
817 | === modified file 'crm/wizard/crm_merge_opportunities.py' |
818 | --- crm/wizard/crm_merge_opportunities.py 2012-12-17 14:43:06 +0000 |
819 | +++ crm/wizard/crm_merge_opportunities.py 2013-06-05 13:32:29 +0000 |
820 | @@ -61,7 +61,7 @@ |
821 | """ |
822 | Use active_ids from the context to fetch the leads/opps to merge. |
823 | In order to get merged, these leads/opps can't be in 'Done' or |
824 | - 'Cancel' state. |
825 | + 'Cancel' Stage. |
826 | """ |
827 | if context is None: |
828 | context = {} |
829 | @@ -72,7 +72,7 @@ |
830 | opp_ids = [] |
831 | opps = self.pool.get('crm.lead').browse(cr, uid, record_ids, context=context) |
832 | for opp in opps: |
833 | - if opp.state not in ('done', 'cancel'): |
834 | + if opp.stage_sequence not in (6,7,8): |
835 | opp_ids.append(opp.id) |
836 | if 'opportunity_ids' in fields: |
837 | res.update({'opportunity_ids': opp_ids}) |
838 | |
839 | === modified file 'crm_claim/crm_claim.py' |
840 | --- crm_claim/crm_claim.py 2013-03-21 12:56:26 +0000 |
841 | +++ crm_claim/crm_claim.py 2013-06-05 13:32:29 +0000 |
842 | @@ -28,11 +28,6 @@ |
843 | from openerp.tools.translate import _ |
844 | from openerp.tools import html2plaintext |
845 | |
846 | -CRM_CLAIM_PENDING_STATES = ( |
847 | - crm.AVAILABLE_STATES[2][0], # Cancelled |
848 | - crm.AVAILABLE_STATES[3][0], # Done |
849 | - crm.AVAILABLE_STATES[4][0], # Pending |
850 | -) |
851 | |
852 | class crm_claim_stage(osv.osv): |
853 | """ Model for claim stages. This models the main stages of a claim |
854 | @@ -107,13 +102,7 @@ |
855 | 'stage_id': fields.many2one ('crm.claim.stage', 'Stage', track_visibility='onchange', |
856 | domain="['|', ('section_ids', '=', section_id), ('case_default', '=', True)]"), |
857 | 'cause': fields.text('Root Cause'), |
858 | - 'state': fields.related('stage_id', 'state', type="selection", store=True, |
859 | - selection=crm.AVAILABLE_STATES, string="Status", readonly=True, |
860 | - help='The status is set to \'Draft\', when a case is created.\ |
861 | - If the case is in progress the status is set to \'Open\'.\ |
862 | - When the case is over, the status is set to \'Done\'.\ |
863 | - If the case needs to be reviewed then the status is \ |
864 | - set to \'Pending\'.'), |
865 | + 'stage_sequence': fields.related('stage_id','sequence',type='integer', string='Stage Sequence'), |
866 | } |
867 | |
868 | _defaults = { |
869 | @@ -158,14 +147,6 @@ |
870 | return stage_ids[0] |
871 | return False |
872 | |
873 | - def case_refuse(self, cr, uid, ids, context=None): |
874 | - """ Mark the case as refused: state=done and case_refused=True """ |
875 | - for lead in self.browse(cr, uid, ids): |
876 | - stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, ['&', ('state', '=', 'done'), ('case_refused', '=', True)], context=context) |
877 | - if stage_id: |
878 | - self.case_set(cr, uid, [lead.id], values_to_update={}, new_stage_id=stage_id, context=context) |
879 | - return True |
880 | - |
881 | def onchange_partner_id(self, cr, uid, ids, part, email=False): |
882 | """This function returns value of partner address based on partner |
883 | :param part: Partner's id |
884 | |
885 | === modified file 'crm_claim/crm_claim_data.xml' |
886 | --- crm_claim/crm_claim_data.xml 2012-11-29 22:26:45 +0000 |
887 | +++ crm_claim/crm_claim_data.xml 2013-06-05 13:32:29 +0000 |
888 | @@ -44,26 +44,22 @@ |
889 | |
890 | <record model="crm.claim.stage" id="stage_claim1"> |
891 | <field name="name">New</field> |
892 | - <field name="state">draft</field> |
893 | - <field name="sequence">26</field> |
894 | + <field name="sequence">1</field> |
895 | <field name="case_default" eval="True"/> |
896 | </record> |
897 | <record model="crm.claim.stage" id="stage_claim5"> |
898 | <field name="name">In Progress</field> |
899 | - <field name="state">open</field> |
900 | - <field name="sequence">27</field> |
901 | + <field name="sequence">2</field> |
902 | <field name="case_default" eval="True"/> |
903 | </record> |
904 | <record model="crm.claim.stage" id="stage_claim2"> |
905 | <field name="name">Settled</field> |
906 | - <field name="state">done</field> |
907 | - <field name="sequence">28</field> |
908 | + <field name="sequence">3</field> |
909 | <field name="case_default" eval="True"/> |
910 | </record> |
911 | <record model="crm.claim.stage" id="stage_claim3"> |
912 | <field name="name">Rejected</field> |
913 | - <field name="state">cancel</field> |
914 | - <field name="sequence">29</field> |
915 | + <field name="sequence">4</field> |
916 | <field name="case_default" eval="True"/> |
917 | <field name="case_refused" eval="True"/> |
918 | <field name="fold" eval="True"/> |
919 | |
920 | === modified file 'crm_claim/crm_claim_view.xml' |
921 | --- crm_claim/crm_claim_view.xml 2013-04-22 15:34:49 +0000 |
922 | +++ crm_claim/crm_claim_view.xml 2013-06-05 13:32:29 +0000 |
923 | @@ -80,7 +80,7 @@ |
924 | <field name="name">CRM - Claims Tree</field> |
925 | <field name="model">crm.claim</field> |
926 | <field name="arch" type="xml"> |
927 | - <tree string="Claims" colors="blue:state=='pending' and not(date_deadline and (date_deadline < current_date));gray:state in ('close', 'cancel');red:date_deadline and (date_deadline < current_date)"> |
928 | + <tree string="Claims"> |
929 | <field name="name"/> |
930 | <field name="partner_id"/> |
931 | <field name="user_id"/> |
932 | @@ -91,7 +91,6 @@ |
933 | <field name="categ_id" string="Type"/> |
934 | <field name="date_deadline" invisible="1"/> |
935 | <field name="date_closed" invisible="1"/> |
936 | - <field name="state" groups="base.group_no_one"/> |
937 | </tree> |
938 | </field> |
939 | </record> |
940 | @@ -102,10 +101,6 @@ |
941 | <field name="arch" type="xml"> |
942 | <form string="Claim" version="7.0"> |
943 | <header> |
944 | - <button name="case_close" string="Settle" type="object" class="oe_highlight" |
945 | - states="draft,open,pending" groups="base.group_user"/> |
946 | - <button name="case_cancel" string="Reject" type="object" groups="base.group_user" |
947 | - states="draft,open,pending"/> |
948 | <field name="stage_id" widget="statusbar" clickable="True"/> |
949 | </header> |
950 | <sheet string="Claims"> |
951 | @@ -118,7 +113,6 @@ |
952 | <field name="priority"/> |
953 | <field name="section_id" groups="base.group_multi_salesteams"/> |
954 | <field name="date_deadline"/> |
955 | - <field name="state" groups="base.group_no_one"/> |
956 | </group> |
957 | <group colspan="4" col="4"> |
958 | <notebook> |
959 | @@ -196,10 +190,6 @@ |
960 | <field name="arch" type="xml"> |
961 | <search string="Search Claims"> |
962 | <field name="name" string="Claims"/> |
963 | - <filter icon="terp-check" string="New" name="current" domain="[('state','=','draft')]" help="New Claims"/> |
964 | - <filter icon="terp-camera_test" string="In Progress" domain="[('state','=','open')]" help="In Progress Claims"/> |
965 | - <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/> |
966 | - <separator/> |
967 | <filter string="Unassigned Claims" icon="terp-personal-" domain="[('user_id','=', False)]" help="Unassigned Claims" /> |
968 | <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/> |
969 | <field name="user_id"/> |
970 | @@ -208,7 +198,6 @@ |
971 | <filter string="Responsible" icon="terp-personal" domain="[]" help="Responsible User" context="{'group_by':'user_id'}"/> |
972 | <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/> |
973 | <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'categ_id'}"/> |
974 | - <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" groups="base.group_no_one"/> |
975 | <filter string="Claim Date" icon="terp-go-month" domain="[]" help="Claim Date" context="{'group_by':'date'}"/> |
976 | <filter string="Deadline" icon="terp-go-month" domain="[]" context="{'group_by':'date_deadline'}"/> |
977 | <filter string="Closure" icon="terp-go-month" domain="[]" help="Date Closed" context="{'group_by':'date_closed'}" groups="base.group_no_one"/> |
978 | |
979 | === modified file 'crm_claim/report/crm_claim_report.py' |
980 | --- crm_claim/report/crm_claim_report.py 2013-04-15 10:23:49 +0000 |
981 | +++ crm_claim/report/crm_claim_report.py 2013-06-05 13:32:29 +0000 |
982 | @@ -22,14 +22,6 @@ |
983 | from openerp.osv import fields,osv |
984 | from openerp import tools |
985 | |
986 | -AVAILABLE_STATES = [ |
987 | - ('draft','Draft'), |
988 | - ('open','Open'), |
989 | - ('cancel', 'Cancelled'), |
990 | - ('done', 'Closed'), |
991 | - ('pending','Pending') |
992 | -] |
993 | - |
994 | AVAILABLE_PRIORITIES = [ |
995 | ('5', 'Lowest'), |
996 | ('4', 'Low'), |
997 | @@ -51,7 +43,6 @@ |
998 | 'user_id':fields.many2one('res.users', 'User', readonly=True), |
999 | 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), |
1000 | 'nbr': fields.integer('# of Cases', readonly=True), |
1001 | - 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), |
1002 | 'month':fields.selection([('01', 'January'), ('02', 'February'), \ |
1003 | ('03', 'March'), ('04', 'April'),\ |
1004 | ('05', 'May'), ('06', 'June'), \ |
1005 | @@ -92,7 +83,6 @@ |
1006 | to_char(c.date, 'YYYY-MM-DD') as day, |
1007 | to_char(c.date_closed, 'YYYY-MM-DD') as date_closed, |
1008 | to_char(c.date_deadline, 'YYYY-MM-DD') as date_deadline, |
1009 | - c.state, |
1010 | c.user_id, |
1011 | c.stage_id, |
1012 | c.section_id, |
1013 | @@ -109,7 +99,7 @@ |
1014 | from |
1015 | crm_claim c |
1016 | group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),to_char(c.date, 'YYYY-MM-DD'),\ |
1017 | - c.state, c.user_id,c.section_id, c.stage_id,\ |
1018 | + c.user_id,c.section_id, c.stage_id,\ |
1019 | c.categ_id,c.partner_id,c.company_id,c.create_date, |
1020 | c.priority,c.type_action,c.date_deadline,c.date_closed,c.id |
1021 | )""") |
1022 | |
1023 | === modified file 'crm_claim/report/crm_claim_report_view.xml' |
1024 | --- crm_claim/report/crm_claim_report_view.xml 2013-05-21 14:27:53 +0000 |
1025 | +++ crm_claim/report/crm_claim_report_view.xml 2013-06-05 13:32:29 +0000 |
1026 | @@ -21,7 +21,6 @@ |
1027 | <field name="email" sum="# Mails"/> |
1028 | <field name="delay_close" avg="Avg Closing Delay"/> |
1029 | <field name="delay_expected"/> |
1030 | - <field name="state" invisible="1"/> |
1031 | <field name="stage_id" invisible="1"/> |
1032 | <field name="categ_id" invisible="1"/> |
1033 | <field name="priority" invisible="1"/> |
1034 | @@ -37,7 +36,7 @@ |
1035 | <field name="model">crm.claim.report</field> |
1036 | <field name="arch" type="xml"> |
1037 | <graph orientation="horizontal" string="Claims" type="bar"> |
1038 | - <field name="state"/> |
1039 | + <field name="stage_id"/> |
1040 | <field name="nbr" operator="+"/> |
1041 | <field group="True" name="user_id"/> |
1042 | </graph> |
1043 | @@ -51,9 +50,6 @@ |
1044 | <field name="model">crm.claim.report</field> |
1045 | <field name="arch" type="xml"> |
1046 | <search string="Search"> |
1047 | - <filter icon="terp-document-new" string="New" domain="[('state','=','draft')]"/> |
1048 | - <filter icon="terp-camera_test" string="Open" domain="[('state','=','open')]"/> |
1049 | - <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/> |
1050 | <separator/> |
1051 | <filter string="My Sales Team(s)" icon="terp-personal+" context="{'invisible_section': False}" domain="[('section_id.user_id','=',uid)]" help="My Sales Team(s)" groups="base.group_multi_salesteams"/> |
1052 | <separator/> |
1053 | @@ -73,8 +69,6 @@ |
1054 | <field name="create_date" /> |
1055 | <field name="date_closed" /> |
1056 | <field name="date_deadline" /> |
1057 | - <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/> |
1058 | - <filter icon="gtk-cancel" string="Cancel" domain="[('state','=','cancel')]"/> |
1059 | </group> |
1060 | <group expand="1" string="Group By..."> |
1061 | <filter string="Salesperson" name="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" /> |
1062 | @@ -84,7 +78,6 @@ |
1063 | <filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" /> |
1064 | <filter string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'categ_id'}" /> |
1065 | <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type_action'}" help="Action Type"/> |
1066 | - <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" /> |
1067 | <filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/> |
1068 | <filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}" help="Date of claim"/> |
1069 | <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}" help="Month of claim"/> |
1070 | |
1071 | === modified file 'crm_claim/test/process/claim.yml' |
1072 | --- crm_claim/test/process/claim.yml 2013-04-16 15:18:44 +0000 |
1073 | +++ crm_claim/test/process/claim.yml 2013-06-05 13:32:29 +0000 |
1074 | @@ -15,31 +15,3 @@ |
1075 | claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')]) |
1076 | assert claim_ids and len(claim_ids), "Claim is not created after getting request" |
1077 | claim = self.browse(cr, uid, claim_ids[0], context=context) |
1078 | - assert claim.name == tools.ustr("demande derèglement de votre produit."), "Subject does not match" |
1079 | -- |
1080 | - I open customer claim. |
1081 | -- |
1082 | - !python {model: crm.claim}: | |
1083 | - claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')]) |
1084 | - self.case_open(cr, uid, claim_ids) |
1085 | -- |
1086 | - I check Claim Details after open. |
1087 | -- |
1088 | - !python {model: crm.claim}: | |
1089 | - claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')]) |
1090 | - claim = self.browse(cr, uid, claim_ids[0]) |
1091 | - assert claim.state == "open", "Claim is not in Open state" |
1092 | - assert claim.stage_id.id == ref("crm.stage_lead2"), "Claim is not in Qualification stage" |
1093 | -- |
1094 | - After complete all service from our side, I close this claim. |
1095 | -- |
1096 | - !python {model: crm.claim}: | |
1097 | - claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')]) |
1098 | - self.case_close(cr, uid, claim_ids) |
1099 | -- |
1100 | - I check Claim details after closed. |
1101 | -- |
1102 | - !python {model: crm.claim}: | |
1103 | - claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')]) |
1104 | - claim = self.browse(cr, uid, claim_ids[0]) |
1105 | - assert claim.state == "done", "Claim is not in close state" |
1106 | |
1107 | === modified file 'crm_partner_assign/report/crm_lead_report.py' |
1108 | --- crm_partner_assign/report/crm_lead_report.py 2013-04-15 10:23:49 +0000 |
1109 | +++ crm_partner_assign/report/crm_lead_report.py 2013-06-05 13:32:29 +0000 |
1110 | @@ -23,13 +23,6 @@ |
1111 | from openerp import tools |
1112 | from openerp.addons.crm import crm |
1113 | |
1114 | -AVAILABLE_STATES = [ |
1115 | - ('draft','Draft'), |
1116 | - ('open','Open'), |
1117 | - ('cancel', 'Cancelled'), |
1118 | - ('done', 'Closed'), |
1119 | - ('pending','Pending') |
1120 | -] |
1121 | |
1122 | class crm_lead_report_assign(osv.osv): |
1123 | """ CRM Lead Report """ |
1124 | @@ -43,7 +36,6 @@ |
1125 | 'user_id':fields.many2one('res.users', 'User', readonly=True), |
1126 | 'country_id':fields.many2one('res.country', 'Country', readonly=True), |
1127 | 'section_id':fields.many2one('crm.case.section', 'Sales Team', readonly=True), |
1128 | - 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), |
1129 | 'month':fields.selection([('01', 'January'), ('02', 'February'), \ |
1130 | ('03', 'March'), ('04', 'April'),\ |
1131 | ('05', 'May'), ('06', 'June'), \ |
1132 | @@ -91,7 +83,6 @@ |
1133 | to_char(c.create_date, 'YYYY-MM-DD') as creation_date, |
1134 | to_char(c.date_open, 'YYYY-MM-DD') as opening_date, |
1135 | to_char(c.date_closed, 'YYYY-mm-dd') as date_closed, |
1136 | - c.state, |
1137 | c.date_assign, |
1138 | c.user_id, |
1139 | c.probability, |
1140 | |
1141 | === modified file 'crm_partner_assign/report/crm_lead_report_view.xml' |
1142 | --- crm_partner_assign/report/crm_lead_report_view.xml 2013-03-25 16:51:25 +0000 |
1143 | +++ crm_partner_assign/report/crm_lead_report_view.xml 2013-06-05 13:32:29 +0000 |
1144 | @@ -54,7 +54,7 @@ |
1145 | <field name="model">crm.lead.report.assign</field> |
1146 | <field name="arch" type="xml"> |
1147 | <graph orientation="horizontal" string="Lead Assign" type="bar"> |
1148 | - <field name="state"/> |
1149 | + <field name="stage_id"/> |
1150 | <field name="nbr" operator="+"/> |
1151 | <field group="True" name="user_id"/> |
1152 | </graph> |
1153 | @@ -76,7 +76,6 @@ |
1154 | <field name="partner_id" invisible="1"/> |
1155 | <field name="country_id" invisible="1"/> |
1156 | <field name="day" invisible="1"/> |
1157 | - <field name="state" invisible="1"/> |
1158 | <field name="stage_id" invisible="1"/> |
1159 | <field name="priority" invisible="1"/> |
1160 | <field name="type" invisible="1"/> |
1161 | |
1162 | === modified file 'crm_partner_assign/res_partner_view.xml' |
1163 | --- crm_partner_assign/res_partner_view.xml 2013-04-03 08:10:09 +0000 |
1164 | +++ crm_partner_assign/res_partner_view.xml 2013-06-05 13:32:29 +0000 |
1165 | @@ -134,37 +134,20 @@ |
1166 | <newline/> |
1167 | |
1168 | <field name="opportunity_assigned_ids" colspan="4" nolabel="1"> |
1169 | - <tree string="Assigned Opportunities" colors="blue:state=='pending';gray:state=='cancel'"> |
1170 | + <tree string="Assigned Opportunities"> |
1171 | <field name="create_date"/> |
1172 | <field name="name"/> |
1173 | <field name="type"/> |
1174 | <field name="stage_id"/> |
1175 | - <button name="stage_previous" string="Previous" |
1176 | - states="open,pending" type="object" icon="gtk-go-back" /> |
1177 | - <button name="stage_next" string="Next" |
1178 | - states="open,pending" type="object" |
1179 | - icon="gtk-go-forward" /> |
1180 | <field name="section_id" |
1181 | invisible="context.get('invisible_section', True)" |
1182 | groups="base.group_multi_salesteams"/> |
1183 | <field name="user_id" /> |
1184 | - <field name="state" /> |
1185 | - <button name="case_cancel" string="Cancel" |
1186 | - states="draft,open,pending" type="object" |
1187 | - icon="gtk-cancel" /> |
1188 | - <button name="case_open" string="Open" |
1189 | - states="draft,pending" type="object" |
1190 | - icon="gtk-go-forward" /> |
1191 | - <button name="case_close" string="Close" |
1192 | - states="open,draft,pending" type="object" |
1193 | - icon="gtk-close" /> |
1194 | + <field name="stage_sequence" invisible="1"/> |
1195 | <button string="Convert to Opportunity" |
1196 | - name="convert_opportunity" |
1197 | - states="draft,open,pending" icon="gtk-index" |
1198 | - type="object" attrs="{'invisible':[('type','=','opportunity')]}" /> |
1199 | - <button name="case_escalate" string="Escalate" |
1200 | - states="open,draft,pending" type="object" |
1201 | - icon="gtk-go-up" /> |
1202 | + name="convert_opportunity" |
1203 | + icon="gtk-index" |
1204 | + type="object" attrs="{'invisible':['|',('type','=','opportunity'),('stage_sequence','in',[6,7,8])]}" /> |
1205 | </tree> |
1206 | </field> |
1207 | </page> |
1208 | |
1209 | === modified file 'crm_todo/crm_todo_view.xml' |
1210 | --- crm_todo/crm_todo_view.xml 2013-04-04 11:56:27 +0000 |
1211 | +++ crm_todo/crm_todo_view.xml 2013-06-05 13:32:29 +0000 |
1212 | @@ -14,14 +14,10 @@ |
1213 | <tree editable="bottom" string="Tasks"> |
1214 | <field name="name"/> |
1215 | <field name="user_id"/> |
1216 | - |
1217 | + <field name="stage_sequence" invisible="1"/> |
1218 | <field string="Timebox" name="timebox_id"/> |
1219 | - <button name="prev_timebox" type="object" icon="gtk-go-back" string="Previous" states="draft,pending,open"/> |
1220 | - <button name="next_timebox" type="object" icon="gtk-go-forward" string="Next" states="draft,pending,open"/> |
1221 | - |
1222 | - <field name="state"/> |
1223 | - <button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel" help="For cancelling the task"/> |
1224 | - <button name="action_close" states="draft,pending,open" string="Done" type="object" icon="terp-dialog-close" help="For changing to done state"/> |
1225 | + <button name="prev_timebox" type="object" icon="gtk-go-back" string="Previous" attrs="{'invisible':[('stage_sequence','in',[6,7,8])]}" /> |
1226 | + <button name="next_timebox" type="object" icon="gtk-go-forward" string="Next" attrs="{'invisible':[('stage_sequence','in',[6,7,8])]}" /> |
1227 | </tree> |
1228 | </field> |
1229 | </page> |
1230 | |
1231 | === modified file 'hr_recruitment/board_hr_recruitment_statistical_view.xml' |
1232 | --- hr_recruitment/board_hr_recruitment_statistical_view.xml 2012-11-29 22:26:45 +0000 |
1233 | +++ hr_recruitment/board_hr_recruitment_statistical_view.xml 2013-06-05 13:32:29 +0000 |
1234 | @@ -22,7 +22,7 @@ |
1235 | <field name="res_model">hr.applicant</field> |
1236 | <field name="view_type">form</field> |
1237 | <field name="view_mode">tree,form</field> |
1238 | - <field name="domain">[('state','in',('draft','open'))]</field> |
1239 | + <field name="domain">[('stage_sequence','in',(1,2,3))]</field> |
1240 | <field name="view_id" ref="view_applicants_status_tree"/> |
1241 | </record> |
1242 | |
1243 | |
1244 | === modified file 'hr_recruitment/hr_recruitment.py' |
1245 | --- hr_recruitment/hr_recruitment.py 2013-05-30 10:08:52 +0000 |
1246 | +++ hr_recruitment/hr_recruitment.py 2013-06-05 13:32:29 +0000 |
1247 | @@ -28,13 +28,6 @@ |
1248 | from openerp.tools.translate import _ |
1249 | from openerp.tools import html2plaintext |
1250 | |
1251 | -AVAILABLE_STATES = [ |
1252 | - ('draft', 'New'), |
1253 | - ('cancel', 'Refused'), |
1254 | - ('open', 'In Progress'), |
1255 | - ('pending', 'Pending'), |
1256 | - ('done', 'Hired') |
1257 | -] |
1258 | |
1259 | AVAILABLE_PRIORITIES = [ |
1260 | ('', ''), |
1261 | @@ -61,14 +54,12 @@ |
1262 | _columns = { |
1263 | 'name': fields.char('Name', size=64, required=True, translate=True), |
1264 | 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of stages."), |
1265 | - 'department_id':fields.many2one('hr.department', 'Specific to a Department', help="Stages of the recruitment process may be different per department. If this stage is common to all departments, keep this field empty."), |
1266 | - 'state': fields.selection(AVAILABLE_STATES, 'Status', required=True, help="The related status for the stage. The status of your document will automatically change according to the selected stage. Example, a stage is related to the status 'Close', when your document reach this stage, it will be automatically closed."), |
1267 | + 'job_id':fields.many2one('hr.job', 'Specific to a Job Position', help="Stages of the recruitment process may be different per Job Position. If this stage is common to all Job Position, keep this field empty."), |
1268 | 'fold': fields.boolean('Hide in views if empty', help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), |
1269 | 'requirements': fields.text('Requirements'), |
1270 | } |
1271 | _defaults = { |
1272 | 'sequence': 1, |
1273 | - 'state': 'draft', |
1274 | 'fold': False, |
1275 | } |
1276 | |
1277 | @@ -93,15 +84,12 @@ |
1278 | _order = "id desc" |
1279 | _inherit = ['mail.thread', 'ir.needaction_mixin'] |
1280 | _track = { |
1281 | - 'state': { |
1282 | - 'hr_recruitment.mt_applicant_hired': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', |
1283 | - 'hr_recruitment.mt_applicant_refused': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'cancel', |
1284 | - }, |
1285 | 'stage_id': { |
1286 | - 'hr_recruitment.mt_stage_changed': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['done', 'cancel'], |
1287 | + 'hr_recruitment.mt_stage_changed': lambda self, cr, uid, obj, ctx=None: obj['stage_id'] != False, |
1288 | }, |
1289 | } |
1290 | |
1291 | + |
1292 | def _get_default_department_id(self, cr, uid, context=None): |
1293 | """ Gives default department by checking if present in the context """ |
1294 | return (self._resolve_department_id_from_context(cr, uid, context=context) or False) |
1295 | @@ -109,7 +97,7 @@ |
1296 | def _get_default_stage_id(self, cr, uid, context=None): |
1297 | """ Gives default stage_id """ |
1298 | department_id = self._get_default_department_id(cr, uid, context=context) |
1299 | - return self.stage_find(cr, uid, [], department_id, [('state', '=', 'draft')], context=context) |
1300 | + return self.stage_find(cr, uid, [], department_id, [], context=context) #Get stage_id with lower priority as default |
1301 | |
1302 | def _resolve_department_id_from_context(self, cr, uid, context=None): |
1303 | """ Returns ID of department based on the value of 'default_department_id' |
1304 | @@ -138,11 +126,11 @@ |
1305 | # - ('id', 'in', 'ids'): add columns that should be present |
1306 | # - OR ('department_id', '=', False), ('fold', '=', False): add default columns that are not folded |
1307 | # - OR ('department_id', 'in', department_id), ('fold', '=', False) if department_id: add department columns that are not folded |
1308 | - department_id = self._resolve_department_id_from_context(cr, uid, context=context) |
1309 | + job_id = self._resolve_department_id_from_context(cr, uid, context=context) |
1310 | search_domain = [] |
1311 | - if department_id: |
1312 | - search_domain += ['|', ('department_id', '=', department_id)] |
1313 | - search_domain += ['|', ('id', 'in', ids), ('department_id', '=', False)] |
1314 | + if job_id: |
1315 | + search_domain += ['|', ('job_id', '=', job_id)] |
1316 | + search_domain += ['|', ('id', 'in', ids), ('job_id', '=', False)] |
1317 | stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context) |
1318 | result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) |
1319 | # restore order of the search |
1320 | @@ -195,15 +183,8 @@ |
1321 | 'partner_id': fields.many2one('res.partner', 'Contact'), |
1322 | 'create_date': fields.datetime('Creation Date', readonly=True, select=True), |
1323 | 'write_date': fields.datetime('Update Date', readonly=True), |
1324 | - 'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage', track_visibility='onchange', |
1325 | - domain="['|', ('department_id', '=', department_id), ('department_id', '=', False)]"), |
1326 | - 'state': fields.related('stage_id', 'state', type="selection", store=True, |
1327 | - selection=AVAILABLE_STATES, string="Status", readonly=True, |
1328 | - help='The status is set to \'Draft\', when a case is created.\ |
1329 | - If the case is in progress the status is set to \'Open\'.\ |
1330 | - When the case is over, the status is set to \'Done\'.\ |
1331 | - If the case needs to be reviewed then the status is \ |
1332 | - set to \'Pending\'.'), |
1333 | + 'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage', track_visibility='onchange',), |
1334 | + 'stage_sequence': fields.related('stage_id','sequence',type='integer', string='Stage Sequence'), |
1335 | 'categ_ids': fields.many2many('hr.applicant_category', string='Tags'), |
1336 | 'company_id': fields.many2one('res.company', 'Company'), |
1337 | 'user_id': fields.many2one('res.users', 'Responsible', track_visibility='onchange'), |
1338 | @@ -252,20 +233,17 @@ |
1339 | 'stage_id': _read_group_stage_ids |
1340 | } |
1341 | |
1342 | - def onchange_job(self, cr, uid, ids, job, context=None): |
1343 | + def onchange_job(self, cr, uid, ids, job_id=False, context=None): |
1344 | result = {} |
1345 | - |
1346 | - if job: |
1347 | + if job_id: |
1348 | job_obj = self.pool.get('hr.job') |
1349 | - result['department_id'] = job_obj.browse(cr, uid, job, context=context).department_id.id |
1350 | - return {'value': result} |
1351 | - return {'value': {'department_id': False}} |
1352 | - |
1353 | - def onchange_department_id(self, cr, uid, ids, department_id=False, context=None): |
1354 | + result['department_id'] = job_obj.browse(cr, uid, job_id, context=context).department_id.id |
1355 | + else: |
1356 | + result['department_id'] = False |
1357 | obj_recru_stage = self.pool.get('hr.recruitment.stage') |
1358 | - stage_ids = obj_recru_stage.search(cr, uid, ['|',('department_id','=',department_id),('department_id','=',False)], context=context) |
1359 | - stage_id = stage_ids and stage_ids[0] or False |
1360 | - return {'value': {'stage_id': stage_id}} |
1361 | + stage_ids = obj_recru_stage.search(cr, uid, ['|',('job_id','=',job_id),('job_id','=',False)], context=context) |
1362 | + result['stage_id'] = stage_ids and stage_ids[0] or False |
1363 | + return {'value': result} |
1364 | |
1365 | def onchange_partner_id(self, cr, uid, ids, partner_id, context=None): |
1366 | data = {'partner_phone': False, |
1367 | @@ -287,17 +265,17 @@ |
1368 | if isinstance(cases, (int, long)): |
1369 | cases = self.browse(cr, uid, cases, context=context) |
1370 | # collect all section_ids |
1371 | - department_ids = [] |
1372 | + job_ids = [] |
1373 | if section_id: |
1374 | - department_ids.append(section_id) |
1375 | + job_ids.append(section_id) |
1376 | for case in cases: |
1377 | - if case.department_id: |
1378 | - department_ids.append(case.department_id.id) |
1379 | + if case.job_id: |
1380 | + job_ids.append(case.job_id.id) |
1381 | # OR all section_ids and OR with case_default |
1382 | search_domain = [] |
1383 | - if department_ids: |
1384 | - search_domain += ['|', ('department_id', 'in', department_ids)] |
1385 | - search_domain.append(('department_id', '=', False)) |
1386 | + if job_ids: |
1387 | + search_domain += ['|', ('job_id', 'in', job_ids)] |
1388 | + search_domain.append(('job_id', '=', False)) |
1389 | # AND with the domain in parameter |
1390 | search_domain += list(domain) |
1391 | # perform search, return the first found |
1392 | @@ -419,10 +397,6 @@ |
1393 | self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S'),}) |
1394 | return res |
1395 | |
1396 | - def case_close(self, cr, uid, ids, context=None): |
1397 | - res = super(hr_applicant, self).case_close(cr, uid, ids, context) |
1398 | - return res |
1399 | - |
1400 | def case_close_with_emp(self, cr, uid, ids, context=None): |
1401 | if context is None: |
1402 | context = {} |
1403 | @@ -442,8 +416,8 @@ |
1404 | 'address_home_id': address_id, |
1405 | 'department_id': applicant.department_id.id |
1406 | }) |
1407 | - self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context) |
1408 | - self.case_close(cr, uid, [applicant.id], context) |
1409 | + stage_id = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_recruitment', 'stage_job5') #get stage_id of Contract Signed(Hired) stage |
1410 | + self.write(cr, uid, [applicant.id], {'emp_id': emp_id, 'stage_id': stage_id.id}, context=context) |
1411 | else: |
1412 | raise osv.except_osv(_('Warning!'), _('You must define an Applied Job and a Contact Name for this applicant.')) |
1413 | |
1414 | @@ -454,26 +428,6 @@ |
1415 | dict_act_window['view_mode'] = 'form,tree' |
1416 | return dict_act_window |
1417 | |
1418 | - def case_cancel(self, cr, uid, ids, context=None): |
1419 | - """Overrides cancel for crm_case for setting probability |
1420 | - """ |
1421 | - res = super(hr_applicant, self).case_cancel(cr, uid, ids, context) |
1422 | - self.write(cr, uid, ids, {'probability': 0.0}) |
1423 | - return res |
1424 | - |
1425 | - def case_pending(self, cr, uid, ids, context=None): |
1426 | - """Marks case as pending""" |
1427 | - res = super(hr_applicant, self).case_pending(cr, uid, ids, context) |
1428 | - self.write(cr, uid, ids, {'probability': 0.0}) |
1429 | - return res |
1430 | - |
1431 | - def case_reset(self, cr, uid, ids, context=None): |
1432 | - """Resets case as draft |
1433 | - """ |
1434 | - res = super(hr_applicant, self).case_reset(cr, uid, ids, context) |
1435 | - self.write(cr, uid, ids, {'date_open': False, 'date_closed': False}) |
1436 | - return res |
1437 | - |
1438 | def set_priority(self, cr, uid, ids, priority, *args): |
1439 | """Set applicant priority |
1440 | """ |
1441 | |
1442 | === modified file 'hr_recruitment/hr_recruitment_data.xml' |
1443 | --- hr_recruitment/hr_recruitment_data.xml 2013-02-13 07:35:33 +0000 |
1444 | +++ hr_recruitment/hr_recruitment_data.xml 2013-06-05 13:32:29 +0000 |
1445 | @@ -53,32 +53,26 @@ |
1446 | </record> |
1447 | <record model="hr.recruitment.stage" id="stage_job1"> |
1448 | <field name="name">Initial Qualification</field> |
1449 | - <field name="state">draft</field> |
1450 | <field name="sequence">1</field> |
1451 | </record> |
1452 | <record model="hr.recruitment.stage" id="stage_job2"> |
1453 | <field name="name">First Interview</field> |
1454 | - <field name="state">open</field> |
1455 | <field name="sequence">2</field> |
1456 | </record> |
1457 | <record model="hr.recruitment.stage" id="stage_job3"> |
1458 | <field name="name">Second Interview</field> |
1459 | - <field name="state">open</field> |
1460 | <field name="sequence">3</field> |
1461 | </record> |
1462 | <record model="hr.recruitment.stage" id="stage_job4"> |
1463 | <field name="name">Contract Proposed</field> |
1464 | - <field name="state">pending</field> |
1465 | <field name="sequence">4</field> |
1466 | </record> |
1467 | <record model="hr.recruitment.stage" id="stage_job5"> |
1468 | <field name="name">Contract Signed</field> |
1469 | - <field name="state">done</field> |
1470 | <field name="sequence">5</field> |
1471 | </record> |
1472 | <record model="hr.recruitment.stage" id="stage_job6"> |
1473 | <field name="name">Refused</field> |
1474 | - <field name="state">cancel</field> |
1475 | <field name="sequence">6</field> |
1476 | <field name="fold" eval="True"/> |
1477 | </record> |
1478 | |
1479 | === modified file 'hr_recruitment/hr_recruitment_view.xml' |
1480 | --- hr_recruitment/hr_recruitment_view.xml 2013-05-30 10:08:52 +0000 |
1481 | +++ hr_recruitment/hr_recruitment_view.xml 2013-06-05 13:32:29 +0000 |
1482 | @@ -39,7 +39,7 @@ |
1483 | <field name="name">Applicants</field> |
1484 | <field name="model">hr.applicant</field> |
1485 | <field name="arch" type="xml"> |
1486 | - <tree string="Applicants" fonts="bold:message_unread==True" colors="grey:state in ('cancel','done');blue:state=='pending'"> |
1487 | + <tree string="Applicants" fonts="bold:message_unread==True"> |
1488 | <field name="message_unread" invisible="1"/> |
1489 | <field name="create_date"/> |
1490 | <field name="name" string="Subject"/> |
1491 | @@ -58,7 +58,6 @@ |
1492 | <field name="availability" invisible="1"/> |
1493 | <field name="department_id" invisible="context.get('invisible_department', True)"/> |
1494 | <field name="user_id"/> |
1495 | - <field name="state" invisible="1"/> |
1496 | </tree> |
1497 | </field> |
1498 | </record> |
1499 | @@ -71,10 +70,8 @@ |
1500 | <header> |
1501 | <button name="case_close_with_emp" string="Hire & Create Employee" type="object" |
1502 | class="oe_highlight" |
1503 | - attrs="{'invisible':['|', ('emp_id','!=',False), ('state','=','cancel')]}"/> |
1504 | - <button name="case_cancel" string="Refuse" type="object" |
1505 | - states="draft,open,pending" class="oe_highlight"/> |
1506 | - <field name="stage_id" widget="statusbar" clickable="True"/> |
1507 | + attrs="{'invisible':['|', ('emp_id','!=',False), ('stage_sequence','=',5)]}"/> |
1508 | + <field name="stage_id" widget="statusbar" clickable="True" domain="['|', ('job_id', '=', job_id), ('job_id', '=', False)]"/> |
1509 | <field name="emp_id" invisible="1"/> |
1510 | </header> |
1511 | <sheet> |
1512 | @@ -115,7 +112,7 @@ |
1513 | <field name="title_action" class="oe_inline" placeholder="e.g. Call for interview"/> |
1514 | </div> |
1515 | <field name="priority"/> |
1516 | - <field name="state" invisible="1"/> |
1517 | + <field name="stage_sequence" invisible="1"/> |
1518 | <field name="source_id"/> |
1519 | <field name="reference"/> |
1520 | </group> |
1521 | @@ -123,7 +120,7 @@ |
1522 | <field name="survey" invisible="1"/> |
1523 | <field name="response" invisible="1"/> |
1524 | <field name="job_id" on_change="onchange_job(job_id)"/> |
1525 | - <field name="department_id" on_change="onchange_department_id(department_id)"/> |
1526 | + <field name="department_id"/> |
1527 | <label for="availability"/> |
1528 | <div> |
1529 | <field name="availability" class="oe_inline"/> <label string="Day(s)" class="oe_inline"/> |
1530 | @@ -165,7 +162,7 @@ |
1531 | <graph string="Cases By Stage and Estimates" type="bar" orientation="vertical"> |
1532 | <field name="job_id"/> |
1533 | <field name="salary_expected" operator="+"/> |
1534 | - <field name="state" group="True"/> |
1535 | + <field name="stage_id" group="True"/> |
1536 | </graph> |
1537 | </field> |
1538 | </record> |
1539 | @@ -178,10 +175,6 @@ |
1540 | <field name="partner_name" filter_domain="['|','|',('name','ilike',self),('partner_name','ilike',self),('email_from','ilike',self)]" string="Subject / Applicant"/> |
1541 | <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/> |
1542 | <separator/> |
1543 | - <filter string="New" domain="[('state','=','draft')]" help="All Initial Jobs"/> |
1544 | - <filter string="In Progress" domain="[('state','=','open')]" help="Open Jobs"/> |
1545 | - <filter string="Pending" domain="[('state','=','pending')]" help="Pending Jobs"/> |
1546 | - <separator/> |
1547 | <filter string="Unassigned Recruitments" domain="[('user_id','=',False)]" help="Unassigned Recruitments"/> |
1548 | <separator/> |
1549 | <filter string="Next Actions" context="{'invisible_next_action':False, 'invisible_next_date':False}" |
1550 | @@ -190,6 +183,7 @@ |
1551 | <field name="user_id"/> |
1552 | <separator/> |
1553 | <field name="categ_ids"/> |
1554 | + <field name="stage_id"/> |
1555 | <group expand="0" string="Group By..."> |
1556 | <filter string="Responsible" domain="[]" context="{'group_by':'user_id'}"/> |
1557 | <filter string="Department" domain="[]" context="{'group_by':'department_id'}"/> |
1558 | @@ -340,8 +334,7 @@ |
1559 | <tree string="Stages"> |
1560 | <field name="sequence" invisible="1"/> |
1561 | <field name="name"/> |
1562 | - <field name="department_id"/> |
1563 | - <field name="state"/> |
1564 | + <field name="job_id"/> |
1565 | </tree> |
1566 | </field> |
1567 | </record> |
1568 | @@ -356,10 +349,9 @@ |
1569 | <group string="Stage Definition"> |
1570 | <group> |
1571 | <field name="name"/> |
1572 | - <field name="department_id"/> |
1573 | + <field name="job_id"/> |
1574 | </group> |
1575 | <group> |
1576 | - <field name="state"/> |
1577 | <field name="sequence"/> |
1578 | <field name="fold"/> |
1579 | </group> |
1580 | |
1581 | === modified file 'hr_recruitment/report/hr_recruitment_report.py' |
1582 | --- hr_recruitment/report/hr_recruitment_report.py 2013-04-15 10:23:49 +0000 |
1583 | +++ hr_recruitment/report/hr_recruitment_report.py 2013-06-05 13:32:29 +0000 |
1584 | @@ -24,14 +24,6 @@ |
1585 | from openerp.addons.decimal_precision import decimal_precision as dp |
1586 | |
1587 | |
1588 | -AVAILABLE_STATES = [ |
1589 | - ('draft','New'), |
1590 | - ('open','Open'), |
1591 | - ('cancel', 'Refused'), |
1592 | - ('done', 'Hired'), |
1593 | - ('pending','Pending') |
1594 | -] |
1595 | - |
1596 | class hr_recruitment_report(osv.osv): |
1597 | _name = "hr.recruitment.report" |
1598 | _description = "Recruitments Statistics" |
1599 | @@ -41,7 +33,6 @@ |
1600 | _columns = { |
1601 | 'user_id': fields.many2one('res.users', 'User', readonly=True), |
1602 | 'nbr': fields.integer('# of Applications', readonly=True), |
1603 | - 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), |
1604 | 'month':fields.selection([('01', 'January'), ('02', 'February'), \ |
1605 | ('03', 'March'), ('04', 'April'),\ |
1606 | ('05', 'May'), ('06', 'June'), \ |
1607 | @@ -79,7 +70,6 @@ |
1608 | to_char(s.create_date, 'YYYY') as year, |
1609 | to_char(s.create_date, 'MM') as month, |
1610 | to_char(s.create_date, 'YYYY-MM-DD') as day, |
1611 | - s.state, |
1612 | s.partner_id, |
1613 | s.company_id, |
1614 | s.user_id, |
1615 | @@ -105,7 +95,6 @@ |
1616 | s.date_open, |
1617 | s.create_date, |
1618 | s.date_closed, |
1619 | - s.state, |
1620 | s.partner_id, |
1621 | s.company_id, |
1622 | s.user_id, |
1623 | |
1624 | === modified file 'hr_recruitment/report/hr_recruitment_report_view.xml' |
1625 | --- hr_recruitment/report/hr_recruitment_report_view.xml 2012-11-29 22:26:45 +0000 |
1626 | +++ hr_recruitment/report/hr_recruitment_report_view.xml 2013-06-05 13:32:29 +0000 |
1627 | @@ -14,7 +14,6 @@ |
1628 | <field name="type_id" invisible="1"/> |
1629 | <field name="partner_id" invisible="1"/> |
1630 | <field name="company_id" groups="base.group_multi_company" invisible="1"/> |
1631 | - <field name="state" invisible="1"/> |
1632 | <field name="year" invisible="1"/> |
1633 | <field name="day" invisible="1"/> |
1634 | <field name="month" invisible="1"/> |
1635 | @@ -46,11 +45,6 @@ |
1636 | <field name="model">hr.recruitment.report</field> |
1637 | <field name="arch" type="xml"> |
1638 | <search string="Recruitment Analysis"> |
1639 | - <filter string="New" icon="terp-document-new" domain="[('state','=','draft')]" help = "Draft recruitment"/> |
1640 | - <filter string="In progress" icon="terp-camera_test" domain="[('state', '=' ,'open')]" help = "In progress recruitment"/> |
1641 | - <filter string="Pending" icon="terp-gtk-media-pause" domain="[('state','=','pending')]" help = "Pending recruitment"/> |
1642 | - <filter string="Hired" icon="terp-camera_test" domain="[('state','=','done')]" help = "Hired employees"/> |
1643 | - <separator/> |
1644 | <filter icon="terp-personal" string="My Recruitment" help="My Recruitment" domain="[('user_id','=',uid)]"/> |
1645 | <field name="job_id"/> |
1646 | <field name="department_id"/> |
1647 | |
1648 | === modified file 'hr_recruitment/test/recruitment_process.yml' |
1649 | --- hr_recruitment/test/recruitment_process.yml 2013-04-17 06:40:51 +0000 |
1650 | +++ hr_recruitment/test/recruitment_process.yml 2013-06-05 13:32:29 +0000 |
1651 | @@ -17,34 +17,8 @@ |
1652 | resume_ids = self.pool.get('ir.attachment').search(cr, uid, [('datas_fname','=','resume.pdf'),('res_model','=',self._name),('res_id','=',applicant.id)]) |
1653 | assert applicant.name == "Application for the post of Jr.application Programmer.", "Applicant name does not match." |
1654 | assert applicant.stage_id.id == ref('hr_recruitment.stage_job1'), "Stage should be 'Initial qualification' and is '%s'." % (applicant.stage_id.name) |
1655 | - assert applicant.state == "draft", "Applicant state should be 'draft'." |
1656 | assert len(resume_ids), "Resume is not attached." |
1657 | - |
1658 | - I refuse the applicant (hr_case_programmer) |
1659 | -- |
1660 | - !python {model: hr.applicant}: | |
1661 | - self.case_cancel(cr, uid, [ref("hr_case_programmer")]) |
1662 | -- |
1663 | - I check the details of the refused applicant. |
1664 | -- |
1665 | - !python {model: hr.applicant}: | |
1666 | - applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context) |
1667 | - assert applicant.stage_id.id == ref('hr_recruitment.stage_job6'), "Stage should be 'Refused' and is %s." % (applicant.stage_id.name) |
1668 | - assert applicant.state == 'cancel', "Applicant is not in 'cancel' state." |
1669 | -- |
1670 | - I reset and re-open the previously refused applicant. |
1671 | -- |
1672 | - !python {model: hr.applicant}: | |
1673 | - self.case_reset(cr, uid, [ref("hr_case_programmer")]) |
1674 | - self.case_open(cr, uid, [ref("hr_case_programmer")]) |
1675 | -- |
1676 | - I check the details of the re-opened applicant. |
1677 | -- |
1678 | - !python {model: hr.applicant}: | |
1679 | - applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context) |
1680 | - assert applicant.stage_id.id == ref('hr_recruitment.stage_job2'), "Stage should be 'First interview' and is '%s'." % (applicant.stage_id.name) |
1681 | - assert applicant.state == "open", "Applicant state should be 'open'." |
1682 | -- |
1683 | I assign the Job position to the applicant |
1684 | - |
1685 | !python {model: hr.applicant}: | |
1686 | @@ -98,22 +72,21 @@ |
1687 | - |
1688 | I check that applicant is "Hired". |
1689 | - |
1690 | - !assert {model: hr.applicant, id: hr_case_programmer, string: Applicant state is done}: |
1691 | - - state == 'done' |
1692 | + !python {model: hr.applicant}: | |
1693 | + applicant = self.browse(cr, uid, ref("hr_case_programmer"), context=context) |
1694 | + assert applicant.stage_id.id == ref('hr_recruitment.stage_job5'), "Stage should be 'Contract Signed' and is '%s'." % (applicant.stage_id.name) |
1695 | - |
1696 | I do not give employment to the hired the applicant. |
1697 | - |
1698 | !python {model: hired.employee}: | |
1699 | context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")}) |
1700 | emp_id = self.create(cr, uid, {}, context=context) |
1701 | - self.case_close(cr, uid, [emp_id], context=context) |
1702 | - |
1703 | Now I give employment to hired applicant . |
1704 | - |
1705 | !python {model: hr.applicant}: | |
1706 | hired_emp_obj = self.pool.get('hired.employee') |
1707 | - self.case_reset(cr, uid, [ref("hr_case_programmer")]) |
1708 | - self.case_open(cr, uid, [ref("hr_case_programmer")]) |
1709 | + self.write(cr, uid, [ref("hr_recruitment.hr_case_programmer")], {'stage_sequence' : 3}) |
1710 | context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")}) |
1711 | emp_hr_id = hired_emp_obj.create(cr, uid, {}, context=context) |
1712 | hired_emp_obj.case_close_with_emp(cr, uid, [emp_hr_id], context=context) |
1713 | |
1714 | === modified file 'pad_project/project_task.xml' |
1715 | --- pad_project/project_task.xml 2012-11-29 22:26:45 +0000 |
1716 | +++ pad_project/project_task.xml 2013-06-05 13:32:29 +0000 |
1717 | @@ -6,7 +6,7 @@ |
1718 | <field name="inherit_id" ref="project.view_task_form2"/> |
1719 | <field name="arch" type="xml"> |
1720 | <field name="description" position="replace"> |
1721 | - <field name="description_pad" attrs="{'readonly':[('state','=','done')]}" widget="pad"/> |
1722 | + <field name="description_pad" attrs="{'readonly':[('stage_sequence','=',7)]}" widget="pad"/> |
1723 | </field> |
1724 | </field> |
1725 | </record> |
1726 | |
1727 | === modified file 'portal_project_issue/portal_project_issue_view.xml' |
1728 | --- portal_project_issue/portal_project_issue_view.xml 2012-11-29 22:26:45 +0000 |
1729 | +++ portal_project_issue/portal_project_issue_view.xml 2013-06-05 13:32:29 +0000 |
1730 | @@ -25,9 +25,6 @@ |
1731 | <field name="version_id"/> |
1732 | </div> |
1733 | <div><field name="categ_ids" widget="many2many_tags" class="oe_left"/></div> |
1734 | - <div class="oe_text_right"> |
1735 | - <h1><field name="state" readonly="1"/></h1> |
1736 | - </div> |
1737 | </div> |
1738 | <div> |
1739 | <h1><a type="open"><field name="name"/></a></h1> |
1740 | |
1741 | === modified file 'project/__openerp__.py' |
1742 | --- project/__openerp__.py 2013-01-31 18:41:41 +0000 |
1743 | +++ project/__openerp__.py 2013-06-05 13:32:29 +0000 |
1744 | @@ -66,7 +66,6 @@ |
1745 | 'data': [ |
1746 | 'security/project_security.xml', |
1747 | 'wizard/project_task_delegate_view.xml', |
1748 | - 'wizard/project_task_reevaluate_view.xml', |
1749 | 'security/ir.model.access.csv', |
1750 | 'project_data.xml', |
1751 | 'project_view.xml', |
1752 | |
1753 | === modified file 'project/board_project_view.xml' |
1754 | --- project/board_project_view.xml 2012-11-29 22:26:45 +0000 |
1755 | +++ project/board_project_view.xml 2013-06-05 13:32:29 +0000 |
1756 | @@ -16,7 +16,6 @@ |
1757 | <field name="effective_hours" widget="float_time"/> |
1758 | <field name="progress" widget="progressbar"/> |
1759 | <field name="stage_id" invisible="context.get('set_visible',False)"/> |
1760 | - <field name="state" invisible="1"/> |
1761 | </tree> |
1762 | </field> |
1763 | </record> |
1764 | @@ -26,7 +25,7 @@ |
1765 | <field name="res_model">project.task</field> |
1766 | <field name="view_type">form</field> |
1767 | <field name="view_mode">tree,form</field> |
1768 | - <field name="domain">[('user_id','=',uid),('state','not in',('cancel','done'))]</field> |
1769 | + <field name="domain">[('user_id','=',uid),('stage_sequence','not in', (7,8))]</field> |
1770 | <field name="view_id" ref="view_task_tree"/> |
1771 | </record> |
1772 | |
1773 | |
1774 | === modified file 'project/project.py' |
1775 | --- project/project.py 2013-05-21 13:38:07 +0000 |
1776 | +++ project/project.py 2013-06-05 13:32:29 +0000 |
1777 | @@ -44,9 +44,6 @@ |
1778 | 'case_default': fields.boolean('Default for New Projects', |
1779 | help="If you check this field, this stage will be proposed by default on each new project. It will not assign this stage to existing projects."), |
1780 | 'project_ids': fields.many2many('project.project', 'project_task_type_rel', 'type_id', 'project_id', 'Projects'), |
1781 | - 'state': fields.selection(_TASK_STATE, 'Related Status', required=True, |
1782 | - help="The status of your document is automatically changed regarding the selected stage. " \ |
1783 | - "For example, if a stage is related to the status 'Close', when your document reaches this stage, it is automatically closed."), |
1784 | 'fold': fields.boolean('Folded by Default', |
1785 | help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), |
1786 | } |
1787 | @@ -57,7 +54,6 @@ |
1788 | return proj |
1789 | _defaults = { |
1790 | 'sequence': 1, |
1791 | - 'state': 'open', |
1792 | 'fold': False, |
1793 | 'case_default': False, |
1794 | 'project_ids': _get_default_project_id |
1795 | @@ -152,7 +148,7 @@ |
1796 | cr.execute(""" |
1797 | SELECT project_id, COALESCE(SUM(planned_hours), 0.0), |
1798 | COALESCE(SUM(total_hours), 0.0), COALESCE(SUM(effective_hours), 0.0) |
1799 | - FROM project_task WHERE project_id IN %s AND state <> 'cancelled' |
1800 | + FROM project_task WHERE project_id IN %s |
1801 | GROUP BY project_id |
1802 | """, (tuple(child_parent.keys()),)) |
1803 | # aggregate results into res |
1804 | @@ -253,22 +249,22 @@ |
1805 | 'planned_hours': fields.function(_progress_rate, multi="progress", string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.", |
1806 | store = { |
1807 | 'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10), |
1808 | - 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20), |
1809 | + 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids'], 20), |
1810 | }), |
1811 | 'effective_hours': fields.function(_progress_rate, multi="progress", string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects.", |
1812 | store = { |
1813 | 'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10), |
1814 | - 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20), |
1815 | + 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids'], 20), |
1816 | }), |
1817 | 'total_hours': fields.function(_progress_rate, multi="progress", string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects.", |
1818 | store = { |
1819 | 'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10), |
1820 | - 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20), |
1821 | + 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids'], 20), |
1822 | }), |
1823 | 'progress_rate': fields.function(_progress_rate, multi="progress", string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo.", |
1824 | store = { |
1825 | 'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10), |
1826 | - 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20), |
1827 | + 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids'], 20), |
1828 | }), |
1829 | 'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)]} ), |
1830 | 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), |
1831 | @@ -328,14 +324,12 @@ |
1832 | |
1833 | def set_done(self, cr, uid, ids, context=None): |
1834 | task_obj = self.pool.get('project.task') |
1835 | - task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('state', 'not in', ('cancelled', 'done'))]) |
1836 | - task_obj.case_close(cr, uid, task_ids, context=context) |
1837 | + task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('stage_sequence', 'not in', (7,8))]) |
1838 | return self.write(cr, uid, ids, {'state':'close'}, context=context) |
1839 | |
1840 | def set_cancel(self, cr, uid, ids, context=None): |
1841 | task_obj = self.pool.get('project.task') |
1842 | - task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('state', '!=', 'done')]) |
1843 | - task_obj.case_cancel(cr, uid, task_ids, context=context) |
1844 | + task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('stage_sequence', '!=', 7)]) |
1845 | return self.write(cr, uid, ids, {'state':'cancelled'}, context=context) |
1846 | |
1847 | def set_pending(self, cr, uid, ids, context=None): |
1848 | @@ -461,7 +455,7 @@ |
1849 | if project.user_id and (project.user_id.id not in u_ids): |
1850 | u_ids.append(project.user_id.id) |
1851 | for task in project.tasks: |
1852 | - if task.state in ('done','cancelled'): |
1853 | + if task.stage_sequence in (7,8): |
1854 | continue |
1855 | if task.user_id and (task.user_id.id not in u_ids): |
1856 | u_ids.append(task.user_id.id) |
1857 | @@ -527,7 +521,7 @@ |
1858 | for project in projects: |
1859 | project_gantt = getattr(projects_gantt, 'Project_%d' % (project.id,)) |
1860 | for task in project.tasks: |
1861 | - if task.state in ('done','cancelled'): |
1862 | + if task.stage_sequence in (7,8): |
1863 | continue |
1864 | |
1865 | p = getattr(project_gantt, 'Task_%d' % (task.id,)) |
1866 | @@ -580,13 +574,8 @@ |
1867 | _inherit = ['mail.thread', 'ir.needaction_mixin'] |
1868 | |
1869 | _track = { |
1870 | - 'state': { |
1871 | - 'project.mt_task_new': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'new', |
1872 | - 'project.mt_task_started': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open', |
1873 | - 'project.mt_task_closed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', |
1874 | - }, |
1875 | 'stage_id': { |
1876 | - 'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'done', 'open'], |
1877 | + 'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj['stage_id'] != False, |
1878 | }, |
1879 | 'kanban_state': { # kanban state: tracked, but only block subtype |
1880 | 'project.mt_task_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked', |
1881 | @@ -600,7 +589,7 @@ |
1882 | def _get_default_stage_id(self, cr, uid, context=None): |
1883 | """ Gives default stage_id """ |
1884 | project_id = self._get_default_project_id(cr, uid, context=context) |
1885 | - return self.stage_find(cr, uid, [], project_id, [('state', '=', 'draft')], context=context) |
1886 | + return self.stage_find(cr, uid, [], project_id, [], context=context) #Get stage_id with lower priority as default |
1887 | |
1888 | def _resolve_project_id_from_context(self, cr, uid, context=None): |
1889 | """ Returns ID of project based on the value of 'default_project_id' |
1890 | @@ -676,7 +665,7 @@ |
1891 | res[task.id]['progress'] = 0.0 |
1892 | if (task.remaining_hours + hours.get(task.id, 0.0)): |
1893 | res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99),2) |
1894 | - if task.state in ('done','cancelled'): |
1895 | + if task.stage_sequence in (7,8) or task.remaining_hours <= 0.0: |
1896 | res[task.id]['progress'] = 100.0 |
1897 | return res |
1898 | |
1899 | @@ -697,6 +686,9 @@ |
1900 | return {'value':{'partner_id':partner_id.id}} |
1901 | return {} |
1902 | |
1903 | + def onchange_user_assigned(self, cr, uid, ids, user_id): |
1904 | + return {'value':{'date_start': fields.datetime.now(),'date_end':False}} |
1905 | + |
1906 | def duplicate_task(self, cr, uid, map_ids, context=None): |
1907 | for new in map_ids.values(): |
1908 | task = self.browse(cr, uid, new, context) |
1909 | @@ -752,15 +744,9 @@ |
1910 | 'description': fields.text('Description'), |
1911 | 'priority': fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Important'), ('0','Very important')], 'Priority', select=True), |
1912 | 'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of tasks."), |
1913 | - 'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange', |
1914 | - domain="[('project_ids', '=', project_id)]"), |
1915 | - 'state': fields.related('stage_id', 'state', type="selection", store=True, |
1916 | - selection=_TASK_STATE, string="Status", readonly=True, |
1917 | - help='The status is set to \'Draft\', when a case is created.\ |
1918 | - If the case is in progress the status is set to \'Open\'.\ |
1919 | - When the case is over, the status is set to \'Done\'.\ |
1920 | - If the case needs to be reviewed then the status is \ |
1921 | - set to \'Pending\'.'), |
1922 | + 'stage_id': fields.many2one('project.task.type', 'Stage', track_visibility='onchange'), |
1923 | + 'stage_sequence': fields.related('stage_id', 'sequence', type="integer", string= |
1924 | +"Stage Sequence"), |
1925 | 'categ_ids': fields.many2many('project.category', string='Tags'), |
1926 | 'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State', |
1927 | track_visibility='onchange', |
1928 | @@ -789,9 +775,9 @@ |
1929 | 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours'], 10), |
1930 | 'project.task.work': (_get_task, ['hours'], 10), |
1931 | }), |
1932 | - 'progress': fields.function(_hours_get, string='Progress (%)', multi='hours', group_operator="avg", help="If the task has a progress of 99.99% you should close the task if it's finished or reevaluate the time", |
1933 | + 'progress': fields.function(_hours_get, string='Working Time Progress (%)', multi='hours', group_operator="avg", help="If the task has a progress of 99.99% you should close the task if it's finished or reevaluate the time", |
1934 | store = { |
1935 | - 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours','state'], 10), |
1936 | + 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours'], 10), |
1937 | 'project.task.work': (_get_task, ['hours'], 10), |
1938 | }), |
1939 | 'delay_hours': fields.function(_hours_get, string='Delay Hours', multi='hours', help="Computed as difference between planned hours by the project manager and the total hours of the task.", |
1940 | @@ -955,82 +941,10 @@ |
1941 | for task in tasks: |
1942 | if task.child_ids: |
1943 | for child in task.child_ids: |
1944 | - if child.state in ['draft', 'open', 'pending']: |
1945 | + if child.stage_sequence not in [7,8]: |
1946 | raise osv.except_osv(_("Warning !"), _("Child task still open.\nPlease cancel or complete child task first.")) |
1947 | return True |
1948 | |
1949 | - def action_close(self, cr, uid, ids, context=None): |
1950 | - """ This action closes the task |
1951 | - """ |
1952 | - task_id = len(ids) and ids[0] or False |
1953 | - self._check_child_task(cr, uid, ids, context=context) |
1954 | - if not task_id: return False |
1955 | - return self.do_close(cr, uid, [task_id], context=context) |
1956 | - |
1957 | - def do_close(self, cr, uid, ids, context=None): |
1958 | - """ Compatibility when changing to case_close. """ |
1959 | - return self.case_close(cr, uid, ids, context=context) |
1960 | - |
1961 | - def case_close(self, cr, uid, ids, context=None): |
1962 | - """ Closes Task """ |
1963 | - if not isinstance(ids, list): ids = [ids] |
1964 | - for task in self.browse(cr, uid, ids, context=context): |
1965 | - vals = {} |
1966 | - project = task.project_id |
1967 | - for parent_id in task.parent_ids: |
1968 | - if parent_id.state in ('pending','draft'): |
1969 | - reopen = True |
1970 | - for child in parent_id.child_ids: |
1971 | - if child.id != task.id and child.state not in ('done','cancelled'): |
1972 | - reopen = False |
1973 | - if reopen: |
1974 | - self.do_reopen(cr, uid, [parent_id.id], context=context) |
1975 | - # close task |
1976 | - vals['remaining_hours'] = 0.0 |
1977 | - if not task.date_end: |
1978 | - vals['date_end'] = fields.datetime.now() |
1979 | - self.case_set(cr, uid, [task.id], 'done', vals, context=context) |
1980 | - return True |
1981 | - |
1982 | - def do_reopen(self, cr, uid, ids, context=None): |
1983 | - for task in self.browse(cr, uid, ids, context=context): |
1984 | - project = task.project_id |
1985 | - self.case_set(cr, uid, [task.id], 'open', {}, context=context) |
1986 | - return True |
1987 | - |
1988 | - def do_cancel(self, cr, uid, ids, context=None): |
1989 | - """ Compatibility when changing to case_cancel. """ |
1990 | - return self.case_cancel(cr, uid, ids, context=context) |
1991 | - |
1992 | - def case_cancel(self, cr, uid, ids, context=None): |
1993 | - tasks = self.browse(cr, uid, ids, context=context) |
1994 | - self._check_child_task(cr, uid, ids, context=context) |
1995 | - for task in tasks: |
1996 | - self.case_set(cr, uid, [task.id], 'cancelled', {'remaining_hours': 0.0}, context=context) |
1997 | - return True |
1998 | - |
1999 | - def do_open(self, cr, uid, ids, context=None): |
2000 | - """ Compatibility when changing to case_open. """ |
2001 | - return self.case_open(cr, uid, ids, context=context) |
2002 | - |
2003 | - def case_open(self, cr, uid, ids, context=None): |
2004 | - if not isinstance(ids,list): ids = [ids] |
2005 | - return self.case_set(cr, uid, ids, 'open', {'date_start': fields.datetime.now()}, context=context) |
2006 | - |
2007 | - def do_draft(self, cr, uid, ids, context=None): |
2008 | - """ Compatibility when changing to case_draft. """ |
2009 | - return self.case_draft(cr, uid, ids, context=context) |
2010 | - |
2011 | - def case_draft(self, cr, uid, ids, context=None): |
2012 | - return self.case_set(cr, uid, ids, 'draft', {}, context=context) |
2013 | - |
2014 | - def do_pending(self, cr, uid, ids, context=None): |
2015 | - """ Compatibility when changing to case_pending. """ |
2016 | - return self.case_pending(cr, uid, ids, context=context) |
2017 | - |
2018 | - def case_pending(self, cr, uid, ids, context=None): |
2019 | - return self.case_set(cr, uid, ids, 'pending', {}, context=context) |
2020 | - |
2021 | def _delegate_task_attachments(self, cr, uid, task_id, delegated_task_id, context=None): |
2022 | attachment = self.pool.get('ir.attachment') |
2023 | attachment_ids = attachment.search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', task_id)], context=context) |
2024 | @@ -1065,16 +979,12 @@ |
2025 | 'planned_hours': delegate_data['planned_hours_me'] + (task.effective_hours or 0.0), |
2026 | 'name': newname, |
2027 | }, context=context) |
2028 | - if delegate_data['state'] == 'pending': |
2029 | - self.do_pending(cr, uid, [task.id], context=context) |
2030 | - elif delegate_data['state'] == 'done': |
2031 | - self.do_close(cr, uid, [task.id], context=context) |
2032 | delegated_tasks[task.id] = delegated_task_id |
2033 | return delegated_tasks |
2034 | |
2035 | def set_remaining_time(self, cr, uid, ids, remaining_time=1.0, context=None): |
2036 | for task in self.browse(cr, uid, ids, context=context): |
2037 | - if (task.state=='draft') or (task.planned_hours==0.0): |
2038 | + if (task.stage_sequence==1) or (task.planned_hours==0.0): |
2039 | self.write(cr, uid, [task.id], {'planned_hours': remaining_time}, context=context) |
2040 | self.write(cr, uid, ids, {'remaining_hours': remaining_time}, context=context) |
2041 | return True |
2042 | @@ -1109,7 +1019,6 @@ |
2043 | 'planned_hours': task.planned_hours, |
2044 | 'kanban_state': task.kanban_state, |
2045 | 'type_id': task.stage_id.id, |
2046 | - 'state': task.state, |
2047 | 'user_id': task.user_id.id |
2048 | |
2049 | }, context=context) |
2050 | @@ -1132,6 +1041,8 @@ |
2051 | def write(self, cr, uid, ids, vals, context=None): |
2052 | if isinstance(ids, (int, long)): |
2053 | ids = [ids] |
2054 | + if vals.get('stage_id'): |
2055 | + vals.update({'date_end': fields.datetime.now()}) |
2056 | if vals.get('project_id'): |
2057 | project_id = self.pool.get('project.project').browse(cr, uid, vals.get('project_id'), context=context) |
2058 | if project_id: |
2059 | @@ -1150,7 +1061,7 @@ |
2060 | result = True |
2061 | else: |
2062 | result = super(task, self).write(cr, uid, ids, vals, context=context) |
2063 | - if ('stage_id' in vals) or ('remaining_hours' in vals) or ('user_id' in vals) or ('state' in vals) or ('kanban_state' in vals): |
2064 | + if ('stage_id' in vals) or ('remaining_hours' in vals) or ('user_id' in vals) or ('kanban_state' in vals): |
2065 | self._store_history(cr, uid, ids, context=context) |
2066 | return result |
2067 | |
2068 | @@ -1166,7 +1077,7 @@ |
2069 | result = "" |
2070 | ident = ' '*ident |
2071 | for task in tasks: |
2072 | - if task.state in ('done','cancelled'): |
2073 | + if task.stage_sequence in (7,8): |
2074 | continue |
2075 | result += ''' |
2076 | %sdef Task_%s(): |
2077 | @@ -1225,24 +1136,10 @@ |
2078 | update_vals[field] = float(res.group(2).lower()) |
2079 | except (ValueError, TypeError): |
2080 | pass |
2081 | - elif match.lower() == 'state' \ |
2082 | - and res.group(2).lower() in ['cancel','close','draft','open','pending']: |
2083 | - act = 'do_%s' % res.group(2).lower() |
2084 | if act: |
2085 | getattr(self,act)(cr, uid, ids, context=context) |
2086 | return super(task,self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context) |
2087 | |
2088 | - def project_task_reevaluate(self, cr, uid, ids, context=None): |
2089 | - if self.pool.get('res.users').has_group(cr, uid, 'project.group_time_work_estimation_tasks'): |
2090 | - return { |
2091 | - 'view_type': 'form', |
2092 | - "view_mode": 'form', |
2093 | - 'res_model': 'project.task.reevaluate', |
2094 | - 'type': 'ir.actions.act_window', |
2095 | - 'target': 'new', |
2096 | - } |
2097 | - return self.do_reopen(cr, uid, ids, context=context) |
2098 | - |
2099 | class project_work(osv.osv): |
2100 | _name = "project.task.work" |
2101 | _description = "Project Task Work" |
2102 | |
2103 | === modified file 'project/project_data.xml' |
2104 | --- project/project_data.xml 2013-03-21 16:29:39 +0000 |
2105 | +++ project/project_data.xml 2013-06-05 13:32:29 +0000 |
2106 | @@ -30,51 +30,43 @@ |
2107 | <record id="project_tt_analysis" model="project.task.type"> |
2108 | <field name="sequence">1</field> |
2109 | <field name="name">Analysis</field> |
2110 | - <field name="state">draft</field> |
2111 | <field name="case_default" eval="False"/> |
2112 | </record> |
2113 | <record id="project_tt_specification" model="project.task.type"> |
2114 | <field name="sequence">2</field> |
2115 | <field name="name">Specification</field> |
2116 | - <field name="state">pending</field> |
2117 | <field name="case_default" eval="True"/> |
2118 | </record> |
2119 | <record id="project_tt_design" model="project.task.type"> |
2120 | - <field name="sequence">2</field> |
2121 | + <field name="sequence">3</field> |
2122 | <field name="name">Design</field> |
2123 | - <field name="state">open</field> |
2124 | <field name="case_default" eval="True"/> |
2125 | </record> |
2126 | <record id="project_tt_development" model="project.task.type"> |
2127 | - <field name="sequence">3</field> |
2128 | + <field name="sequence">4</field> |
2129 | <field name="name">Development</field> |
2130 | - <field name="state">open</field> |
2131 | <field name="case_default" eval="True"/> |
2132 | </record> |
2133 | <record id="project_tt_testing" model="project.task.type"> |
2134 | - <field name="sequence">4</field> |
2135 | + <field name="sequence">5</field> |
2136 | <field name="name">Testing</field> |
2137 | - <field name="state">open</field> |
2138 | <field name="case_default" eval="True"/> |
2139 | </record> |
2140 | <record id="project_tt_merge" model="project.task.type"> |
2141 | - <field name="sequence">5</field> |
2142 | + <field name="sequence">6</field> |
2143 | <field name="name">Merge</field> |
2144 | - <field name="state">open</field> |
2145 | <field name="case_default" eval="False"/> |
2146 | <field name="fold" eval="True"/> |
2147 | </record> |
2148 | <record id="project_tt_deployment" model="project.task.type"> |
2149 | - <field name="sequence">100</field> |
2150 | + <field name="sequence">7</field> |
2151 | <field name="name">Done</field> |
2152 | - <field name="state">done</field> |
2153 | <field name="case_default" eval="True"/> |
2154 | <field name="fold" eval="True"/> |
2155 | </record> |
2156 | <record id="project_tt_cancel" model="project.task.type"> |
2157 | - <field name="sequence">200</field> |
2158 | + <field name="sequence">8</field> |
2159 | <field name="name">Cancelled</field> |
2160 | - <field name="state">cancelled</field> |
2161 | <field name="case_default" eval="True"/> |
2162 | <field name="fold" eval="True"/> |
2163 | </record> |
2164 | |
2165 | === modified file 'project/project_demo.xml' |
2166 | --- project/project_demo.xml 2013-04-16 14:11:45 +0000 |
2167 | +++ project/project_demo.xml 2013-06-05 13:32:29 +0000 |
2168 | @@ -221,7 +221,6 @@ |
2169 | ref('project.project_category_04')])]"/> |
2170 | <field name="stage_id" ref="project_tt_merge"/> |
2171 | </record> |
2172 | - <function model="project.task" name="do_close" eval="[ref('project_task_11')], {'install_mode': True}"/> |
2173 | |
2174 | <record id="project_task_12" model="project.task"> |
2175 | <field name="planned_hours" eval="40.0"/> |
2176 | @@ -233,7 +232,6 @@ |
2177 | <field name="stage_id" ref="project_tt_merge"/> |
2178 | <field name="color">6</field> |
2179 | </record> |
2180 | - <function model="project.task" name="do_close" eval="[ref('project_task_12')], {'install_mode': True}"/> |
2181 | |
2182 | <record id="project_task_13" model="project.task"> |
2183 | <field name="planned_hours" eval="12.0"/> |
2184 | @@ -244,7 +242,6 @@ |
2185 | <field name="name">Design Use Cases</field> |
2186 | <field name="stage_id" ref="project_tt_analysis"/> |
2187 | </record> |
2188 | - <function model="project.task" name="do_pending" eval="[ref('project_task_13')], {'install_mode': True}"/> |
2189 | |
2190 | <record id="project_task_14" model="project.task"> |
2191 | <field name="planned_hours" eval="12.0"/> |
2192 | @@ -278,7 +275,6 @@ |
2193 | <field name="name">Set target for all deparments</field> |
2194 | <field name="stage_id" ref="project_tt_development"/> |
2195 | </record> |
2196 | - <function model="project.task" name="do_open" eval="[ref('project_task_16')], {'install_mode': True}"/> |
2197 | |
2198 | <record id="project_task_17" model="project.task"> |
2199 | <field name="planned_hours" eval="34.0"/> |
2200 | @@ -289,7 +285,6 @@ |
2201 | <field name="name">Integration of core components</field> |
2202 | <field name="stage_id" ref="project_tt_testing"/> |
2203 | </record> |
2204 | - <function model="project.task" name="do_open" eval="[ref('project_task_17')], {'install_mode': True}"/> |
2205 | |
2206 | <record id="project_task_18" model="project.task"> |
2207 | <field name="planned_hours" eval="16.0"/> |
2208 | @@ -311,7 +306,6 @@ |
2209 | <field name="categ_ids" eval="[(6, 0, [ |
2210 | ref('project_category_03')])]"/> |
2211 | </record> |
2212 | - <function model="project.task" name="do_open" eval="[ref('project_task_19')], {'install_mode': True}"/> |
2213 | |
2214 | <record id="project_task_20" model="project.task"> |
2215 | <field name="planned_hours">42.0</field> |
2216 | @@ -321,7 +315,6 @@ |
2217 | <field name="project_id" ref="project.project_project_4"/> |
2218 | <field name="name">Create new components</field> |
2219 | </record> |
2220 | - <function model="project.task" name="do_open" eval="[ref('project_task_20')], {'install_mode': True}"/> |
2221 | |
2222 | <record id="project_task_21" model="project.task"> |
2223 | <field name="planned_hours">14.0</field> |
2224 | @@ -333,7 +326,6 @@ |
2225 | <field name="categ_ids" eval="[(6, 0, [ |
2226 | ref('project_category_04')])]"/> |
2227 | </record> |
2228 | - <function model="project.task" name="do_open" eval="[ref('project_task_21')], {'install_mode': True}"/> |
2229 | |
2230 | <record id="project_task_22" model="project.task"> |
2231 | <field name="planned_hours">12.0</field> |
2232 | @@ -367,7 +359,6 @@ |
2233 | <field name="categ_ids" eval="[(6, 0, [ |
2234 | ref('project_category_01')])]"/> |
2235 | </record> |
2236 | - <function model="project.task" name="do_open" eval="[ref('project_task_24')], {'install_mode': True}"/> |
2237 | |
2238 | <record id="project_task_25" model="project.task"> |
2239 | <field name="sequence">20</field> |
2240 | @@ -378,7 +369,6 @@ |
2241 | <field name="name">Data importation + Doc</field> |
2242 | <field name="stage_id" ref="project_tt_development"/> |
2243 | </record> |
2244 | - <function model="project.task" name="do_open" eval="[ref('project_task_25')], {'install_mode': True}"/> |
2245 | |
2246 | <record id="project_task_26" model="project.task"> |
2247 | <field name="sequence">20</field> |
2248 | |
2249 | === modified file 'project/project_view.xml' |
2250 | --- project/project_view.xml 2013-05-30 09:22:04 +0000 |
2251 | +++ project/project_view.xml 2013-06-05 13:32:29 +0000 |
2252 | @@ -21,10 +21,6 @@ |
2253 | <separator/> |
2254 | <filter icon="terp-mail-message-new" string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/> |
2255 | <separator/> |
2256 | - <filter name="draft" string="New" domain="[('state','=','draft')]" help="New Tasks" icon="terp-check"/> |
2257 | - <filter name="open" string="In Progress" domain="[('state','=','open')]" help="In Progress Tasks" icon="terp-camera_test"/> |
2258 | - <filter string="Pending" domain="[('state','=','pending')]" context="{'show_delegated':False}" help="Pending Tasks" icon="terp-gtk-media-pause"/> |
2259 | - <separator/> |
2260 | <filter name="My project" string="Project" domain="[('project_id.user_id','=',uid)]" help="My Projects" icon="terp-check"/> |
2261 | <separator/> |
2262 | <filter string="My Tasks" domain="[('user_id','=',uid)]" help="My Tasks" icon="terp-personal"/> |
2263 | @@ -34,6 +30,7 @@ |
2264 | help="Show only tasks having a deadline" icon="terp-gnome-cpu-frequency-applet+"/> |
2265 | <field name="project_id"/> |
2266 | <field name="user_id"/> |
2267 | + <field name="stage_id"/> |
2268 | <group expand="0" string="Group By..."> |
2269 | <filter string="Users" name="group_user_id" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> |
2270 | <filter string="Project" name="group_project_id" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/> |
2271 | @@ -68,7 +65,7 @@ |
2272 | <!-- Project --> |
2273 | <record id="edit_project" model="ir.ui.view"> |
2274 | <field name="name">project.project.form</field> |
2275 | - <field name="model">project.project</field> |
2276 | + <field name="model">project.project</field> |
2277 | <field name="arch" type="xml"> |
2278 | <form string="Project" version="7.0"> |
2279 | <header> |
2280 | @@ -365,24 +362,13 @@ |
2281 | <field name="arch" type="xml"> |
2282 | <form string="Project" version="7.0"> |
2283 | <header> |
2284 | - <!-- |
2285 | - <button name="do_open" string="Start Task" type="object" |
2286 | - states="draft,pending" class="oe_highlight"/> |
2287 | - <button name="do_draft" string="Draft" type="object" |
2288 | - states="cancel,done"/> |
2289 | - --> |
2290 | - <button name="project_task_reevaluate" string="Reactivate" type="object" |
2291 | - states="cancelled,done" context="{'button_reactivate':True}" groups="base.group_user"/> |
2292 | - <button name="action_close" string="Done" type="object" |
2293 | - states="draft,open,pending" groups="base.group_user"/> |
2294 | - <button name="do_cancel" string="Cancel Task" type="object" |
2295 | - states="draft,open,pending" groups="base.group_user"/> |
2296 | - <field name="stage_id" widget="statusbar" clickable="True"/> |
2297 | + <field name="stage_id" widget="statusbar" clickable="True" domain="[('project_ids', '=', project_id)]"/> |
2298 | </header> |
2299 | <sheet string="Task"> |
2300 | <h1> |
2301 | <field name="name" placeholder="Task summary..." class="oe_inline"/> |
2302 | <field name="kanban_state" invisible='1'/> |
2303 | + <field name="stage_sequence" invisible="1"/> |
2304 | <button name="set_kanban_state_done" help="In Progress" attrs="{'invisible': [('kanban_state', 'in', ['done','blocked'])]}" type="object" icon="gtk-normal" class="oe_link oe_right"/> |
2305 | <button name="set_kanban_state_blocked" help="Ready for Next Stage" attrs="{'invisible': [('kanban_state', 'in', ['normal','blocked'])]}" type="object" icon="gtk-yes" class="oe_link oe_right"/> |
2306 | <button name="set_kanban_state_normal" help="Blocked" attrs="{'invisible': [('kanban_state', 'in', ['done','normal'])]}" type="object" icon="gtk-no" class="oe_link oe_right"/> |
2307 | @@ -391,7 +377,8 @@ |
2308 | <group> |
2309 | <field name="project_id" on_change="onchange_project(project_id)" context="{'default_use_tasks':1}"/> |
2310 | <field name="user_id" |
2311 | - attrs="{'readonly':[('state','in',['done', 'cancelled'])]}" |
2312 | + attrs="{'readonly':[('stage_sequence','in',[7,8])]}" |
2313 | + on_change="onchange_user_assigned(user_id)" |
2314 | options='{"no_open": True}' |
2315 | context="{'default_groups_ref': ['base.group_user', 'project.group_project_user']}"/> |
2316 | <field name="planned_hours" widget="float_time" |
2317 | @@ -399,15 +386,15 @@ |
2318 | on_change="onchange_planned(planned_hours, effective_hours)"/> |
2319 | </group> |
2320 | <group> |
2321 | - <field name="date_deadline" attrs="{'readonly':[('state','in',['done', 'cancelled'])]}"/> |
2322 | + <field name="date_deadline" attrs="{'readonly':[('stage_sequence','in',[7,8])]}"/> |
2323 | <field name="categ_ids" widget="many2many_tags"/> |
2324 | <field name="progress" widget="progressbar" |
2325 | - groups="project.group_time_work_estimation_tasks" attrs="{'invisible':[('state','=','cancelled')]}"/> |
2326 | + groups="project.group_time_work_estimation_tasks" attrs="{'invisible':[('stage_sequence','=',8)]}"/> |
2327 | </group> |
2328 | </group> |
2329 | <notebook> |
2330 | <page string="Description"> |
2331 | - <field name="description" attrs="{'readonly':[('state','=','done')]}" placeholder="Add a Description..."/> |
2332 | + <field name="description" attrs="{'readonly':[('stage_sequence','=',7)]}" placeholder="Add a Description..."/> |
2333 | <field name="work_ids" groups="project.group_tasks_work_on_tasks"> |
2334 | <tree string="Task Work" editable="top"> |
2335 | <field name="name"/> |
2336 | @@ -421,7 +408,7 @@ |
2337 | <field name="effective_hours" widget="float_time"/> |
2338 | <label for="remaining_hours" string="Remaining" groups="project.group_time_work_estimation_tasks"/> |
2339 | <div> |
2340 | - <field name="remaining_hours" widget="float_time" attrs="{'readonly':[('state','in',('done','cancelled'))]}" groups="project.group_time_work_estimation_tasks"/> |
2341 | + <field name="remaining_hours" widget="float_time" attrs="{'readonly':[('stage_sequence','in',(7,8))]}" groups="project.group_time_work_estimation_tasks"/> |
2342 | </div> |
2343 | <field name="total_hours" widget="float_time" class="oe_subtotal_footer_separator"/> |
2344 | </group> |
2345 | @@ -430,7 +417,7 @@ |
2346 | </page> |
2347 | <page string="Delegation" groups="project.group_delegate_task"> |
2348 | <button name="%(action_project_task_delegate)d" string="Delegate" type="action" |
2349 | - states="pending,open,draft" groups="project.group_delegate_task"/> |
2350 | + attrs="{'invisible': [('stage_sequence', 'in', [7,8])]}" groups="project.group_delegate_task"/> |
2351 | <separator string="Parent Tasks"/> |
2352 | <field name="parent_ids"/> |
2353 | <separator string="Delegated tasks"/> |
2354 | @@ -439,7 +426,7 @@ |
2355 | <field name="name"/> |
2356 | <field name="user_id"/> |
2357 | <field name="stage_id"/> |
2358 | - <field name="state" invisible="1"/> |
2359 | + <field name="stage_sequence" invisible="1"/> |
2360 | <field name="effective_hours" widget="float_time"/> |
2361 | <field name="progress" widget="progressbar"/> |
2362 | <field name="remaining_hours" widget="float_time"/> |
2363 | @@ -447,12 +434,11 @@ |
2364 | </tree> |
2365 | </field> |
2366 | </page> |
2367 | - <page string="Extra Info" attrs="{'readonly':[('state','=','done')]}"> |
2368 | + <page string="Extra Info" attrs="{'readonly':[('stage_sequence','=',7)]}"> |
2369 | <group col="4"> |
2370 | <field name="priority" groups="base.group_user"/> |
2371 | <field name="sequence"/> |
2372 | <field name="partner_id"/> |
2373 | - <field name="state" invisible="1"/> |
2374 | <field name="company_id" groups="base.group_multi_company" widget="selection"/> |
2375 | </group> |
2376 | <group> |
2377 | @@ -487,12 +473,12 @@ |
2378 | <field name="user_email"/> |
2379 | <field name="description"/> |
2380 | <field name="sequence"/> |
2381 | - <field name="state" groups="base.group_no_one"/> |
2382 | <field name="kanban_state"/> |
2383 | <field name="remaining_hours" sum="Remaining Time" groups="project.group_time_work_estimation_tasks"/> |
2384 | <field name="date_deadline"/> |
2385 | <field name="message_summary"/> |
2386 | <field name="categ_ids"/> |
2387 | + <field name="stage_sequence" invisible="1"/> |
2388 | <templates> |
2389 | <t t-name="kanban-box"> |
2390 | <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click"> |
2391 | @@ -507,7 +493,7 @@ |
2392 | <li><a name="set_remaining_time_2" type="object" class="oe_kanban_button">2</a></li> |
2393 | <li><a name="set_remaining_time_5" type="object" class="oe_kanban_button">5</a></li> |
2394 | <li><a name="set_remaining_time_10" type="object" class="oe_kanban_button">10</a></li> |
2395 | - <li><a name="do_open" states="draft" string="Validate planned time" type="object" class="oe_kanban_button oe_kanban_button_active">!</a></li> |
2396 | + <li><a name="do_open" attrs="{'invisible': [('stage_sequence', '!=', 1)]}" string="Validate planned time" type="object" class="oe_kanban_button oe_kanban_button_active">!</a></li> |
2397 | </ul> |
2398 | </li> |
2399 | <br/> |
2400 | @@ -556,7 +542,7 @@ |
2401 | <field name="model">project.task</field> |
2402 | <field eval="2" name="priority"/> |
2403 | <field name="arch" type="xml"> |
2404 | - <tree fonts="bold:message_unread==True" colors="grey:state in ('cancelled','done');blue:state == 'pending';red:date_deadline and (date_deadline<current_date) and (state in ('draft','pending','open'))" string="Tasks"> |
2405 | + <tree fonts="bold:message_unread==True" string="Tasks"> |
2406 | <field name="message_unread" invisible="1"/> |
2407 | <field name="sequence" invisible="not context.get('seq_visible', False)"/> |
2408 | <field name="name"/> |
2409 | @@ -569,7 +555,6 @@ |
2410 | <field name="remaining_hours" widget="float_time" sum="Remaining Hours" on_change="onchange_remaining(remaining_hours,planned_hours)" invisible="context.get('set_visible',False)" groups="project.group_time_work_estimation_tasks"/> |
2411 | <field name="date_deadline" invisible="context.get('deadline_visible',True)"/> |
2412 | <field name="stage_id" invisible="context.get('set_visible',False)"/> |
2413 | - <field name="state" invisible="1"/> |
2414 | <field name="date_start" groups="base.group_no_one"/> |
2415 | <field name="date_end" groups="base.group_no_one"/> |
2416 | <field name="progress" widget="progressbar" invisible="context.get('set_visible',False)"/> |
2417 | @@ -655,7 +640,7 @@ |
2418 | <field name="res_model">project.task</field> |
2419 | <field name="view_type">form</field> |
2420 | <field name="view_mode">tree,form,calendar,graph,kanban</field> |
2421 | - <field name="domain">[('date_deadline','<',time.strftime('%Y-%m-%d')),('state','in',('draft','pending','open'))]</field> |
2422 | + <field name="domain">[('date_deadline','<',time.strftime('%Y-%m-%d')),('stage_sequence','not in',(7,8))]</field> |
2423 | <field name="filter" eval="True"/> |
2424 | <field name="search_view_id" ref="view_task_search_form"/> |
2425 | </record> |
2426 | @@ -700,7 +685,6 @@ |
2427 | <field name="case_default"/> |
2428 | </group> |
2429 | <group> |
2430 | - <field name="state"/> |
2431 | <field name="sequence"/> |
2432 | <field name="fold"/> |
2433 | </group> |
2434 | @@ -717,7 +701,6 @@ |
2435 | <tree string="Task Stage"> |
2436 | <field name="sequence" widget="handle"/> |
2437 | <field name="name"/> |
2438 | - <field name="state"/> |
2439 | </tree> |
2440 | </field> |
2441 | </record> |
2442 | @@ -761,7 +744,7 @@ |
2443 | </record> |
2444 | |
2445 | <!-- User Form --> |
2446 | - <act_window context="{'search_default_user_id': [active_id], 'default_user_id': active_id}" domain="[('state', '<>', 'cancelled'),('state', '<>', 'done')]" id="act_res_users_2_project_task_opened" name="Assigned Tasks" res_model="project.task" src_model="res.users" view_mode="tree,form,gantt,calendar,graph" view_type="form"/> |
2447 | + <act_window context="{'search_default_user_id': [active_id], 'default_user_id': active_id}" domain="[('stage_sequence', '<>', 7),('stage_sequence', '<>', 8)]" id="act_res_users_2_project_task_opened" name="Assigned Tasks" res_model="project.task" src_model="res.users" view_mode="tree,form,gantt,calendar,graph" view_type="form"/> |
2448 | |
2449 | <!-- Tags --> |
2450 | <record model="ir.ui.view" id="project_category_search_view"> |
2451 | |
2452 | === modified file 'project/report/project_report.py' |
2453 | --- project/report/project_report.py 2013-04-15 10:23:49 +0000 |
2454 | +++ project/report/project_report.py 2013-06-05 13:32:29 +0000 |
2455 | @@ -51,7 +51,6 @@ |
2456 | 'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), |
2457 | ('0','Very urgent')], 'Priority', readonly=True), |
2458 | 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True), |
2459 | - 'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')],'Status', readonly=True), |
2460 | 'company_id': fields.many2one('res.company', 'Company', readonly=True), |
2461 | 'partner_id': fields.many2one('res.partner', 'Contact', readonly=True), |
2462 | } |
2463 | @@ -75,7 +74,6 @@ |
2464 | t.user_id, |
2465 | progress as progress, |
2466 | t.project_id, |
2467 | - t.state, |
2468 | t.effective_hours as hours_effective, |
2469 | t.priority, |
2470 | t.name as name, |
2471 | @@ -108,7 +106,6 @@ |
2472 | date_deadline, |
2473 | t.user_id, |
2474 | t.project_id, |
2475 | - t.state, |
2476 | t.priority, |
2477 | name, |
2478 | t.company_id, |
2479 | |
2480 | === modified file 'project/report/project_report_view.xml' |
2481 | --- project/report/project_report_view.xml 2013-04-20 02:26:42 +0000 |
2482 | +++ project/report/project_report_view.xml 2013-06-05 13:32:29 +0000 |
2483 | @@ -15,7 +15,6 @@ |
2484 | <field name="project_id" invisible="1"/> |
2485 | <field name="user_id" invisible="1"/> |
2486 | <field name="date_deadline" invisible="1"/> |
2487 | - <field name="state" invisible="1"/> |
2488 | <field name="date_start" invisible="1"/> |
2489 | <field name="date_end" invisible="1"/> |
2490 | <field name="company_id" invisible="1" groups="base.group_multi_company"/> |
2491 | @@ -44,7 +43,6 @@ |
2492 | <field name="arch" type="xml"> |
2493 | <graph string="Tasks Analysis" type="bar"> |
2494 | <field name="name"/> |
2495 | - <field name="state" group="True"/> |
2496 | <field name="no_of_days" operator="+"/> |
2497 | </graph> |
2498 | </field> |
2499 | @@ -58,11 +56,6 @@ |
2500 | <field name="date_start"/> |
2501 | <field name="date_end"/> |
2502 | <field name="date_deadline"/> |
2503 | - <filter string="New" icon="terp-document-new" domain="[('state','=','draft')]" help = "New tasks"/> |
2504 | - <filter string="In progress" icon="terp-check" domain="[('state', '=' ,'open')]" help = "In progress tasks"/> |
2505 | - <filter string="Pending" icon="terp-gtk-media-pause" domain="[('state','=','pending')]" help = "Pending tasks"/> |
2506 | - <filter string="Done" icon="terp-dialog-close" name="done" domain="[('state','=','done')]"/> |
2507 | - <separator/> |
2508 | <filter icon="terp-folder-violet" string="My Projects" help="My Projects" domain="[('project_id.user_id','=',uid)]"/> |
2509 | <separator/> |
2510 | <filter icon="terp-personal" string="My Task" help = "My tasks" domain="[('user_id','=',uid)]" /> |
2511 | |
2512 | === modified file 'project/res_partner_view.xml' |
2513 | --- project/res_partner_view.xml 2012-11-29 22:26:45 +0000 |
2514 | +++ project/res_partner_view.xml 2013-06-05 13:32:29 +0000 |
2515 | @@ -18,9 +18,6 @@ |
2516 | <field name="name"/> |
2517 | <field name="user_id"/> |
2518 | <field name="date_deadline"/> |
2519 | - <field name="state" invisible="1"/> |
2520 | - <button name="do_open" states="pending,draft,done,cancelled" string="Start Task" type="object" icon="gtk-media-play" help="For changing to open state" invisible="context.get('set_visible',False)"/> |
2521 | - <button name="action_close" states="draft,pending,open" string="Done" type="object" icon="terp-dialog-close" help="For changing to done state"/> |
2522 | </tree> |
2523 | </field> |
2524 | </group> |
2525 | |
2526 | === modified file 'project/test/task_process.yml' |
2527 | --- project/test/task_process.yml 2012-11-29 22:26:45 +0000 |
2528 | +++ project/test/task_process.yml 2013-06-05 13:32:29 +0000 |
2529 | @@ -2,14 +2,9 @@ |
2530 | I put task in pending due to specification is not clear. |
2531 | - |
2532 | !python {model: project.task}: | |
2533 | - self.do_pending(cr, uid, [ref("project_task_1")]) |
2534 | + self.write(cr, uid, [ref("project_task_1")],{'stage_sequence' : 2}) |
2535 | context.update({"active_id": ref("project_task_1")}) |
2536 | - |
2537 | - I check state of task after put in pending. |
2538 | -- |
2539 | - !assert {model: project.task, id: project_task_1, severity: error, string: task should be in pending state}: |
2540 | - - state == "pending" |
2541 | -- |
2542 | !record {model: project.task.delegate, id: delegate_id}: |
2543 | user_id: base.user_demo |
2544 | planned_hours: 12.0 |
2545 | @@ -20,57 +15,12 @@ |
2546 | !python {model: project.task.delegate}: | |
2547 | self.delegate(cr, uid, [ref("delegate_id")], {"active_id": ref("project_task_1")}) |
2548 | - |
2549 | - I check delegated task details. |
2550 | -- |
2551 | - !python {model: project.task}: | |
2552 | - task = self.browse(cr, uid, ref("project_task_1"), context=context) |
2553 | - assert task.planned_hours == 2.0, "Planning hours is not correct after delegated." |
2554 | - assert task.state == "pending", "Task should be in Pending after delegated." |
2555 | -- |
2556 | I re-open the task. |
2557 | - |
2558 | !python {model: project.task}: | |
2559 | - self.do_reopen(cr, uid, [ref("project_task_1")]) |
2560 | -- |
2561 | - I check reopened task details. |
2562 | -- |
2563 | - !assert {model: project.task, id: project_task_1, severity: error, string: task should be open.}: |
2564 | - - state == "open" |
2565 | + self.write(cr, uid, [ref("project_task_1")],{'stage_sequence' : 3}) |
2566 | - |
2567 | I change the stage of task to next stage. |
2568 | - |
2569 | !python {model: project.task}: | |
2570 | self.stage_next(cr, uid, [ref("project_task_1")]) |
2571 | -- |
2572 | - !record {model: project.task.reevaluate, id: reevaluate_id}: |
2573 | - remaining_hours : 120 |
2574 | -- |
2575 | - I reevaluate task with remaining hours. |
2576 | -- |
2577 | - !python {model: project.task.reevaluate}: | |
2578 | - self.compute_hours(cr, uid, [ref("reevaluate_id")], {"active_id": ref("project_task_1")}) |
2579 | -- |
2580 | - I check remaining hours after reevaluated task. |
2581 | -- |
2582 | - !assert {model: project.task, id: project_task_1, severity: error, string: task should be reevaluated}: |
2583 | - - remaining_hours == 120.0 |
2584 | -- |
2585 | - I close the task. |
2586 | -- |
2587 | - !python {model: project.task}: | |
2588 | - self.action_close(cr, uid, [ref("project_task_1")]) |
2589 | -- |
2590 | - I check state after closed. |
2591 | -- |
2592 | - !assert {model: project.task, id: project_task_1, severity: error, string: task is in open state}: |
2593 | - - state == "done" |
2594 | -- |
2595 | - I change the stage of task to previous stage. |
2596 | -- |
2597 | - !python {model: project.task}: | |
2598 | - self.stage_previous(cr, uid, [ref("project_task_1")]) |
2599 | -- |
2600 | - I cancel Task. |
2601 | -- |
2602 | - !python {model: project.task}: | |
2603 | - self.do_cancel(cr, uid, [ref("project_task_2")]) |
2604 | |
2605 | === modified file 'project/wizard/__init__.py' |
2606 | --- project/wizard/__init__.py 2012-06-15 12:59:18 +0000 |
2607 | +++ project/wizard/__init__.py 2013-06-05 13:32:29 +0000 |
2608 | @@ -20,7 +20,6 @@ |
2609 | ############################################################################## |
2610 | |
2611 | import project_task_delegate |
2612 | -import project_task_reevaluate |
2613 | |
2614 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2615 | |
2616 | |
2617 | === removed file 'project/wizard/project_task_reevaluate.py' |
2618 | --- project/wizard/project_task_reevaluate.py 2013-04-15 10:23:49 +0000 |
2619 | +++ project/wizard/project_task_reevaluate.py 1970-01-01 00:00:00 +0000 |
2620 | @@ -1,84 +0,0 @@ |
2621 | -# -*- coding: utf-8 -*- |
2622 | -############################################################################## |
2623 | -# |
2624 | -# OpenERP, Open Source Management Solution |
2625 | -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
2626 | -# |
2627 | -# This program is free software: you can redistribute it and/or modify |
2628 | -# it under the terms of the GNU Affero General Public License as |
2629 | -# published by the Free Software Foundation, either version 3 of the |
2630 | -# License, or (at your option) any later version. |
2631 | -# |
2632 | -# This program is distributed in the hope that it will be useful, |
2633 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2634 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2635 | -# GNU Affero General Public License for more details. |
2636 | -# |
2637 | -# You should have received a copy of the GNU Affero General Public License |
2638 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2639 | -# |
2640 | -############################################################################## |
2641 | - |
2642 | -from lxml import etree |
2643 | -from openerp.osv import fields, osv |
2644 | -from openerp.tools.translate import _ |
2645 | - |
2646 | -class project_task_reevaluate(osv.osv_memory): |
2647 | - _name = 'project.task.reevaluate' |
2648 | - |
2649 | - def _get_remaining(self, cr, uid, context=None): |
2650 | - if context is None: |
2651 | - context = {} |
2652 | - active_id = context.get('active_id', False) |
2653 | - res = False |
2654 | - if active_id: |
2655 | - res = self.pool.get('project.task').browse(cr, uid, active_id, context=context).remaining_hours |
2656 | - return res |
2657 | - |
2658 | - _columns = { |
2659 | - 'remaining_hours' : fields.float('Remaining Hours', digits=(16,2), help="Put here the remaining hours required to close the task."), |
2660 | - } |
2661 | - |
2662 | - _defaults = { |
2663 | - 'remaining_hours': _get_remaining, |
2664 | - } |
2665 | - |
2666 | - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): |
2667 | - res = super(project_task_reevaluate, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu=submenu) |
2668 | - users_pool = self.pool.get('res.users') |
2669 | - time_mode = users_pool.browse(cr, uid, uid, context).company_id.project_time_mode_id |
2670 | - time_mode_name = time_mode and time_mode.name or 'Hours' |
2671 | - if time_mode_name in ['Hours','Hour']: |
2672 | - return res |
2673 | - |
2674 | - eview = etree.fromstring(res['arch']) |
2675 | - |
2676 | - def _check_rec(eview): |
2677 | - if eview.attrib.get('widget','') == 'float_time': |
2678 | - eview.set('widget','float') |
2679 | - for child in eview: |
2680 | - _check_rec(child) |
2681 | - return True |
2682 | - |
2683 | - _check_rec(eview) |
2684 | - |
2685 | - res['arch'] = etree.tostring(eview) |
2686 | - |
2687 | - for field in res['fields']: |
2688 | - if 'Hours' in res['fields'][field]['string']: |
2689 | - res['fields'][field]['string'] = res['fields'][field]['string'].replace('Hours',time_mode_name) |
2690 | - return res |
2691 | - |
2692 | - def compute_hours(self, cr, uid, ids, context=None): |
2693 | - if context is None: |
2694 | - context = {} |
2695 | - data = self.browse(cr, uid, ids, context=context)[0] |
2696 | - task_id = context.get('active_id') |
2697 | - if task_id: |
2698 | - task_pool = self.pool.get('project.task') |
2699 | - task_pool.write(cr, uid, task_id, {'remaining_hours': data.remaining_hours}) |
2700 | - if context.get('button_reactivate'): |
2701 | - task_pool.do_reopen(cr, uid, [task_id], context=context) |
2702 | - return {'type': 'ir.actions.act_window_close'} |
2703 | - |
2704 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2705 | |
2706 | === removed file 'project/wizard/project_task_reevaluate_view.xml' |
2707 | --- project/wizard/project_task_reevaluate_view.xml 2012-11-29 22:26:45 +0000 |
2708 | +++ project/wizard/project_task_reevaluate_view.xml 1970-01-01 00:00:00 +0000 |
2709 | @@ -1,32 +0,0 @@ |
2710 | -<?xml version="1.0" encoding="utf-8"?> |
2711 | -<openerp> |
2712 | - <data> |
2713 | - |
2714 | - <record id="view_project_task_reevaluate" model="ir.ui.view"> |
2715 | - <field name="name">Re-evaluate Task</field> |
2716 | - <field name="model">project.task.reevaluate</field> |
2717 | - <field name="arch" type="xml"> |
2718 | - <form string="Reevaluate Task" version="7.0"> |
2719 | - <separator string="Reevaluation Task"/> |
2720 | - <group> |
2721 | - <field name="remaining_hours" widget="float_time"/> |
2722 | - </group> |
2723 | - <footer> |
2724 | - <button name="compute_hours" string="_Evaluate" type="object" default_focus="1" class="oe_highlight"/> |
2725 | - or |
2726 | - <button string="Cancel" class="oe_link" special="cancel" /> |
2727 | - </footer> |
2728 | - </form> |
2729 | - </field> |
2730 | - </record> |
2731 | - |
2732 | - <record id="action_project_task_reevaluate" model="ir.actions.act_window"> |
2733 | - <field name="name">Re-evaluate Task</field> |
2734 | - <field name="type">ir.actions.act_window</field> |
2735 | - <field name="res_model">project.task.reevaluate</field> |
2736 | - <field name="view_type">form</field> |
2737 | - <field name="view_mode">form</field> |
2738 | - <field name="target">new</field> |
2739 | - </record> |
2740 | - </data> |
2741 | -</openerp> |
2742 | |
2743 | === modified file 'project_gtd/project_gtd_view.xml' |
2744 | --- project_gtd/project_gtd_view.xml 2013-04-25 14:38:07 +0000 |
2745 | +++ project_gtd/project_gtd_view.xml 2013-06-05 13:32:29 +0000 |
2746 | @@ -79,7 +79,6 @@ |
2747 | <field name="remaining_hours" position="after"> |
2748 | <field string="Timeframe" name="timebox_id" invisible=" not context.get('gtd', False)"/> |
2749 | <field name="context_id" invisible="not context.get('context_show', False)" widget="selection"/> |
2750 | - <button name="do_reopen" states="done,cancelled" string="Reactivate" type="object" icon="gtk-convert" help="For reopening the tasks" invisible="not context.get('set_visible',False)"/> |
2751 | </field> |
2752 | </field> |
2753 | </record> |
2754 | @@ -103,9 +102,6 @@ |
2755 | <field name="arch" type="xml"> |
2756 | <search string="My Tasks"> |
2757 | <field name="name" string="My Tasks"/> |
2758 | - <filter name="open" string="In Progress" domain="[('state','in',('draft','open'))]" help="In Progress and draft tasks" icon="terp-camera_test"/> |
2759 | - <filter string="Pending" domain="[('state','=','pending')]" context="{'show_delegated':False}" help="Pending Tasks" icon="terp-gtk-media-pause"/> |
2760 | - <separator/> |
2761 | <filter name="message_unread" string="Unread Messages" domain="[('message_unread','=',True)]"/> |
2762 | <separator/> |
2763 | <filter string="Inbox" domain="[('timebox_id','=', False)]" help="Tasks having no timebox assigned yet"/> |
2764 | |
2765 | === modified file 'project_gtd/wizard/project_gtd_empty.py' |
2766 | --- project_gtd/wizard/project_gtd_empty.py 2013-04-15 10:23:49 +0000 |
2767 | +++ project_gtd/wizard/project_gtd_empty.py 2013-06-05 13:32:29 +0000 |
2768 | @@ -52,7 +52,7 @@ |
2769 | raise osv.except_osv(_('Error!'), _('No timebox child of this one !')) |
2770 | tids = obj_task.search(cr, uid, [('timebox_id', '=', context['active_id'])]) |
2771 | for task in obj_task.browse(cr, uid, tids, context): |
2772 | - if (task.state in ('cancel','done')) or (task.user_id.id <> uid): |
2773 | + if (task.stage_sequence in (7,8)) or (task.user_id.id <> uid): |
2774 | close.append(task.id) |
2775 | else: |
2776 | up.append(task.id) |
2777 | |
2778 | === modified file 'project_issue/__openerp__.py' |
2779 | --- project_issue/__openerp__.py 2012-11-29 22:26:45 +0000 |
2780 | +++ project_issue/__openerp__.py 2013-06-05 13:32:29 +0000 |
2781 | @@ -55,7 +55,6 @@ |
2782 | 'test': [ |
2783 | 'test/subscribe_issue.yml', |
2784 | 'test/issue_process.yml', |
2785 | - 'test/cancel_issue.yml', |
2786 | 'test/issue_demo.yml' |
2787 | ], |
2788 | 'installable': True, |
2789 | |
2790 | === modified file 'project_issue/board_project_issue_view.xml' |
2791 | --- project_issue/board_project_issue_view.xml 2012-11-29 22:26:45 +0000 |
2792 | +++ project_issue/board_project_issue_view.xml 2013-06-05 13:32:29 +0000 |
2793 | @@ -6,7 +6,7 @@ |
2794 | <field name="name">Project Issue Board Tree</field> |
2795 | <field name="model">project.issue</field> |
2796 | <field name="arch" type="xml"> |
2797 | - <tree string="Issue Tracker Tree" colors="black:state=='open';blue:state=='pending';grey:state in ('cancel', 'done')"> |
2798 | + <tree string="Issue Tracker Tree"> |
2799 | <field name="id"/> |
2800 | <field name="create_date"/> |
2801 | <field name="name"/> |
2802 | @@ -16,7 +16,6 @@ |
2803 | <field name="version_id" widget="selection"/> |
2804 | <field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/> |
2805 | <field name="stage_id" widget="selection" readonly="1"/> |
2806 | - <field name="state" invisible="1"/> |
2807 | <field name="categ_ids" invisible="1"/> |
2808 | <field name="task_id" invisible="1"/> |
2809 | </tree> |
2810 | @@ -28,7 +27,7 @@ |
2811 | <field name="res_model">project.issue</field> |
2812 | <field name="view_type">form</field> |
2813 | <field name="view_mode">tree,form</field> |
2814 | - <field name="domain">[('state','not in',('cancel','done')),('user_id','=',uid)]</field> |
2815 | + <field name="domain">[('stage_sequence','not in',(7,8)),('user_id','=',uid)]</field> |
2816 | <field name="view_id" ref="project_issue_board_tree_view"/> |
2817 | </record> |
2818 | |
2819 | |
2820 | === modified file 'project_issue/project_issue.py' |
2821 | --- project_issue/project_issue.py 2013-05-21 13:38:07 +0000 |
2822 | +++ project_issue/project_issue.py 2013-06-05 13:32:29 +0000 |
2823 | @@ -48,13 +48,8 @@ |
2824 | _inherit = ['mail.thread', 'ir.needaction_mixin'] |
2825 | |
2826 | _track = { |
2827 | - 'state': { |
2828 | - 'project_issue.mt_issue_new': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'new', |
2829 | - 'project_issue.mt_issue_closed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', |
2830 | - 'project_issue.mt_issue_started': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open', |
2831 | - }, |
2832 | 'stage_id': { |
2833 | - 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'done', 'open'], |
2834 | + 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None: obj['stage_id'] != False, |
2835 | }, |
2836 | 'kanban_state': { |
2837 | 'project_issue.mt_issue_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked', |
2838 | @@ -78,7 +73,7 @@ |
2839 | def _get_default_stage_id(self, cr, uid, context=None): |
2840 | """ Gives default stage_id """ |
2841 | project_id = self._get_default_project_id(cr, uid, context=context) |
2842 | - return self.stage_find(cr, uid, [], project_id, [('state', '=', 'draft')], context=context) |
2843 | + return self.stage_find(cr, uid, [], project_id, [], context=context) |
2844 | |
2845 | def _resolve_project_id_from_context(self, cr, uid, context=None): |
2846 | """ Returns ID of project based on the value of 'default_project_id' |
2847 | @@ -244,13 +239,6 @@ |
2848 | 'partner_id': fields.many2one('res.partner', 'Contact', select=1), |
2849 | 'company_id': fields.many2one('res.company', 'Company'), |
2850 | 'description': fields.text('Private Note'), |
2851 | - 'state': fields.related('stage_id', 'state', type="selection", store=True, |
2852 | - selection=_TASK_STATE, string="Status", readonly=True, |
2853 | - help='The status is set to \'Draft\', when a case is created.\ |
2854 | - If the case is in progress the status is set to \'Open\'.\ |
2855 | - When the case is over, the status is set to \'Done\'.\ |
2856 | - If the case needs to be reviewed then the status is \ |
2857 | - set to \'Pending\'.'), |
2858 | 'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State', |
2859 | track_visibility='onchange', |
2860 | help="A Issue's kanban state indicates special situations affecting it:\n" |
2861 | @@ -269,8 +257,9 @@ |
2862 | 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), |
2863 | 'version_id': fields.many2one('project.issue.version', 'Version'), |
2864 | 'stage_id': fields.many2one ('project.task.type', 'Stage', |
2865 | - track_visibility='onchange', |
2866 | - domain="[('project_ids', '=', project_id)]"), |
2867 | + track_visibility='onchange',), |
2868 | + 'stage_sequence': fields.related('stage_id', 'sequence', type="integer", string= |
2869 | +"Stage Sequence"), |
2870 | 'project_id':fields.many2one('project.project', 'Project', track_visibility='onchange'), |
2871 | 'duration': fields.float('Duration'), |
2872 | 'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"), |
2873 | @@ -391,13 +380,13 @@ |
2874 | #Update last action date every time the user changes the stage |
2875 | if 'stage_id' in vals: |
2876 | vals['date_action_last'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT) |
2877 | - state = self.pool.get('project.task.type').browse(cr, uid, vals['stage_id'], context=context).state |
2878 | + sequence = self.pool.get('project.task.type').browse(cr, uid, vals['stage_id'], context=context).sequence |
2879 | for issue in self.browse(cr, uid, ids, context=context): |
2880 | # Change from draft to not draft EXCEPT cancelled: The issue has been opened -> set the opening date |
2881 | - if issue.state == 'draft' and state not in ('draft', 'cancelled'): |
2882 | + if issue.stage_sequence == 1 and sequence not in (1,8): |
2883 | vals['date_open'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT) |
2884 | # Change from not done to done: The issue has been closed -> set the closing date |
2885 | - if issue.state != 'done' and state == 'done': |
2886 | + if issue.stage_sequence not in (7,8) and sequence == 7: |
2887 | vals['date_closed'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT) |
2888 | |
2889 | return super(project_issue, self).write(cr, uid, ids, vals, context) |
2890 | @@ -579,7 +568,7 @@ |
2891 | res = dict.fromkeys(ids, 0) |
2892 | issue_ids = self.pool.get('project.issue').search(cr, uid, [('project_id', 'in', ids)]) |
2893 | for issue in self.pool.get('project.issue').browse(cr, uid, issue_ids, context): |
2894 | - if issue.state not in ('done', 'cancelled'): |
2895 | + if issue.stage_sequence not in (7,8): |
2896 | res[issue.project_id.id] += 1 |
2897 | return res |
2898 | |
2899 | |
2900 | === modified file 'project_issue/project_issue_view.xml' |
2901 | --- project_issue/project_issue_view.xml 2013-04-22 15:34:49 +0000 |
2902 | +++ project_issue/project_issue_view.xml 2013-06-05 13:32:29 +0000 |
2903 | @@ -48,13 +48,7 @@ |
2904 | <field name="arch" type="xml"> |
2905 | <form string="Issue" version="7.0"> |
2906 | <header> |
2907 | - <button name="case_close" string="Done" type="object" |
2908 | - states="open" groups="base.group_user"/> |
2909 | - <button name="case_close" string="Done" type="object" |
2910 | - states="draft,pending" groups="base.group_user"/> |
2911 | - <button name="case_cancel" string="Cancel Issue" type="object" |
2912 | - states="draft,open,pending" groups="base.group_user"/> |
2913 | - <field name="stage_id" widget="statusbar" clickable="True"/> |
2914 | + <field name="stage_id" widget="statusbar" clickable="True" domain="[('project_ids', '=', project_id)]"/> |
2915 | </header> |
2916 | <sheet string="Issue"> |
2917 | <label for="name" class="oe_edit_only"/> |
2918 | @@ -76,7 +70,7 @@ |
2919 | <label for="project_id" groups="base.group_user"/> |
2920 | <div groups="base.group_user"> |
2921 | <field name="project_id" on_change="on_change_project(project_id)" class="oe_inline" context="{'default_use_issues':1}"/> |
2922 | - <button name="case_escalate" string="⇒ Escalate" type="object" states="draft,open,pending" class="oe_link"/> |
2923 | + <button name="case_escalate" string="⇒ Escalate" type="object" attrs="{'invisible': [('stage_sequence', 'in', [7,8])]}" class="oe_link"/> |
2924 | </div> |
2925 | </group> |
2926 | <group> |
2927 | @@ -105,7 +99,7 @@ |
2928 | </group> |
2929 | <group string="Status" groups="base.group_no_one"> |
2930 | <field name="active"/> |
2931 | - <field name="state" string="Status"/> |
2932 | + <field name="stage_sequence" invisible="1"/> |
2933 | </group> |
2934 | </page> |
2935 | </notebook> |
2936 | @@ -122,7 +116,7 @@ |
2937 | <field name="name">Project Issue Tracker Tree</field> |
2938 | <field name="model">project.issue</field> |
2939 | <field name="arch" type="xml"> |
2940 | - <tree string="Issue Tracker Tree" fonts="bold:message_unread==True" colors="black:state=='open';blue:state=='pending';grey:state in ('cancel', 'done')"> |
2941 | + <tree string="Issue Tracker Tree" fonts="bold:message_unread==True"> |
2942 | <field name="message_unread" invisible="1"/> |
2943 | <field name="id"/> |
2944 | <field name="name"/> |
2945 | @@ -134,7 +128,6 @@ |
2946 | <field name="user_id"/> |
2947 | <field name="progress" widget="progressbar" attrs="{'invisible':[('task_id','=',False)]}"/> |
2948 | <field name="stage_id" widget="selection" readonly="1"/> |
2949 | - <field name="state" invisible="1"/> |
2950 | <field name="categ_ids" invisible="1"/> |
2951 | <field name="task_id" invisible="1"/> |
2952 | </tree> |
2953 | @@ -150,15 +143,13 @@ |
2954 | <field name="id"/> |
2955 | <filter icon="terp-mail-message-new" string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/> |
2956 | <separator/> |
2957 | - <filter string="New" icon="terp-document-new" domain="[('state','=','draft')]" help="New Issues"/> |
2958 | - <filter string="To Do" domain="[('state','=','open')]" help="To Do Issues" icon="terp-check"/> |
2959 | - <separator/> |
2960 | <filter string="Unassigned Issues" domain="[('user_id','=',False)]" help="Unassigned Issues" icon="terp-personal-"/> |
2961 | <separator/> |
2962 | <field name="user_id"/> |
2963 | <field name="project_id"/> |
2964 | <field name="categ_ids"/> |
2965 | <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/> |
2966 | + <field name="stage_id"/> |
2967 | <group expand="0" string="Group By..." > |
2968 | <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> |
2969 | <filter string="Contact" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> |
2970 | @@ -268,7 +259,7 @@ |
2971 | <field name="name">Project Issue- Feature Tracker Tree</field> |
2972 | <field name="model">project.issue</field> |
2973 | <field name="arch" type="xml"> |
2974 | - <tree string="Feature Tracker Tree" fonts="bold:message_unread==True" colors="red:state=='open';black:state in ('draft', 'cancel','done','pending')"> |
2975 | + <tree string="Feature Tracker Tree" fonts="bold:message_unread==True"> |
2976 | <field name="id"/> |
2977 | <field name="message_unread" invisible="1"/> |
2978 | <field name="name" string="Feature description"/> |
2979 | @@ -277,7 +268,6 @@ |
2980 | <field name="version_id"/> |
2981 | <field name="user_id"/> |
2982 | <field name="stage_id" widget="selection" readonly="1"/> |
2983 | - <field name="state" groups="base.group_no_one"/> |
2984 | </tree> |
2985 | </field> |
2986 | </record> |
2987 | @@ -289,9 +279,6 @@ |
2988 | <search string="Feature Tracker Search"> |
2989 | <field name="name" string="Feature description"/> |
2990 | <field name="date"/> |
2991 | - <field name="state" groups="base.group_no_one"/> |
2992 | - <filter icon="terp-check" domain="[('state','in',('open','draft'))]" help="Current Features" name="current_feature"/> |
2993 | - <filter icon="terp-camera_test" domain="[('state','=','open')]" help="Open Features"/> |
2994 | <field name="user_id"/> |
2995 | <field name="project_id" string="Project"/> |
2996 | </search> |
2997 | |
2998 | === modified file 'project_issue/report/project_issue_report.py' |
2999 | --- project_issue/report/project_issue_report.py 2013-04-15 10:23:49 +0000 |
3000 | +++ project_issue/report/project_issue_report.py 2013-06-05 13:32:29 +0000 |
3001 | @@ -24,13 +24,6 @@ |
3002 | from openerp import tools |
3003 | from openerp.addons.crm import crm |
3004 | |
3005 | -AVAILABLE_STATES = [ |
3006 | - ('draft','Draft'), |
3007 | - ('open','Open'), |
3008 | - ('cancel', 'Cancelled'), |
3009 | - ('done', 'Closed'), |
3010 | - ('pending','Pending') |
3011 | -] |
3012 | class project_issue_report(osv.osv): |
3013 | _name = "project.issue.report" |
3014 | _auto = False |
3015 | @@ -38,7 +31,6 @@ |
3016 | _columns = { |
3017 | 'name': fields.char('Year', size=64, required=False, readonly=True), |
3018 | 'section_id':fields.many2one('crm.case.section', 'Sale Team', readonly=True), |
3019 | - 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), |
3020 | 'month':fields.selection([('01', 'January'), ('02', 'February'), \ |
3021 | ('03', 'March'), ('04', 'April'),\ |
3022 | ('05', 'May'), ('06', 'June'), \ |
3023 | @@ -51,6 +43,7 @@ |
3024 | 'creation_date': fields.date('Creation Date', readonly=True), |
3025 | 'date_closed': fields.date('Date of Closing', readonly=True), |
3026 | 'stage_id': fields.many2one('project.task.type', 'Stage'), |
3027 | + 'stage_sequence': fields.related('stage_id','sequence',type='integer', string='Stage Sequence'), |
3028 | 'nbr': fields.integer('# of Issues', readonly=True), |
3029 | 'working_hours_open': fields.float('Avg. Working Hours to Open', readonly=True, group_operator="avg"), |
3030 | 'working_hours_close': fields.float('Avg. Working Hours to Close', readonly=True, group_operator="avg"), |
3031 | @@ -80,7 +73,6 @@ |
3032 | to_char(c.create_date, 'YYYY-MM-DD') as day, |
3033 | to_char(c.date_open, 'YYYY-MM-DD') as opening_date, |
3034 | to_char(c.create_date, 'YYYY-MM-DD') as creation_date, |
3035 | - c.state, |
3036 | c.user_id, |
3037 | c.working_hours_open, |
3038 | c.working_hours_close, |
3039 | |
3040 | === modified file 'project_issue/report/project_issue_report_view.xml' |
3041 | --- project_issue/report/project_issue_report_view.xml 2013-04-22 15:34:49 +0000 |
3042 | +++ project_issue/report/project_issue_report_view.xml 2013-06-05 13:32:29 +0000 |
3043 | @@ -20,7 +20,7 @@ |
3044 | <field name="partner_id" invisible="1"/> |
3045 | <field name="task_id" invisible="1"/> |
3046 | <field name="date_closed" invisible="1"/> |
3047 | - <field name="state" invisible="1"/> |
3048 | + <field name="stage_sequence" invisible="1"/> |
3049 | <field name="day" invisible="1"/> |
3050 | <field name="nbr" string="#Project Issues" sum="#Number of Project Issues"/> |
3051 | <field name="delay_open" avg="Avg Opening Delay"/> |
3052 | @@ -36,7 +36,6 @@ |
3053 | <field name="model">project.issue.report</field> |
3054 | <field name="arch" type="xml"> |
3055 | <graph orientation="horizontal" string="Project Issue" type="bar"> |
3056 | - <field name="state"/> |
3057 | <field name="nbr" operator="+"/> |
3058 | <field group="True" name="user_id"/> |
3059 | </graph> |
3060 | @@ -49,10 +48,6 @@ |
3061 | <field name="arch" type="xml"> |
3062 | <search string="Search"> |
3063 | <field name="creation_date"/> |
3064 | - <filter icon="terp-camera_test" string="New" domain="[('state','=','draft')]"/> |
3065 | - <filter icon="terp-check" string="To Do" domain="[('state','=','open')]"/> |
3066 | - <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/> |
3067 | - <filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/> |
3068 | <field name="project_id"/> |
3069 | <field name="user_id"/> |
3070 | <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/> |
3071 | |
3072 | === removed file 'project_issue/test/cancel_issue.yml' |
3073 | --- project_issue/test/cancel_issue.yml 2012-12-21 12:17:53 +0000 |
3074 | +++ project_issue/test/cancel_issue.yml 1970-01-01 00:00:00 +0000 |
3075 | @@ -1,60 +0,0 @@ |
3076 | -- |
3077 | - In order to test process of issue tracking in OpenERP, I cancel the unqualified Issue. |
3078 | -- |
3079 | - !python {model: project.issue}: | |
3080 | - self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3081 | -- |
3082 | - I check the issue is in cancel state. |
3083 | -- |
3084 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}: |
3085 | - - state == 'cancelled' |
3086 | -- |
3087 | - I re-open the Issue. |
3088 | -- |
3089 | - !python {model: project.issue}: | |
3090 | - self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3091 | -- |
3092 | - I check the state of issue after open it. |
3093 | -- |
3094 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in open state}: |
3095 | - - state == 'open' |
3096 | -- |
3097 | - I put the issue in pending state. |
3098 | -- |
3099 | - !python {model: project.issue}: | |
3100 | - self.case_pending(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3101 | -- |
3102 | - I check the state of issue after put it in pending state. |
3103 | -- |
3104 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in pending state}: |
3105 | - - state == 'pending' |
3106 | -- |
3107 | - I cancel the issue is in pending state. |
3108 | -- |
3109 | - !python {model: project.issue}: | |
3110 | - self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3111 | -- |
3112 | - I check the issue is in cancel state. |
3113 | -- |
3114 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}: |
3115 | - - state == 'cancelled' |
3116 | -- |
3117 | - I close Issue. |
3118 | -- |
3119 | - !python {model: project.issue}: | |
3120 | - self.case_close(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3121 | -- |
3122 | - I check state of Issue after close. |
3123 | -- |
3124 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in done state}: |
3125 | - - state == 'done' |
3126 | -- |
3127 | - I cancel the issue is in done state. |
3128 | -- |
3129 | - !python {model: project.issue}: | |
3130 | - self.case_cancel(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3131 | -- |
3132 | - I check the issue is in cancel state. |
3133 | -- |
3134 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue is in cancel state}: |
3135 | - - state == 'cancelled' |
3136 | |
3137 | === modified file 'project_issue/test/issue_process.yml' |
3138 | --- project_issue/test/issue_process.yml 2012-11-29 22:26:45 +0000 |
3139 | +++ project_issue/test/issue_process.yml 2013-06-05 13:32:29 +0000 |
3140 | @@ -1,24 +1,4 @@ |
3141 | - |
3142 | - In order to test process of issue tracking in OpenERP, I Open the Issue. |
3143 | -- |
3144 | - !python {model: project.issue}: | |
3145 | - self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3146 | -- |
3147 | - I check state of Issue after opened it. |
3148 | -- |
3149 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}: |
3150 | - - state == 'open' |
3151 | -- |
3152 | - Now I put Issue in pending due to need more information. |
3153 | -- |
3154 | - !python {model: project.issue}: | |
3155 | - self.case_pending(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3156 | -- |
3157 | - I check state after put in pending. |
3158 | -- |
3159 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in pending state}: |
3160 | - - state == 'pending' |
3161 | -- |
3162 | I send mail to get more details. TODO revert mail.mail to mail.compose.message (conversion to customer should be automatic). |
3163 | - |
3164 | !python {model: mail.mail }: | |
3165 | @@ -30,28 +10,3 @@ |
3166 | self.send_mail(cr, uid, [new_id], context=ctx) |
3167 | except Exception, e: |
3168 | pass |
3169 | -- |
3170 | - After getting sufficient details, I re-open Issue from pending state. |
3171 | -- |
3172 | - !python {model: project.issue}: | |
3173 | - self.case_open(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3174 | -- |
3175 | - I check state of Issue after re-opened. |
3176 | -- |
3177 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}: |
3178 | - - state == 'open' |
3179 | -- |
3180 | - I create Task for Issue. |
3181 | -- |
3182 | - !python {model: project.issue}: | |
3183 | - self.convert_issue_task(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3184 | -- |
3185 | - I close Issue after resolving it |
3186 | -- |
3187 | - !python {model: project.issue}: | |
3188 | - self.case_close(cr, uid, [ref("crm_case_buginaccountsmodule0")]) |
3189 | -- |
3190 | - I Check state of Issue after closed. |
3191 | -- |
3192 | - !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in done state}: |
3193 | - - state == 'done' |
3194 | |
3195 | === modified file 'project_long_term/project_long_term_view.xml' |
3196 | --- project_long_term/project_long_term_view.xml 2013-02-25 13:38:04 +0000 |
3197 | +++ project_long_term/project_long_term_view.xml 2013-06-05 13:32:29 +0000 |
3198 | @@ -199,7 +199,6 @@ |
3199 | <field name="project_id" invisible="1"/> |
3200 | <field name="total_hours" sum='Total Hours'/> |
3201 | <field name="remaining_hours" widget="float_time" sum="Remaining Hours"/> |
3202 | - <field name="state"/> |
3203 | </tree> |
3204 | </field> |
3205 | </page> |
3206 | |
3207 | === modified file 'project_long_term/test/phase_process.yml' |
3208 | --- project_long_term/test/phase_process.yml 2012-11-29 22:26:45 +0000 |
3209 | +++ project_long_term/test/phase_process.yml 2013-06-05 13:32:29 +0000 |
3210 | @@ -32,48 +32,3 @@ |
3211 | if not phase.previous_phase_ids and phase.constraint_date_start: |
3212 | assert _convert(phase.date_start) >= _convert(phase.constraint_date_start), "Phase does not start in proper date." |
3213 | _check(phase, _convert, _check) |
3214 | -- |
3215 | - I open phase. |
3216 | -- |
3217 | - !python {model: project.phase}: | |
3218 | - self.set_open(cr, uid, [ref("project_phase_1")]) |
3219 | -- |
3220 | - I check state of phase after opened. |
3221 | -- |
3222 | - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in open state}: |
3223 | - - state == "open" |
3224 | -- |
3225 | - I put phase in pending state. |
3226 | -- |
3227 | - !python {model: project.phase}: | |
3228 | - self.set_pending(cr, uid, [ref("project_phase_1")]) |
3229 | -- |
3230 | - I check state of phase after put in pending. |
3231 | -- |
3232 | - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in pending state}: |
3233 | - - state == "pending" |
3234 | -- |
3235 | - I make Phase in cancel state. |
3236 | -- |
3237 | - !python {model: project.phase}: | |
3238 | - self.set_cancel(cr, uid, [ref("project_phase_1")]) |
3239 | -- |
3240 | - I check state of phase after cancelled. |
3241 | -- |
3242 | - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in cancel state}: |
3243 | - - state == "cancelled" |
3244 | -- |
3245 | - I put again in draft phase. |
3246 | -- |
3247 | - !python {model: project.phase}: | |
3248 | - self.set_draft(cr, uid, [ref("project_phase_1")]) |
3249 | -- |
3250 | - I close phase. |
3251 | -- |
3252 | - !python {model: project.phase}: | |
3253 | - self.set_done(cr, uid, [ref("project_phase_1")]) |
3254 | -- |
3255 | - I check state of phase after closed. |
3256 | -- |
3257 | - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in done state}: |
3258 | - - state == "done" |
3259 | |
3260 | === modified file 'project_long_term/test/task_process.yml' |
3261 | --- project_long_term/test/task_process.yml 2012-11-29 22:26:45 +0000 |
3262 | +++ project_long_term/test/task_process.yml 2013-06-05 13:32:29 +0000 |
3263 | @@ -14,6 +14,6 @@ |
3264 | !python {model: project.project}: | |
3265 | prj = self.browse(cr, uid, [ref("project.project_project_1")])[0] |
3266 | for task in prj.tasks: |
3267 | - if task.state in ('done','cancelled'): |
3268 | + if task.stage_sequence in (7,8): |
3269 | continue |
3270 | assert task.user_id and task.date_start and task.date_end, "Project tasks not scheduled" |
3271 | |
3272 | === modified file 'project_mrp/project_mrp.py' |
3273 | --- project_mrp/project_mrp.py 2013-04-15 10:23:49 +0000 |
3274 | +++ project_mrp/project_mrp.py 2013-06-05 13:32:29 +0000 |
3275 | @@ -30,21 +30,7 @@ |
3276 | 'sale_line_id': fields.related('procurement_id', 'sale_line_id', type='many2one', relation='sale.order.line', store=True, string='Sales Order Line'), |
3277 | } |
3278 | |
3279 | - def _validate_subflows(self, cr, uid, ids): |
3280 | - wf_service = netsvc.LocalService("workflow") |
3281 | - for task in self.browse(cr, uid, ids): |
3282 | - if task.procurement_id: |
3283 | - wf_service.trg_write(uid, 'procurement.order', task.procurement_id.id, cr) |
3284 | - |
3285 | - def do_close(self, cr, uid, ids, *args, **kwargs): |
3286 | - res = super(project_task, self).do_close(cr, uid, ids, *args, **kwargs) |
3287 | - self._validate_subflows(cr, uid, ids) |
3288 | - return res |
3289 | - |
3290 | - def do_cancel(self, cr, uid, ids, *args, **kwargs): |
3291 | - res = super(project_task, self).do_cancel(cr, uid, ids, *args, **kwargs) |
3292 | - self._validate_subflows(cr, uid, ids) |
3293 | - return res |
3294 | +project_task() |
3295 | |
3296 | class product_product(osv.osv): |
3297 | _inherit = "product.product" |
3298 | @@ -66,11 +52,11 @@ |
3299 | return {} |
3300 | res_sale = {} |
3301 | res = super(sale_order, self)._picked_rate(cr, uid, ids, name, arg, context=context) |
3302 | - cr.execute('''select sol.order_id as sale_id, t.state as task_state , |
3303 | + cr.execute('''select sol.order_id as sale_id , |
3304 | t.id as task_id, sum(sol.product_uom_qty) as total |
3305 | from project_task as t |
3306 | left join sale_order_line as sol on sol.id = t.sale_line_id |
3307 | - where sol.order_id in %s group by sol.order_id,t.state,t.id ''',(tuple(ids),)) |
3308 | + where sol.order_id in %s group by sol.order_id,t.id ''',(tuple(ids),)) |
3309 | sale_task_data = cr.dictfetchall() |
3310 | |
3311 | if not sale_task_data: |
3312 | |
3313 | === modified file 'project_mrp/project_mrp_view.xml' |
3314 | --- project_mrp/project_mrp_view.xml 2012-12-21 16:48:08 +0000 |
3315 | +++ project_mrp/project_mrp_view.xml 2013-06-05 13:32:29 +0000 |
3316 | @@ -26,7 +26,7 @@ |
3317 | <field name="model">project.task</field> |
3318 | <field name="inherit_id" ref="project.view_task_form2"/> |
3319 | <field name="arch" type="xml"> |
3320 | - <field name="state" position="after"> |
3321 | + <field name="partner_id" position="after"> |
3322 | <field name="sale_line_id" string="Order Line"/> |
3323 | </field> |
3324 | </field> |
3325 | |
3326 | === modified file 'project_mrp/project_procurement.py' |
3327 | --- project_mrp/project_procurement.py 2013-04-15 10:23:49 +0000 |
3328 | +++ project_mrp/project_procurement.py 2013-06-05 13:32:29 +0000 |
3329 | @@ -39,7 +39,7 @@ |
3330 | @return: True or False. |
3331 | """ |
3332 | for p in self.browse(cr, uid, ids, context=context): |
3333 | - if (p.product_id.type=='service') and (p.procure_method=='make_to_order') and p.task_id and (p.task_id.state not in ('done', 'cancelled')): |
3334 | + if (p.product_id.type=='service') and (p.procure_method=='make_to_order') and p.task_id and (p.task_id.stage_sequence not in (7,8)): |
3335 | return False |
3336 | return True |
3337 | |
3338 | |
3339 | === modified file 'project_mrp/test/project_task_procurement.yml' |
3340 | --- project_mrp/test/project_task_procurement.yml 2013-03-26 19:54:00 +0000 |
3341 | +++ project_mrp/test/project_task_procurement.yml 2013-06-05 13:32:29 +0000 |
3342 | @@ -30,18 +30,3 @@ |
3343 | assert datetime.strptime(task.date_deadline, '%Y-%m-%d') == datetime.strptime(procurement.date_planned[:10], '%Y-%m-%d'), 'Deadline does not correspond.' |
3344 | if procurement.product_id.product_manager: |
3345 | assert task.user_id.id == procurement.product_id.product_manager.id, 'Allocated Person does not correspond with Service Product Manager.' |
3346 | -- |
3347 | - I close that task. |
3348 | -- |
3349 | - !python {model: project.task}: | |
3350 | - task_ids = self.search(cr, uid, [('sale_line_id', '=', ref('line_services'))]) |
3351 | - assert task_ids, "Task is not generated for Service Order Line." |
3352 | - self.do_close(cr, uid, task_ids, context=context) |
3353 | -- |
3354 | - I check procurement of Service Order Line after closed task. |
3355 | -- |
3356 | - !python {model: procurement.order}: | |
3357 | - procurement_ids = self.search(cr, uid, [('sale_line_id', '=', ref('line_services'))]) |
3358 | - assert procurement_ids, "Procurement is not generated for Service Order Line." |
3359 | - procurement = self.browse(cr, uid, procurement_ids[0], context=context) |
3360 | - assert procurement.state == 'done' , "Procurement should be closed." |
3361 | |
3362 | === modified file 'project_timesheet/test/worktask_entry_to_timesheetline_entry.yml' |
3363 | --- project_timesheet/test/worktask_entry_to_timesheetline_entry.yml 2013-05-31 08:20:03 +0000 |
3364 | +++ project_timesheet/test/worktask_entry_to_timesheetline_entry.yml 2013-06-05 13:32:29 +0000 |
3365 | @@ -66,17 +66,8 @@ |
3366 | planned_hours: 20.0 |
3367 | project_id: project_project_timesheetmanagement0 |
3368 | remaining_hours: 20.0 |
3369 | - state: draft |
3370 | user_id: res_users_hrmanager0 |
3371 | - |
3372 | - Open the task |
3373 | -- |
3374 | - !python {model: project.task}: | |
3375 | - self.do_open(cr, uid, [ref("project_task_getalltimesheetrecords0")], {"lang": |
3376 | - "en_US", "active_ids": [ref("project_project_timesheetmanagement0")], "tz": |
3377 | - False, "active_model": "project.project", "department_id": False, "project_id": |
3378 | - False, "active_id": ref("project_project_timesheetmanagement0"), }) |
3379 | -- |
3380 | Make a work task entry 'Get work calendar of all employees' of 10 hours done by HR manager |
3381 | - |
3382 | !record {model: project.task, id: project_task_getalltimesheetrecords0}: |
3383 | |
3384 | === modified file 'sale_crm/sale_crm_view.xml' |
3385 | --- sale_crm/sale_crm_view.xml 2013-06-04 13:44:14 +0000 |
3386 | +++ sale_crm/sale_crm_view.xml 2013-06-05 13:32:29 +0000 |
3387 | @@ -9,8 +9,9 @@ |
3388 | <field name="arch" type="xml"> |
3389 | <data> |
3390 | <xpath expr="/form/header/button[@name='case_mark_lost']" position="after"> |
3391 | - <button states="done" string="Create Quotation" name="%(action_crm_make_sale)d" type="action"/> |
3392 | - <button states="draft,open,pending" string="Convert to Quotation" name="%(action_crm_make_sale)d" type="action" class="oe_highlight"/> |
3393 | + <field name="stage_sequence" invisible="1"/> |
3394 | + <button attrs="{'invisible':[('stage_sequence','!=',6)]}" string="Create Quotation" name="%(action_crm_make_sale)d" type="action"/> |
3395 | + <button attrs="{'invisible':[('stage_sequence','in',[6,7,8])]}" string="Convert to Quotation" name="%(action_crm_make_sale)d" type="action" class="oe_highlight"/> |
3396 | </xpath> |
3397 | </data> |
3398 | </field> |