add several patches to inmprove performance on invoice/shipment list views

This commit is contained in:
?ngel ?lvarez Serra 2013-12-16 18:03:43 +01:00
parent 98ccb0cb3d
commit 66cb51e2d3
5 changed files with 208 additions and 0 deletions

20
issue2321002_1.diff Normal file
View file

@ -0,0 +1,20 @@
Index: invoice.py
===================================================================
--- ./trytond/trytond/modules/account_invoice/invoice.py
+++ ./trytond/trytond/modules/account_invoice/invoice.py
@@ -559,9 +559,11 @@
invoices_no_move = []
for invoice in invoices:
if invoice.move:
- invoices_move.append(invoice)
+ invoices_move.append(invoice.id)
else:
- invoices_no_move.append(invoice)
+ invoices_no_move.append(invoice.id)
+ invoices_move = cls.browse(invoices_move)
+ invoices_no_move = cls.browse(invoices_no_move)
type_name = cls.total_amount._field.sql_type().base
invoice = cls.__table__()

32
issue2331002_1.diff Normal file
View file

@ -0,0 +1,32 @@
Index: invoice.py
===================================================================
--- ./trytond/trytond/modules/account_invoice/invoice.py
+++ ./trytond/trytond/modules/account_invoice/invoice.py
@@ -1049,24 +1049,11 @@
default['invoice_report_cache'] = None
default['invoice_report_format'] = None
default['payment_lines'] = None
- default['lines'] = None
- default['taxes'] = None
default.setdefault('invoice_date', None)
default.setdefault('accounting_date', None)
default['lines_to_pay'] = None
default.setdefault('origin', None)
-
- new_invoices = []
- for invoice in invoices:
- new_invoice, = super(Invoice, cls).copy([invoice], default=default)
- Line.copy(invoice.lines, default={
- 'invoice': new_invoice.id,
- })
- Tax.copy(invoice.taxes, default={
- 'invoice': new_invoice.id,
- })
- new_invoices.append(new_invoice)
- return new_invoices
+ return super(Invoice, cls).copy(invoices, default=default)
@classmethod
def validate(cls, invoices):

32
issue2331002_1_10001.diff Normal file
View file

@ -0,0 +1,32 @@
Index: invoice.py
===================================================================
--- ./trytond/trytond/modules/account_invoice/invoice.py
+++ ./trytond/trytond/modules/account_invoice/invoice.py
@@ -1049,24 +1049,11 @@
default['invoice_report_cache'] = None
default['invoice_report_format'] = None
default['payment_lines'] = None
- default['lines'] = None
- default['taxes'] = None
default.setdefault('invoice_date', None)
default.setdefault('accounting_date', None)
default['lines_to_pay'] = None
default.setdefault('origin', None)
-
- new_invoices = []
- for invoice in invoices:
- new_invoice, = super(Invoice, cls).copy([invoice], default=default)
- Line.copy(invoice.lines, default={
- 'invoice': new_invoice.id,
- })
- Tax.copy(invoice.taxes, default={
- 'invoice': new_invoice.id,
- })
- new_invoices.append(new_invoice)
- return new_invoices
+ return super(Invoice, cls).copy(invoices, default=default)
@classmethod
def validate(cls, invoices):

120
issue2341002_1_10001.diff Normal file
View file

