mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
Update patch for issue5000
This commit is contained in:
parent
9a215b43d8
commit
3635653653
|
@ -1,22 +1,53 @@
|
||||||
# HG changeset patch
|
diff -r 789627e0bee6 __init__.py
|
||||||
# User Sergi Almacellas Abellana <sergi@koolpi.com>
|
--- a/trytond/trytond/modules/company/__init__.py Wed Sep 02 13:52:23 2015 +0200
|
||||||
ir rule domain_get cache should depend on context
|
+++ b/trytond/trytond/modules/company/__init__.py Wed Sep 30 17:05:19 2015 +0200
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
Cron,
|
||||||
|
CronCompany,
|
||||||
|
PartyConfiguration,
|
||||||
|
+ Rule,
|
||||||
|
module='company', type_='model')
|
||||||
|
Pool.register(
|
||||||
|
CompanyConfig,
|
||||||
|
diff -r 789627e0bee6 company.py
|
||||||
|
--- a/trytond/trytond/modules/company/company.py Wed Sep 02 13:52:23 2015 +0200
|
||||||
|
+++ b/trytond/trytond/modules/company/company.py Wed Sep 30 17:05:19 2015 +0200
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
|
||||||
issue5000
|
__all__ = ['Company', 'Employee', 'UserEmployee', 'User', 'Property',
|
||||||
review17541003
|
'Sequence', 'SequenceStrict', 'Date', 'CompanyConfigStart',
|
||||||
|
- 'CompanyConfig', 'CompanyReport', 'LetterReport']
|
||||||
|
+ 'CompanyConfig', 'CompanyReport', 'LetterReport', 'Rule']
|
||||||
|
__metaclass__ = PoolMeta
|
||||||
|
|
||||||
Index: trytond/trytond/ir/rule.py
|
|
||||||
===================================================================
|
|
||||||
|
|
||||||
--- a/trytond/trytond/ir/rule.py
|
@@ -249,6 +249,14 @@
|
||||||
+++ b/trytond/trytond/ir/rule.py
|
values['employee'] = employee_id
|
||||||
@@ -100,7 +100,7 @@
|
return result
|
||||||
required=True, ondelete="CASCADE")
|
|
||||||
domain = fields.Char('Domain', required=True,
|
|
||||||
help='Domain is evaluated with "user" as the current user')
|
|
||||||
- _domain_get_cache = Cache('ir_rule.domain_get', context=False)
|
|
||||||
+ _domain_get_cache = Cache('ir_rule.domain_get', context=True)
|
|
||||||
|
|
||||||
@classmethod
|
+ @classmethod
|
||||||
def __setup__(cls):
|
+ def write(cls, *args):
|
||||||
|
+ pool = Pool()
|
||||||
|
+ Rule = pool.get('ir.urle')
|
||||||
|
+ super(User, cls).write(*args)
|
||||||
|
+ # Restart the cache on the domain_get method
|
||||||
|
+ Rule._domain_get_cache.clear()
|
||||||
|
+
|
||||||
|
|
||||||
|
class Property:
|
||||||
|
__name__ = 'ir.property'
|
||||||
|
@@ -361,3 +369,14 @@
|
||||||
|
|
||||||
|
class LetterReport(CompanyReport):
|
||||||
|
__name__ = 'party.letter'
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+class Rule:
|
||||||
|
+ __name__ = 'ir.rule'
|
||||||
|
+
|
||||||
|
+ @classmethod
|
||||||
|
+ def _get_cache_key(cls):
|
||||||
|
+ key = super(Rule, cls)._get_cache_key()
|
||||||
|
+ # XXX Use company from context instead of browse to prevent infinite
|
||||||
|
+ # loop, but the cache is cleared when User is written.
|
||||||
|
+ return key + (Transaction().context.get('company'),)
|
||||||
|
|
Loading…
Reference in a new issue