Merge lp:~jfb-tempo-consulting/unifield-server/US-3347 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4886
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-3347
Merge into: lp:unifield-server
Diff against target: 33 lines (+15/-0)
1 file modified
bin/addons/sync_so/purchase.py (+15/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-3347
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+342560@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/sync_so/purchase.py'
2--- bin/addons/sync_so/purchase.py 2018-03-02 16:00:09 +0000
3+++ bin/addons/sync_so/purchase.py 2018-04-03 10:30:45 +0000
4@@ -25,6 +25,7 @@
5 import logging
6 import time
7 from tools.translate import _
8+import uuid
9
10 from sync_client import get_sale_purchase_logger
11
12@@ -525,8 +526,22 @@
13 self.write(cr, uid, po_id, default, context=context)
14 else:
15 # create a new PO, then send it to Validated state
16+
17+ # do not eat a seq
18+ tmp_name = '%s' % uuid.uuid4()
19+ default['name'] = tmp_name
20 po_id = self.create(cr, uid, default , context=context)
21
22+ # no constraint raised, we can create the default name and save gap in ref
23+ new_name = self.pool.get('ir.sequence').get(cr, uid, 'purchase.order')
24+ self.write(cr, uid, po_id, {'name': new_name}, context=context)
25+ audit_log_line = self.pool.get('audittrail.log.line')
26+ audit_ids = audit_log_line.search(cr, uid,
27+ [('method', '=', 'create'), ('res_id', '=', po_id), ('new_value', '=', tmp_name), ('object_id.model', '=', 'purchase.order')],
28+ context=context)
29+ if audit_ids:
30+ audit_log_line.write(cr, uid, audit_ids, {'new_value': new_name, 'new_value_text': new_name}, context=context)
31+
32 # update the next line number for the PO if needed
33 so_po_common.update_next_line_number_fo_po(cr, uid, po_id, self, 'purchase_order_line', context)
34

Subscribers

People subscribed via source and target branches