Merge lp:~openerp-dev/openobject-addons/trunk-bug-757687-ara into lp:openobject-addons

Proposed by Ashvin Rathod (OpenERP)
Status: Merged
Merged at revision: 4988
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-757687-ara
Merge into: lp:openobject-addons
Diff against target: 44 lines (+8/-2)
1 file modified
sale/stock.py (+8/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-757687-ara
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) (community) Approve
Ashvin Rathod (OpenERP) (community) Needs Resubmitting
qdp (OpenERP) Pending
Review via email: mp+57626@code.launchpad.net

Description of the change

Hello,

Fix: Wrong account for invoice lines created from delivery for service products

Thanks,
Ashvin Rathod

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

It will give error in context is None.

Fix it please.

thanks,
mra

review: Needs Fixing
Revision history for this message
Ashvin Rathod (OpenERP) (ara-tinyerp) wrote :

hello,

I have changed as you describe above.

Thanks,
ara

review: Needs Resubmitting
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) :
review: Approve
Revision history for this message
qdp (OpenERP) (qdp) wrote :

seems weird.. need to double-check

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale/stock.py'
2--- sale/stock.py 2011-02-23 10:22:43 +0000
3+++ sale/stock.py 2011-04-14 09:36:04 +0000
4@@ -116,9 +116,13 @@
5
6 def action_invoice_create(self, cursor, user, ids, journal_id=False,
7 group=False, type='out_invoice', context=None):
8+ if context is None:
9+ context = {}
10 invoice_obj = self.pool.get('account.invoice')
11 picking_obj = self.pool.get('stock.picking')
12 invoice_line_obj = self.pool.get('account.invoice.line')
13+ fiscal_position_obj = self.pool.get('account.fiscal.position')
14+ order_line_obj = self.pool.get('sale.order.line')
15
16 result = super(stock_picking, self).action_invoice_create(cursor, user,
17 ids, journal_id=journal_id, group=group, type=type,
18@@ -144,6 +148,8 @@
19 invoice_obj.write(cursor, user, [invoice_created.id], {'name': inv_name}, context=context)
20 for sale_line in sale_lines:
21 if sale_line.product_id.type == 'service' and sale_line.invoiced == False:
22+ if not type:
23+ type = context.get('inv_type', False)
24 if group:
25 name = picking.name + '-' + sale_line.name
26 else:
27@@ -168,7 +174,7 @@
28 account_analytic_id = self._get_account_analytic_invoice(cursor,
29 user, picking, sale_line)
30
31- account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, picking.sale_id.partner_id.property_account_position, account_id)
32+ account_id = fiscal_position_obj.map_account(cursor, user, picking.sale_id.partner_id.property_account_position, account_id)
33 invoice = invoices[result[picking.id]]
34 invoice_line_id = invoice_line_obj.create(cursor, user, {
35 'name': name,
36@@ -183,7 +189,7 @@
37 'account_analytic_id': account_analytic_id,
38 'notes':sale_line.notes
39 }, context=context)
40- self.pool.get('sale.order.line').write(cursor, user, [sale_line.id], {'invoiced': True,
41+ order_line_obj.write(cursor, user, [sale_line.id], {'invoiced': True,
42 'invoice_lines': [(6, 0, [invoice_line_id])],
43 })
44 return result

Subscribers

People subscribed via source and target branches

to all changes: