From 667aed8957264bc1298eb22b58ccc25acc2e5dbf Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Tue, 21 Jul 2015 12:50:32 +0200 Subject: [PATCH] Add patch for issue4884 --- domain_field.diff | 65 +++++++++++++++++++++++++++++++++++++++++++++++ series | 1 + 2 files changed, 66 insertions(+) create mode 100644 domain_field.diff diff --git a/domain_field.diff b/domain_field.diff new file mode 100644 index 0000000..dabfd97 --- /dev/null +++ b/domain_field.diff @@ -0,0 +1,65 @@ +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) diff --git a/series b/series index ed47bce..5dced76 100644 --- a/series +++ b/series @@ -58,3 +58,4 @@ issue17281002_20001.diff issue20301003_1.diff #invoice_speedup.diff babi_multiprocess.diff +domain_field.diff