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

Proposed by jftempo
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 Pending
Review via email: mp+359583@code.launchpad.net
To post a comment you must log in.
5183. By Mallory MARCOT

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

Unmerged revisions

5183. By Mallory MARCOT

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

5182. By Mallory MARCOT

US-5375 [FIX] issue doc already cancelled

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/documents_done/documents_done.py'
--- bin/addons/documents_done/documents_done.py 2018-10-29 13:05:04 +0000
+++ bin/addons/documents_done/documents_done.py 2018-11-27 11:22:41 +0000
@@ -46,6 +46,9 @@
46 for model in context.get('models', ['sale.order', 'purchase.order', 'tender']):46 for model in context.get('models', ['sale.order', 'purchase.order', 'tender']):
47 sel = self.pool.get(model).fields_get(cr, uid, ['state'])47 sel = self.pool.get(model).fields_get(cr, uid, ['state'])
48 res = sel['state']['selection']48 res = sel['state']['selection']
49 if model == 'purchase.order':
50 res = self.pool.get(model).fields_get(cr, uid, ['rfq_state'])['rfq_state']['selection'] + res
51
49 for st in res:52 for st in res:
50 if not 'db_value' in context:53 if not 'db_value' in context:
51 if (st[1], st[1]) not in states and st[0] not in ('done', 'cancel'):54 if (st[1], st[1]) not in states and st[0] not in ('done', 'cancel'):
@@ -81,14 +84,13 @@
81 Returns the good value according to the doc type84 Returns the good value according to the doc type
82 '''85 '''
83 res = {}86 res = {}
84 if not context:87 if context is None:
85 context = {}88 context = {}
8689
87 for doc in self.browse(cr, uid, ids, context=context):90 for doc in self.browse(cr, uid, ids, context=context):
88 context.update({'models': [doc.real_model], 'db_value': True})91 field = 'rfq_state' if doc.model == 'rfq' else 'state'
89 for state in self._get_selection(cr, uid, context=context):92 state_str = self.pool.get('ir.model.fields').get_selection(cr, uid, doc.real_model, field, doc.state, context=context)
90 if state[0] == doc.state:93 res[doc.id] = state_str
91 res[doc.id] = state[1]
9294
93 return res95 return res
9496
@@ -551,6 +553,8 @@
551 wf_service = netsvc.LocalService("workflow")553 wf_service = netsvc.LocalService("workflow")
552554
553 for wiz in self.browse(cr, uid, ids, context=context):555 for wiz in self.browse(cr, uid, ids, context=context):
556 res = self.pool.get('documents.done.wizard').cancel_line(cr, uid, [wiz.wizard_id.id], all_doc=True, context=context)
557
554 # cancel associated document:558 # cancel associated document:
555 for wiz_line in wiz.pb_lines:559 for wiz_line in wiz.pb_lines:
556 if wiz_line.doc_model in ('purchase.order', 'sale.order', 'tender'):560 if wiz_line.doc_model in ('purchase.order', 'sale.order', 'tender'):
@@ -558,9 +562,7 @@
558 for line in order.order_line:562 for line in order.order_line:
559 wf_service.trg_validate(uid, line._name, line.id, 'cancel', cr)563 wf_service.trg_validate(uid, line._name, line.id, 'cancel', cr)
560564
561 return self.pool.get('documents.done.wizard').cancel_line(cr, uid, [wiz.wizard_id.id], all_doc=True, context=context)565 return res
562
563 return True
564566
565documents_done_problem()567documents_done_problem()
566568

Subscribers

People subscribed via source and target branches