mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
54 lines
1.7 KiB
Diff
54 lines
1.7 KiB
Diff
diff -r 789627e0bee6 __init__.py
|
|
--- a/trytond/trytond/modules/company/__init__.py Wed Sep 02 13:52:23 2015 +0200
|
|
+++ 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 @@
|
|
|
|
__all__ = ['Company', 'Employee', 'UserEmployee', 'User', 'Property',
|
|
'Sequence', 'SequenceStrict', 'Date', 'CompanyConfigStart',
|
|
- 'CompanyConfig', 'CompanyReport', 'LetterReport']
|
|
+ 'CompanyConfig', 'CompanyReport', 'LetterReport', 'Rule']
|
|
__metaclass__ = PoolMeta
|
|
|
|
|
|
@@ -249,6 +249,14 @@
|
|
values['employee'] = employee_id
|
|
return result
|
|
|
|
+ @classmethod
|
|
+ def write(cls, *args):
|
|
+ pool = Pool()
|
|
+ Rule = pool.get('ir.rule')
|
|
+ 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'),)
|