From 3d9c8b0513627cfa516e46e06907a11b4a19965e Mon Sep 17 00:00:00 2001
From: "cbi@openerp.my.openerp.com" <>
Date: Fri, 17 May 2013 10:02:46 +0200
Subject: [PATCH 1/3] [FIX] missing multi company currency access rules, set
currency.company_id to False by default
lp bug: https://launchpad.net/bugs/1111298 fixed
bzr revid: alexandre.fayolle@camptocamp.com-20130517080246-k23d8hd0ks36cr5l
---
openerp/addons/base/res/res_currency.py | 1 +
openerp/addons/base/security/base_security.xml | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/openerp/addons/base/res/res_currency.py b/openerp/addons/base/res/res_currency.py
index 98dd6ed00d8..4756cdbe01a 100644
--- a/openerp/addons/base/res/res_currency.py
+++ b/openerp/addons/base/res/res_currency.py
@@ -73,6 +73,7 @@ class res_currency(osv.osv):
'position' : 'after',
'rounding': 0.01,
'accuracy': 4,
+ 'company_id': False,
}
_sql_constraints = [
# this constraint does not cover all cases due to SQL NULL handling for company_id,
diff --git a/openerp/addons/base/security/base_security.xml b/openerp/addons/base/security/base_security.xml
index b0de06078af..6bddd57d4b3 100644
--- a/openerp/addons/base/security/base_security.xml
+++ b/openerp/addons/base/security/base_security.xml
@@ -87,6 +87,14 @@
['|','|',('company_id.child_ids','child_of',[user.company_id.id]),('company_id','child_of',[user.company_id.id]),('company_id','=',False)]
+
+
+ currency rule
+
+
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
+
From 89efc89651c2cb00242c6699a75d403bcb643598 Mon Sep 17 00:00:00 2001
From: Alexandre Fayolle
Date: Fri, 17 May 2013 10:03:19 +0200
Subject: [PATCH 2/3] [FIX] remove company_id from currencies in
currency_data.xml
lp bug: https://launchpad.net/bugs/1111298 fixed
bzr revid: alexandre.fayolle@camptocamp.com-20130517080319-ct4j81mc01dr1e2v
---
openerp/addons/base/currency_data.xml | 174 --------------------------
1 file changed, 174 deletions(-)
diff --git a/openerp/addons/base/currency_data.xml b/openerp/addons/base/currency_data.xml
index 7173b8492ab..96ff81cc0d1 100644
--- a/openerp/addons/base/currency_data.xml
+++ b/openerp/addons/base/currency_data.xml
@@ -9,7 +9,6 @@
0.01
4
before
-
1.2834
@@ -23,7 +22,6 @@
Bs.F
0.0001
4
-
5.864
@@ -36,7 +34,6 @@
$
0.01
4
-
1.3388
@@ -50,7 +47,6 @@
CHF
0.01
4
-
1.3086
@@ -63,7 +59,6 @@
R$
0.01
4
-
2.2344
@@ -76,7 +71,6 @@
¥
0.01
4
-
8.7556
@@ -90,7 +84,6 @@
$
0.01
4
-
2933.8378
@@ -103,7 +96,6 @@
Kč
0.01
4
-
26.5634
@@ -116,7 +108,6 @@
kr
0.01
4
-
7.4445
@@ -130,7 +121,6 @@
Ft
0.01
4
-
271.5621
@@ -143,7 +133,6 @@
Rp
0.01
4
-
14352.00
@@ -161,7 +150,6 @@
Ls
0.01
4
-
0.7086
@@ -174,7 +162,6 @@
kr
0.01
4
-
7.8668
@@ -187,7 +174,6 @@
XPF
1.00
4
-
119.331742
@@ -200,7 +186,6 @@
B/.
0.01
4
-
1.2676
@@ -213,7 +198,6 @@
zł
0.01
4
-
4.1005
@@ -226,7 +210,6 @@
kr
0.01
4
-
10.3004
@@ -239,7 +222,6 @@
$
0.01
4
-
5.0881
@@ -252,7 +234,6 @@
₹
0.01
4
-
59.9739
@@ -265,7 +246,6 @@
$
0.01
4
-
1.4070
@@ -278,7 +258,6 @@
₴
0.01
4
-
10.1969
@@ -291,7 +270,6 @@
₫
0.01
4
-
26330.01
@@ -304,7 +282,6 @@
$
0.01
4
-
11.1608
@@ -317,7 +294,6 @@
¥
0.01
4
-
133.62
@@ -330,7 +306,6 @@
лв
0.01
4
-
1.9558
@@ -343,7 +318,6 @@
Lt
0.01
4
-
3.4528
@@ -356,7 +330,6 @@
lei
0.01
4
-
4.2253
@@ -369,7 +342,6 @@
kn
0.01
4
-
7.2936
@@ -382,7 +354,6 @@
руб
0.01
4
-
43.16
@@ -395,7 +366,6 @@
TL
0.01
4
-
2.1411
@@ -408,7 +378,6 @@
₩
0.01
4
-
1662.37
@@ -421,7 +390,6 @@
$
0.01
4
-
18.6664
@@ -434,7 +402,6 @@
RM
0.01
4
-
4.8887
@@ -447,7 +414,6 @@
$
0.01
4
-
1.9764
@@ -460,7 +426,6 @@
Php
0.01
4
-
66.1
@@ -473,7 +438,6 @@
$
0.01
4
-
2.0126
@@ -486,7 +450,6 @@
R
0.01
4
-
10.5618
@@ -515,7 +478,6 @@
Rs
0.01
4
-
40.28
@@ -528,7 +490,6 @@
CFA
1
4
-
655.957
@@ -541,7 +502,6 @@
FCFA
1
4
-
655.957
@@ -554,7 +514,6 @@
USh
1
4
-
3401.91388
@@ -567,7 +526,6 @@
L
0.01
4
-
25
@@ -580,7 +538,6 @@
$
0.01
4
-
710
@@ -593,7 +550,6 @@
$
0.01
4
-
@@ -606,7 +562,6 @@
Afs
0.01
4
-
@@ -619,7 +574,6 @@
Kz
0.01
4
-
@@ -632,7 +586,6 @@
$
0.01
4
-
@@ -645,7 +598,6 @@
դր.
0.01
4
-
@@ -658,7 +610,6 @@
Afl.
0.01
4
-
@@ -671,7 +622,6 @@
m
0.01
4
-
@@ -684,7 +634,6 @@
B$
0.01
4
-
@@ -697,7 +646,6 @@
BD
0.01
4
-
@@ -710,7 +658,6 @@
৳
0.01
4
-
@@ -723,7 +670,6 @@
Bds$
0.01
4
-
@@ -736,7 +682,6 @@
BR
0.01
4
-
@@ -749,7 +694,6 @@
BZ$
0.01
4
-
@@ -762,7 +706,6 @@
BD$
0.01
4
-
@@ -775,7 +718,6 @@
Nu.
0.01
4
-
@@ -788,7 +730,6 @@
Bs.
0.01
4
-
@@ -801,7 +742,6 @@
KM
0.01
4
-
@@ -814,7 +754,6 @@
P
0.01
4
-
@@ -827,7 +766,6 @@
FBu
0.01
4
-
@@ -840,7 +778,6 @@
៛
0.01
4
-
@@ -853,7 +790,6 @@
$
0.01
4
-
@@ -866,7 +802,6 @@
CF
0.01
4
-
@@ -879,7 +814,6 @@
Fr
0.01
4
-
@@ -892,7 +826,6 @@
$
0.01
4
-
@@ -905,7 +838,6 @@
ƒ
0.01
4
-
@@ -918,7 +850,6 @@
£
0.01
4
-
@@ -931,7 +862,6 @@
Fdj
0.01
4
-
@@ -944,7 +874,6 @@
RD$
0.01
4
-
@@ -957,7 +886,6 @@
TPE
0.01
4
-
@@ -970,7 +898,6 @@
S/.
0.01
4
-
@@ -983,7 +910,6 @@
E£
0.01
4
-
@@ -996,7 +922,6 @@
¢
0.01
4
-
@@ -1009,7 +934,6 @@
Nfk
0.01
4
-
@@ -1022,7 +946,6 @@
kr
0.01
4
-
@@ -1035,7 +958,6 @@
Br
0.01
4
-
@@ -1048,7 +970,6 @@
£
0.01
4
-
@@ -1061,7 +982,6 @@
FJ$
0.01
4
-
@@ -1074,7 +994,6 @@
ლ
0.01
4
-
@@ -1087,7 +1006,6 @@
£
0.01
4
-
@@ -1100,7 +1018,6 @@
Q
0.01
4
-
@@ -1113,7 +1030,6 @@
FG
0.01
4
-
@@ -1125,7 +1041,6 @@
GWP
0.01
4
-
@@ -1138,7 +1053,6 @@
$
0.01
4
-
@@ -1151,7 +1065,6 @@
G
0.01
4
-
@@ -1164,7 +1077,6 @@
kr
0.01
4
-
@@ -1177,7 +1089,6 @@
﷼
0.01
4
-
@@ -1190,7 +1101,6 @@
ع.د
0.01
4
-
@@ -1203,7 +1113,6 @@
₪
0.01
4
-
@@ -1216,7 +1125,6 @@
$
0.01
4
-
@@ -1229,7 +1137,6 @@
د.ا
0.01
4
-
@@ -1242,7 +1149,6 @@
лв
0.01
4
-
@@ -1255,7 +1161,6 @@
KSh
0.01
4
-
@@ -1268,7 +1173,6 @@
د.ك
0.01
4
-
@@ -1281,7 +1185,6 @@
лв
0.01
4
-
@@ -1294,7 +1197,6 @@
₭
0.01
4
-
@@ -1307,7 +1209,6 @@
ل.ل
0.01
4
-
@@ -1320,7 +1221,6 @@
L
0.01
4
-
@@ -1333,7 +1233,6 @@
L$
0.01
4
-
@@ -1346,7 +1245,6 @@
ل.د
0.01
4
-
@@ -1359,7 +1257,6 @@
MOP$
0.01
4
-
@@ -1372,7 +1269,6 @@
ден
0.01
4
-
@@ -1385,7 +1281,6 @@
Ar
0.01
4
-
@@ -1398,7 +1293,6 @@
MK
0.01
4
-
@@ -1411,7 +1305,6 @@
.ރ
0.01
4
-
@@ -1424,7 +1317,6 @@
UM
0.01
4
-
@@ -1437,7 +1329,6 @@
L
0.01
4
-
@@ -1450,7 +1341,6 @@
₮
0.01
4
-
@@ -1463,7 +1353,6 @@
د.م.
0.01
4
-
@@ -1476,7 +1365,6 @@
$
0.01
4
-
@@ -1489,7 +1377,6 @@
DZ
0.01
4
-
@@ -1502,7 +1389,6 @@
GH¢
0.01
4
-
@@ -1515,7 +1401,6 @@
D
0.01
4
-
@@ -1528,7 +1413,6 @@
Ƶ
0.01
4
-
@@ -1541,7 +1425,6 @@
MT
0.01
4
-
@@ -1554,7 +1437,6 @@
K
0.01
4
-
@@ -1567,7 +1449,6 @@
$
0.01
4
-
@@ -1580,7 +1461,6 @@
₨
0.01
4
-
@@ -1593,7 +1473,6 @@
L
0.01
4
-
@@ -1606,7 +1485,6 @@
C$
0.01
4
-
@@ -1619,7 +1497,6 @@
₦
0.01
4
-
@@ -1632,7 +1509,6 @@
₩
0.01
4
-
@@ -1645,7 +1521,6 @@
Z$
0.01
4
-
@@ -1658,7 +1533,6 @@
ZK
0.01
4
-
@@ -1671,7 +1545,6 @@
﷼
0.01
4
-
@@ -1684,7 +1557,6 @@
Bs
0.01
4
-
@@ -1697,7 +1569,6 @@
€
0.01
4
-
@@ -1710,7 +1581,6 @@
VT
0.01
4
-
@@ -1723,7 +1593,6 @@
лв
0.01
4
-
@@ -1736,7 +1605,6 @@
$U
0.01
4
-
@@ -1749,7 +1617,6 @@
د.إ
0.01
4
-
@@ -1762,7 +1629,6 @@
₴
0.01
4
-
@@ -1775,7 +1641,6 @@
m
0.01
4
-
@@ -1788,7 +1653,6 @@
TL
0.01
4
-
@@ -1801,7 +1665,6 @@
DT
0.01
4
-
@@ -1814,7 +1677,6 @@
$
0.01
4
-
@@ -1827,7 +1689,6 @@
T$
0.01
4
-
@@ -1840,7 +1701,6 @@
฿
0.01
4
-
@@ -1853,7 +1713,6 @@
x/y
0.01
4
-
@@ -1865,7 +1724,6 @@
TJR
0.01
4
-
@@ -1878,7 +1736,6 @@
NT$
0.01
4
-
@@ -1891,7 +1748,6 @@
£
0.01
4
-
@@ -1904,7 +1760,6 @@
E
0.01
4
-
@@ -1917,7 +1772,6 @@
$
0.01
4
-
@@ -1930,7 +1784,6 @@
£Sd
0.01
4
-
@@ -1943,7 +1796,6 @@
Rs
0.01
4
-
@@ -1956,7 +1808,6 @@
£
0.01
4
-
@@ -1970,7 +1821,6 @@
0.01
4
before
-
@@ -1983,7 +1833,6 @@
Sh.
0.01
4
-
@@ -1996,7 +1845,6 @@
SI$
0.01
4
-
@@ -2009,7 +1857,6 @@
Le
0.01
4
-
@@ -2022,7 +1869,6 @@
SR
0.01
4
-
@@ -2035,7 +1881,6 @@
din.
0.01
4
-
@@ -2048,7 +1893,6 @@
SR
0.01
4
-
@@ -2061,7 +1905,6 @@
Db
0.01
4
-
@@ -2074,7 +1917,6 @@
₤
0.01
4
-
@@ -2087,7 +1929,6 @@
WS$
0.01
4
-
@@ -2100,7 +1941,6 @@
£
0.01
4
-
@@ -2113,7 +1953,6 @@
RF
0.01
4
-
@@ -2126,7 +1965,6 @@
R
0.01
4
-
@@ -2139,7 +1977,6 @@
L
0.01
4
-
@@ -2152,7 +1989,6 @@
QR
0.01
4
-
@@ -2165,7 +2001,6 @@
zł
0.01
4
-
@@ -2178,7 +2013,6 @@
S/.
0.01
4
-
@@ -2191,7 +2025,6 @@
₲
0.01
4
-
@@ -2204,7 +2037,6 @@
K
0.01
4
-
@@ -2217,7 +2049,6 @@
Rs.
0.01
4
-
@@ -2230,7 +2061,6 @@
ر.ع.
0.01
4
-
@@ -2243,7 +2073,6 @@
$
0.01
4
-
@@ -2256,7 +2085,6 @@
Sk
0.01
4
-
@@ -2268,7 +2096,6 @@
SIT
0.01
4
-
@@ -2281,7 +2108,6 @@
дин.
0.01
4
-
From 8d639576f070807e7b5ad6e746be1e55ec59b333 Mon Sep 17 00:00:00 2001
From: Olivier Dony
Date: Fri, 17 May 2013 16:17:26 +0200
Subject: [PATCH 3/3] [FIX] modify domain evaluation tests to avoid relying on
res.currency entries assigned to companies, as demo data was modified for bug
1111298
lp bug: https://launchpad.net/bugs/1111298 fixed
bzr revid: odo@openerp.com-20130517141726-67utxubzdflsgsnx
---
.../addons/base/test/test_osv_expression.yml | 26 +++++++++----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/openerp/addons/base/test/test_osv_expression.yml b/openerp/addons/base/test/test_osv_expression.yml
index f1610e8b3a4..1516f090e94 100644
--- a/openerp/addons/base/test/test_osv_expression.yml
+++ b/openerp/addons/base/test/test_osv_expression.yml
@@ -291,22 +291,22 @@
assert res_101 == [], 'res_101: expected %r, got %r' % ([], res_101)
assert res_102 == company_ids, 'res_102: expected %r, got %r' % (company_ids, res_102)
-
- Property of the query (one2many != False).
+ Verify domain evaluation for `one2many != False`
-
- !python {model: res.currency }: |
- ids = self.search(cr, uid, [])
- referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)])
- companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '!=', False)]))
- assert referenced_companies == companies
+ !python {model: res.partner.category }: |
+ all_ids = self.search(cr, uid, [])
+ parent_categs = set([c.parent_id.id for c in self.browse(cr, uid, all_ids) if c.parent_id])
+ result = set(self.search(cr, uid, [('child_ids', '!=', False)]))
+ assert result and result == parent_categs, "Got %r, expected %r" % (result, parent_categs)
-
- Property of the query (one2many = False).
+ Verify domain evaluation for `one2many == False`
-
- !python {model: res.currency }: |
- ids = self.search(cr, uid, [])
- referenced_companies = set([x.company_id.id for x in self.browse(cr, uid, ids)])
- unreferenced_companies = set(self.pool.get('res.company').search(cr, uid, [])).difference(referenced_companies)
- companies = set(self.pool.get('res.company').search(cr, uid, [('currency_ids', '=', False)]))
- assert unreferenced_companies == companies
+ !python {model: res.partner.category }: |
+ all_ids = self.search(cr, uid, [])
+ parent_categs = set([c.parent_id.id for c in self.browse(cr, uid, all_ids) if c.parent_id])
+ leaf_categs = set(all_ids) - parent_categs
+ result = set(self.search(cr, uid, [('child_ids', '=', False)]))
+ assert result and result == leaf_categs, "Got %r, expected %r" % (result, leaf_categs)
-
Equivalent queries.
-