Merge lp:~mikel-martin/openobject-addons/6.1-fixes-1079401 into lp:openobject-addons/6.1

Proposed by mikel
Status: Needs review
Proposed branch: lp:~mikel-martin/openobject-addons/6.1-fixes-1079401
Merge into: lp:openobject-addons/6.1
Diff against target: 34 lines (+7/-2)
1 file modified
stock/stock.py (+7/-2)
To merge this branch: bzr merge lp:~mikel-martin/openobject-addons/6.1-fixes-1079401
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+134571@code.launchpad.net

Description of the change

Fix for bug https://bugs.launchpad.net/openobject-addons/+bug/1079401

When using as invoice policy "invoice from delivery order" and you create the invoice from the "create invoice" button in the delivery order the new invoice doesn't get the default values set for the partner as payment term, payment type, fiscal position....

To post a comment you must log in.

Unmerged revisions

7068. By mikel <mikel@pcl2>

[FIX] https://bugs.launchpad.net/openobject-addons/+bug/1079401

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2012-10-05 07:47:57 +0000
3+++ stock/stock.py 2012-11-15 22:58:21 +0000
4@@ -1099,7 +1099,12 @@
5 else:
6 invoice_vals = self._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context)
7 invoice_id = invoice_obj.create(cr, uid, invoice_vals, context=context)
8+ invoice = invoice_obj.browse(cr, uid, invoice_id)
9 invoices_group[partner.id] = invoice_id
10+ #Call onchange_partner to get partners default values
11+ result = invoice_obj.onchange_partner_id(cr, uid, invoice_id, invoice.type, invoice.partner_id.id, invoice.date_invoice, invoice.payment_term, invoice.partner_bank_id, invoice.company_id.id)
12+ invoice_obj.write(cr, uid, invoice_id, result['value'])
13+
14 res[picking.id] = invoice_id
15 for move_line in picking.move_lines:
16 if move_line.state == 'cancel':
17@@ -1280,7 +1285,7 @@
18 {
19 'product_qty' : move.product_qty - partial_qty[move.id],
20 'product_uos_qty': move.product_qty - partial_qty[move.id], #TODO: put correct uos_qty
21-
22+
23 })
24
25 if new_picking:
26@@ -1382,7 +1387,7 @@
27 name = '%s [%s]' % (name, record['ref'])
28 res.append((record['id'], name))
29 return res
30-
31+
32 def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
33 args = args or []
34 ids = []