trytond-patches/domain_field.diff
Sergi Almacellas Abellana 667aed8957 Add patch for issue4884
2015-07-21 12:50:32 +02:00

65 lines
2.8 KiB
Diff

diff -r 1a22411f9264 trytond/trytond/model/fields/many2many.py
--- a/trytond/trytond/model/fields/many2many.py Thu Jul 16 01:13:45 2015 +0200
+++ b/trytond/trytond/model/fields/many2many.py Mon Jul 20 14:20:18 2015 +0200
@@ -270,6 +270,9 @@
transaction = Transaction()
table, _ = tables[None]
name, operator, value = domain[:3]
+ method = getattr(Model, 'domain_%s' % name, None)
+ if method:
+ return method(domain, tables)
if Relation._history and transaction.context.get('_datetime'):
relation = Relation.__table_history__()
diff -r 1a22411f9264 trytond/trytond/model/fields/many2one.py
--- a/trytond/trytond/model/fields/many2one.py Thu Jul 16 01:13:45 2015 +0200
+++ b/trytond/trytond/model/fields/many2one.py Mon Jul 20 14:20:18 2015 +0200
@@ -141,6 +141,9 @@
table, _ = tables[None]
name, operator, value = domain[:3]
+ method = getattr(Model, 'domain_%s' % name, None)
+ if method:
+ return method(domain, tables)
column = self.sql_column(table)
if '.' not in name:
if operator in ('child_of', 'not child_of'):
diff -r 1a22411f9264 trytond/trytond/model/fields/one2many.py
--- a/trytond/trytond/model/fields/one2many.py Thu Jul 16 01:13:45 2015 +0200
+++ b/trytond/trytond/model/fields/one2many.py Mon Jul 20 14:20:18 2015 +0200
@@ -231,6 +231,9 @@
transaction = Transaction()
table, _ = tables[None]
name, operator, value = domain[:3]
+ method = getattr(Model, 'domain_%s' % name, None)
+ if method:
+ return method(domain, tables)
if Target._history and transaction.context.get('_datetime'):
target = Target.__table_history__()
diff -r 1a22411f9264 trytond/trytond/model/fields/property.py
--- a/trytond/trytond/model/fields/property.py Thu Jul 16 01:13:45 2015 +0200
+++ b/trytond/trytond/model/fields/property.py Mon Jul 20 14:20:18 2015 +0200
@@ -72,6 +72,9 @@
cursor = Transaction().cursor
name, operator, value = domain
+ method = getattr(Model, 'domain_%s' % name, None)
+ if method:
+ return method(domain, tables)
sql_type = self._field.sql_type().base
diff -r 1a22411f9264 trytond/trytond/model/fields/reference.py
--- a/trytond/trytond/model/fields/reference.py Thu Jul 16 01:13:45 2015 +0200
+++ b/trytond/trytond/model/fields/reference.py Mon Jul 20 14:20:18 2015 +0200
@@ -125,6 +125,9 @@
return super(Reference, self).convert_domain(domain, tables, Model)
pool = Pool()
name, operator, value, target = domain[:4]
+ method = getattr(Model, 'domain_%s' % name, None)
+ if method:
+ return method(domain, tables)
Target = pool.get(target)
table, _ = tables[None]
name, target_name = name.split('.', 1)