@ -0,0 +1,120 @@
Index: shipment.py
===================================================================
--- ./trytond/trytond/modules/stock/shipment.py
+++ ./trytond/trytond/modules/stock/shipment.py
@@ -60,9 +60,9 @@
supplier = fields.Many2One('party.party', 'Supplier',
states={
'readonly': And(Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('incoming_moves'))), Bool(Eval('supplier'))),
+ Bool(Eval('incoming_moves', [0]))), Bool(Eval('supplier'))),
}, on_change=['supplier'], required=True,
- depends=['state', 'incoming_moves', 'supplier'])
+ depends=['state', 'supplier'])
supplier_location = fields.Function(fields.Many2One('stock.location',
'Supplier Location', on_change_with=['supplier']),
'on_change_with_supplier_location')
@@ -75,8 +75,8 @@
required=True, domain=[('type', '=', 'warehouse')],
states={
'readonly': Or(In(Eval('state'), ['cancel', 'done']),
- Bool(Eval('incoming_moves'))),
- }, depends=['state', 'incoming_moves'])
+ Bool(Eval('incoming_moves', [0]))),
+ }, depends=['state'])
warehouse_input = fields.Function(fields.Many2One('stock.location',
'Warehouse Input', on_change_with=['warehouse']),
'on_change_with_warehouse_input')
@@ -496,15 +496,15 @@
from_location = fields.Many2One('stock.location', "From Location",
required=True, states={
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('moves'))),
+ Bool(Eval('moves', [0]))),
}, domain=[('type', '=', 'storage')],
- depends=['state', 'moves'])
+ depends=['state'])
to_location = fields.Many2One('stock.location', "To Location",
required=True, states={
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('moves'))),
+ Bool(Eval('moves', [0]))),
}, domain=[('type', '=', 'supplier')],
- depends=['state', 'moves'])
+ depends=['state'])
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
states={
'readonly': And(Or(Not(Equal(Eval('state'), 'draft')),
@@ -797,9 +797,9 @@
customer = fields.Many2One('party.party', 'Customer', required=True,
states={
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('outgoing_moves'))),
+ Bool(Eval('outgoing_moves', [0]))),
}, on_change=['customer'],
- depends=['state', 'outgoing_moves'])
+ depends=['state'])
customer_location = fields.Function(fields.Many2One('stock.location',
'Customer Location', on_change_with=['customer']),
'on_change_with_customer_location')
@@ -816,9 +816,9 @@
warehouse = fields.Many2One('stock.location', "Warehouse", required=True,
states={
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('outgoing_moves'))),
+ Bool(Eval('outgoing_moves', [0]))),
}, domain=[('type', '=', 'warehouse')],
- depends=['state', 'outgoing_moves'])
+ depends=['state'])
warehouse_storage = fields.Function(fields.Many2One('stock.location',
'Warehouse Storage', on_change_with=['warehouse']),
'on_change_with_warehouse_storage')
@@ -1329,9 +1329,9 @@
customer = fields.Many2One('party.party', 'Customer', required=True,
states={
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('incoming_moves'))),
+ Bool(Eval('incoming_moves', [0]))),
}, on_change=['customer'],
- depends=['state', 'incoming_moves'])
+ depends=['state'])
customer_location = fields.Function(fields.Many2One('stock.location',
'Customer Location', on_change_with=['customer']),
'on_change_with_customer_location')
@@ -1348,9 +1348,9 @@
warehouse = fields.Many2One('stock.location', "Warehouse", required=True,
states={
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('incoming_moves'))),
+ Bool(Eval('incoming_moves', [0]))),
}, domain=[('type', '=', 'warehouse')],
- depends=['state', 'incoming_moves'])
+ depends=['state'])
warehouse_storage = fields.Function(fields.Many2One('stock.location',
'Warehouse Storage', on_change_with=['warehouse']),
'on_change_with_warehouse_storage')
@@ -1774,18 +1774,18 @@
from_location = fields.Many2One('stock.location', "From Location",
required=True, states={
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('moves'))),
+ Bool(Eval('moves', [0]))),
},
domain=[
('type', 'in', ['storage']),
- ], depends=['state', 'moves'])
+ ], depends=['state'])
to_location = fields.Many2One('stock.location', "To Location",
required=True, states={
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
- Bool(Eval('moves'))),
+ Bool(Eval('moves', [0]))),
}, domain=[
('type', 'in', ['storage']),
- ], depends=['state', 'moves'])
+ ], depends=['state'])
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
states={
'readonly': ((Eval('state') != 'draft')

4
series
View file

@ -1,3 +1,7 @@
issue2341002_1_10001.diff
issue2331002_1.diff
issue2331002_1_10001.diff
issue2321002_1.diff
issue971002_127001.diff
issue1961002_40001.diff
issue10739.diff