Merge lp:~sbi/ocb-addons/bug_1084822 into lp:ocb-addons

Proposed by Stéphane Bidoul (Acsone)
Status: Merged
Merged at revision: 9397
Proposed branch: lp:~sbi/ocb-addons/bug_1084822
Merge into: lp:ocb-addons
Diff against target: 27 lines (+9/-1)
1 file modified
account/account_invoice.py (+9/-1)
To merge this branch: bzr merge lp:~sbi/ocb-addons/bug_1084822
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Stefan Rijnhart (Opener) Approve
Review via email: mp+174881@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

LGTM.

I noticed the 'invalidly stacked' warning on the branch. Did you run the clone script on a stand alone branch straight from Launchpad? I'm afraid the script is rather intolerant against other branch configurations. Not that it matters at this stage, but it probably took you a long time to upload this branch if it could not be stacked.

review: Approve
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

I noticed the invalid stacked too. I run the script again a standalone
branch and the upload was pretty quick so I don't know were it comes from.
Maybe due to previous experiments of mine trying to work on a lightweight
checkout or a stacked branch to shave some download time...

-sbi

On Tue, Jul 16, 2013 at 11:44 AM, Stefan Rijnhart (Therp)
<email address hidden>wrote:

> Review: Approve
>
> LGTM.
>
> I noticed the 'invalidly stacked' warning on the branch. Did you run the
> clone script on a stand alone branch straight from Launchpad? I'm afraid
> the script is rather intolerant against other branch configurations. Not
> that it matters at this stage, but it probably took you a long time to
> upload this branch if it could not be stacked.
>
>
> --
> https://code.launchpad.net/~sbi/ocb-addons/bug_1084822/+merge/174881
> You are the owner of lp:~sbi/ocb-addons/bug_1084822.
>

Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

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-06-12 15:38:14 +0000
3+++ account/account_invoice.py 2013-07-15 22:32:27 +0000
4@@ -1668,7 +1668,7 @@
5 'invoice_id': fields.many2one('account.invoice', 'Invoice Line', ondelete='cascade', select=True),
6 'name': fields.char('Tax Description', size=64, required=True),
7 'account_id': fields.many2one('account.account', 'Tax Account', required=True, domain=[('type','<>','view'),('type','<>','income'), ('type', '<>', 'closed')]),
8- 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic account'),
9+ 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic account', readonly=True),
10 'base': fields.float('Base', digits_compute=dp.get_precision('Account')),
11 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
12 'manual': fields.boolean('Manual'),
13@@ -1746,6 +1746,14 @@
14 val['account_id'] = tax['account_paid_id'] or line.account_id.id
15 val['account_analytic_id'] = tax['account_analytic_paid_id']
16
17+ # If the taxes generate moves on the same financial account as the invoice line
18+ # and no default analytic account is defined at the tax level, propagate the
19+ # analytic account from the invoice line to the tax line. This is necessary
20+ # in situations were (part of) the taxes cannot be reclaimed,
21+ # to ensure the tax move is allocated to the proper analytic account.
22+ if not val.get('account_analytic_id') and line.account_analytic_id and val['account_id'] == line.account_id.id:
23+ val['account_analytic_id'] = line.account_analytic_id.id
24+
25 key = (val['tax_code_id'], val['base_code_id'], val['account_id'], val['account_analytic_id'])
26 if not key in tax_grouped:
27 tax_grouped[key] = val