Merge lp:~openerp-dev/openobject-addons/7.0-opw-595923-chandni into lp:openobject-addons/7.0

Proposed by Chandni Machchhar(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-595923-chandni
Merge into: lp:openobject-addons/7.0
Diff against target: 23 lines (+13/-0)
1 file modified
account/account_invoice.py (+13/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-595923-chandni
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Vinay Rana (OpenERP) Pending
OpenERP Core Team Pending
Review via email: mp+178493@code.launchpad.net

Description of the change

Hello,

 I have Fixed the Bug : Prevent that use of accounts of other chart of accounts while creating invoice.
 When you create invoice it will not allow you to set the account which is different than chart of account.

Thanks,
Chandni.

To post a comment you must log in.

Unmerged revisions

9341. By Chandni Machchhar(OpenERP)

[FIX] Prevent that use of accounts of other chart of accounts.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2013-07-12 06:58:43 +0000
3+++ account/account_invoice.py 2013-08-05 05:14:25 +0000
4@@ -1042,6 +1042,19 @@
5
6 ctx.update(invoice=inv)
7 move_id = move_obj.create(cr, uid, move, context=ctx)
8+ for move in move_obj.browse(cr, uid, [move_id], context=context):
9+ top_common = None
10+ for line in move.line_id:
11+ account = line.account_id
12+ top_account = account
13+ while top_account.parent_id:
14+ top_account = top_account.parent_id
15+ if not top_common:
16+ top_common = top_account
17+ elif top_account.id != top_common.id:
18+ raise osv.except_osv(_('Error!'),
19+ _('You cannot validate this Invoice because account "%s" does not belong to chart of accounts "%s".') % (account.name, top_common.name))
20+
21 new_move_name = move_obj.browse(cr, uid, move_id, context=ctx).name
22 # make the invoice point to that move
23 self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}, context=ctx)