Merge lp:~mallorymarcot/unifield-server/us-5375 into lp:unifield-server

Proposed by jftempo on 2018-11-27
Status: Needs review
Proposed branch: lp:~mallorymarcot/unifield-server/us-5375
Merge into: lp:unifield-server
Diff against target: 51 lines (+10/-8)
1 file modified
bin/addons/documents_done/documents_done.py (+10/-8)
To merge this branch: bzr merge lp:~mallorymarcot/unifield-server/us-5375
Reviewer Review Type Date Requested Status
UniField Reviewer Team 2018-11-27 Pending
Review via email: mp+359583@code.launchpad.net
To post a comment you must log in.
5183. By Mallory MARCOT on 2018-11-27

US-5375 [FIX] issue pagination with old RfQ states

Unmerged revisions

5183. By Mallory MARCOT on 2018-11-27

US-5375 [FIX] issue pagination with old RfQ states

5182. By Mallory MARCOT on 2018-11-26

US-5375 [FIX] issue doc already cancelled

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/documents_done/documents_done.py'
2--- bin/addons/documents_done/documents_done.py 2018-10-29 13:05:04 +0000
3+++ bin/addons/documents_done/documents_done.py 2018-11-27 11:22:41 +0000
4@@ -46,6 +46,9 @@
5 for model in context.get('models', ['sale.order', 'purchase.order', 'tender']):
6 sel = self.pool.get(model).fields_get(cr, uid, ['state'])
7 res = sel['state']['selection']
8+ if model == 'purchase.order':
9+ res = self.pool.get(model).fields_get(cr, uid, ['rfq_state'])['rfq_state']['selection'] + res
10+
11 for st in res:
12 if not 'db_value' in context:
13 if (st[1], st[1]) not in states and st[0] not in ('done', 'cancel'):
14@@ -81,14 +84,13 @@
15 Returns the good value according to the doc type
16 '''
17 res = {}
18- if not context:
19+ if context is None:
20 context = {}
21
22 for doc in self.browse(cr, uid, ids, context=context):
23- context.update({'models': [doc.real_model], 'db_value': True})
24- for state in self._get_selection(cr, uid, context=context):
25- if state[0] == doc.state:
26- res[doc.id] = state[1]
27+ field = 'rfq_state' if doc.model == 'rfq' else 'state'
28+ state_str = self.pool.get('ir.model.fields').get_selection(cr, uid, doc.real_model, field, doc.state, context=context)
29+ res[doc.id] = state_str
30
31 return res
32
33@@ -551,6 +553,8 @@
34 wf_service = netsvc.LocalService("workflow")
35
36 for wiz in self.browse(cr, uid, ids, context=context):
37+ res = self.pool.get('documents.done.wizard').cancel_line(cr, uid, [wiz.wizard_id.id], all_doc=True, context=context)
38+
39 # cancel associated document:
40 for wiz_line in wiz.pb_lines:
41 if wiz_line.doc_model in ('purchase.order', 'sale.order', 'tender'):
42@@ -558,9 +562,7 @@
43 for line in order.order_line:
44 wf_service.trg_validate(uid, line._name, line.id, 'cancel', cr)
45
46- return self.pool.get('documents.done.wizard').cancel_line(cr, uid, [wiz.wizard_id.id], all_doc=True, context=context)
47-
48- return True
49+ return res
50
51 documents_done_problem()
52

Subscribers

People subscribed via source and target branches