trytond-patches/domain_field.diff

66 lines
2.9 KiB
Diff

diff -r 6c0d835dd918 trytond/trytond/model/fields/many2many.py
--- a/trytond/trytond/model/fields/many2many.py Wed May 11 10:40:32 2016 +0200
+++ b/trytond/trytond/model/fields/many2many.py Mon May 30 13:35:59 2016 +0200
@@ -287,6 +287,9 @@
table, _ = tables[None]
name, operator, value = domain[:3]
assert operator not in {'where', 'not where'} or '.' not in name
+ 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 6c0d835dd918 trytond/trytond/model/fields/many2one.py
--- a/trytond/trytond/model/fields/many2one.py Wed May 11 10:40:32 2016 +0200
+++ b/trytond/trytond/model/fields/many2one.py Mon May 30 13:35:59 2016 +0200
@@ -159,6 +159,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.endswith('child_of') or operator.endswith('parent_of'):
diff -r 6c0d835dd918 trytond/trytond/model/fields/one2many.py
--- a/trytond/trytond/model/fields/one2many.py Wed May 11 10:40:32 2016 +0200
+++ b/trytond/trytond/model/fields/one2many.py Mon May 30 13:35:59 2016 +0200
@@ -232,6 +232,9 @@
table, _ = tables[None]
name, operator, value = domain[:3]
assert operator not in {'where', 'not where'} or '.' not in name
+ 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 6c0d835dd918 trytond/trytond/model/fields/property.py
--- a/trytond/trytond/model/fields/property.py Wed May 11 10:40:32 2016 +0200
+++ b/trytond/trytond/model/fields/property.py Mon May 30 13:35:59 2016 +0200
@@ -75,6 +75,9 @@
cursor = Transaction().connection.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 6c0d835dd918 trytond/trytond/model/fields/reference.py
--- a/trytond/trytond/model/fields/reference.py Wed May 11 10:40:32 2016 +0200
+++ b/trytond/trytond/model/fields/reference.py Mon May 30 13:35:59 2016 +0200
@@ -124,6 +124,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)