Fix problem with a fucntion used that it's not in v3.4

This commit is contained in:
Bernat Brunet Torruella 2016-04-28 15:39:19 +02:00
parent b737233ebf
commit 24a8a37a58
1 changed files with 6 additions and 9 deletions

View File

@ -19,7 +19,7 @@ Index: trytond/trytond/modules/account_invoice/invoice.py
from trytond.model import Workflow, ModelView, ModelSQL, fields
from trytond.report import Report
@@ -737,16 +737,30 @@
@@ -737,16 +737,29 @@
Rule = pool.get('ir.rule')
Line = pool.get('account.invoice.line')
Tax = pool.get('account.invoice.tax')
@ -38,7 +38,6 @@ Index: trytond/trytond/modules/account_invoice/invoice.py
- Coalesce(Sum(line.quantity * line.unit_price), 0
- ).as_('total_amount'),
+ _, operator, value = clause
+ invoice_query = Rule.query_get('account.invoice')
+ Operator = fields.SQL_OPERATORS[operator]
+ # SQLite uses float for sum
+ if backend.name() == 'sqlite':
@ -53,7 +52,7 @@ Index: trytond/trytond/modules/account_invoice/invoice.py
where=line.invoice.in_(invoice_query),
group_by=line.invoice)
| tax.select(tax.invoice.as_('invoice'),
@@ -755,7 +769,7 @@
@@ -755,7 +768,7 @@
group_by=tax.invoice))
query = union.select(union.invoice, group_by=union.invoice,
having=Operator(Sum(union.total_amount).cast(type_name),
@ -62,7 +61,7 @@ Index: trytond/trytond/modules/account_invoice/invoice.py
return [('id', 'in', query)]
@classmethod
@@ -763,17 +777,32 @@
@@ -763,17 +776,32 @@
pool = Pool()
Rule = pool.get('ir.rule')
Line = pool.get('account.invoice.line')
@ -73,10 +72,9 @@ Index: trytond/trytond/modules/account_invoice/invoice.py
+ invoice = Invoice.__table__()
+ currency = Currency.__table__()
- invoice_query = Rule.domain_get('account.invoice')
- Operator = fields.SQL_OPERATORS[clause[1]]
+ _, operator, value = clause
+ invoice_query = Rule.query_get('account.invoice')
invoice_query = Rule.domain_get('account.invoice')
- Operator = fields.SQL_OPERATORS[clause[1]]
+ Operator = fields.SQL_OPERATORS[operator]
+ # SQLite uses float for sum
+ if backend.name() == 'sqlite':
@ -102,7 +100,7 @@ Index: trytond/trytond/modules/account_invoice/invoice.py
return [('id', 'in', query)]
@classmethod
@@ -784,14 +813,18 @@
@@ -784,14 +812,18 @@
type_name = cls.tax_amount._field.sql_type().base
tax = Tax.__table__()
@ -122,4 +120,3 @@ Index: trytond/trytond/modules/account_invoice/invoice.py
+ value))
return [('id', 'in', query)]
def get_tax_context(self):