Merge lp:~camptocamp/openobject-addons/trunk-fiscal-position-1028747 into lp:openobject-addons

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 7630
Proposed branch: lp:~camptocamp/openobject-addons/trunk-fiscal-position-1028747
Merge into: lp:openobject-addons
Diff against target: 51 lines (+16/-4)
1 file modified
account/partner.py (+16/-4)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/trunk-fiscal-position-1028747
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+116589@code.launchpad.net

Description of the change

Hello,

This is a fix for the issue lp:1028747

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 'account/partner.py'
2--- account/partner.py 2011-08-24 21:19:43 +0000
3+++ account/partner.py 2012-07-25 07:03:50 +0000
4@@ -44,17 +44,17 @@
5 return []
6 if not fposition_id:
7 return map(lambda x: x.id, taxes)
8- result = []
9+ result = set()
10 for t in taxes:
11 ok = False
12 for tax in fposition_id.tax_ids:
13 if tax.tax_src_id.id == t.id:
14 if tax.tax_dest_id:
15- result.append(tax.tax_dest_id.id)
16+ result.add(tax.tax_dest_id.id)
17 ok=True
18 if not ok:
19- result.append(t.id)
20- return result
21+ result.add(t.id)
22+ return list(result)
23
24 def map_account(self, cr, uid, fposition_id, account_id, context=None):
25 if not fposition_id:
26@@ -77,6 +77,12 @@
27 'tax_dest_id': fields.many2one('account.tax', 'Replacement Tax')
28 }
29
30+ _sql_constraints = [
31+ ('tax_src_dest_uniq',
32+ 'unique (position_id,tax_src_id,tax_dest_id)',
33+ 'A tax fiscal position could be defined only once time on same taxes.')
34+ ]
35+
36 account_fiscal_position_tax()
37
38 class account_fiscal_position_account(osv.osv):
39@@ -89,6 +95,12 @@
40 'account_dest_id': fields.many2one('account.account', 'Account Destination', domain=[('type','<>','view')], required=True)
41 }
42
43+ _sql_constraints = [
44+ ('account_src_dest_uniq',
45+ 'unique (position_id,account_src_id,account_dest_id)',
46+ 'An account fiscal position could be defined only once time on same accounts.')
47+ ]
48+
49 account_fiscal_position_account()
50
51 class res_partner(osv.osv):

Subscribers

People subscribed via source and target branches

to all changes: