Merge lp:~dorian-kemps/unifield-server/US-1531 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4733
Proposed branch: lp:~dorian-kemps/unifield-server/US-1531
Merge into: lp:unifield-server
Diff against target: 51 lines (+15/-3)
2 files modified
bin/addons/account/invoice.py (+9/-1)
bin/addons/account_override/invoice.py (+6/-2)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-1531
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+335837@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/account/invoice.py'
2--- bin/addons/account/invoice.py 2017-10-20 09:43:54 +0000
3+++ bin/addons/account/invoice.py 2018-01-12 08:49:32 +0000
4@@ -425,7 +425,11 @@
5 def get_log_context(self, cr, uid, context=None):
6 if context is None:
7 context = {}
8- res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form')
9+ is_intermission = context.get('is_intermission', False)
10+ if is_intermission:
11+ res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_override', 'view_intermission_form')
12+ else:
13+ res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form')
14 view_id = res and res[1] or False
15 context.update({'view_id': view_id})
16 return context
17@@ -437,10 +441,14 @@
18 res = super(account_invoice, self).create(cr, uid, vals, context)
19 for inv_id, name in self.name_get(cr, uid, [res], context=context):
20 ctx = context.copy()
21+ if 'is_intermission' in vals:
22+ ctx.update({'is_intermission': vals['is_intermission']})
23 if vals.get('type', 'in_invoice') in ('out_invoice', 'out_refund'):
24 ctx = self.get_log_context(cr, uid, context=ctx)
25 if 'type' in vals:
26 ctx.update({'type': vals['type']})
27+ if '_terp_view_name' in ctx:
28+ del ctx['_terp_view_name']
29 message = _("Invoice '%s' is waiting for validation.") % name
30 self.log(cr, uid, inv_id, message, context=ctx)
31 return res
32
33=== modified file 'bin/addons/account_override/invoice.py'
34--- bin/addons/account_override/invoice.py 2017-10-27 15:15:11 +0000
35+++ bin/addons/account_override/invoice.py 2018-01-12 08:49:32 +0000
36@@ -698,9 +698,13 @@
37 local_ctx.update(el[2])
38 # UF-1112: Give all customer invoices a name as "Stock Transfer Voucher".
39 if not message_changed and self.read(cr, uid, inv_id, ['type']).get('type', False) == 'out_invoice':
40- message = re.sub(pattern, 'Stock Transfer Voucher', message, 1)
41+ if local_ctx.get('is_intermission', False):
42+ message = re.sub(pattern, 'Intermission Voucher', message, 1)
43+ local_ctx.update(intermission_ctx)
44+ else:
45+ message = re.sub(pattern, 'Stock Transfer Voucher', message, 1)
46+ local_ctx.update(customer_ctx)
47
48- local_ctx.update(customer_ctx)
49 # UF-1307: for supplier invoice log (from the incoming shipment), the context was not
50 # filled with all the information; this leaded to having a "Sale" journal in the supplier
51 # invoice if it was saved after coming from this link. Here's the fix.

Subscribers

People subscribed via source and target branches