changeset 3aa0d3c52d33 in modules/sale:default
details: https://hg.tryton.org/modules/sale?cmd=changeset&node=3aa0d3c52d33
description:
Send only the required fields when fetching a readonly view definition
issue11134
review380081002
diffstat:
configuration.py | 3 +-
party.py | 2 +-
product.py | 6 +---
sale.py | 72 ++++++++++++++++++++----------------------------------
sale_reporting.py | 12 +++-----
5 files changed, 36 insertions(+), 59 deletions(-)
diffs (355 lines):
diff -r 5076ae40e1f5 -r 3aa0d3c52d33 configuration.py
--- a/configuration.py Wed Apr 06 23:37:43 2022 +0200
+++ b/configuration.py Fri Apr 08 19:07:13 2022 +0200
@@ -75,8 +75,7 @@
domain=[
('company', 'in', [Eval('company', -1), None]),
('sequence_type', '=', Id('sale', 'sequence_type_sale')),
- ],
- depends=['company'])
+ ])
@classmethod
def __register__(cls, module_name):
diff -r 5076ae40e1f5 -r 3aa0d3c52d33 party.py
--- a/party.py Wed Apr 06 23:37:43 2022 +0200
+++ b/party.py Fri Apr 08 19:07:13 2022 +0200
@@ -66,7 +66,7 @@
context={
'company': Eval('company', -1),
},
- depends=['company'])
+ depends={'company'})
sale_invoice_method = fields.Selection(
'get_sale_invoice_method', "Sale Invoice Method")
sale_shipment_method = fields.Selection(
diff -r 5076ae40e1f5 -r 3aa0d3c52d33 product.py
--- a/product.py Wed Apr 06 23:37:43 2022 +0200
+++ b/product.py Fri Apr 08 19:07:13 2022 +0200
@@ -43,14 +43,12 @@
},
domain=[
('category', '=', Eval('default_uom_category')),
- ],
- depends=['salable', 'default_uom_category'])
+ ])
lead_time = fields.TimeDelta(
"Lead Time",
states={
'invisible': ~Eval('salable', False),
},
- depends=['salable'],
help="The time from confirming the sales order to sending the "
"products.\n"
"If empty the default lead time from the configuration is used.")
@@ -203,7 +201,7 @@
context={
'company': Eval('company', -1),
},
- depends=['company'])
+ depends={'company'})
sale_date = fields.Date("Sale Date")
quantity = fields.Float("Quantity")
diff -r 5076ae40e1f5 -r 3aa0d3c52d33 sale.py
--- a/sale.py Wed Apr 06 23:37:43 2022 +0200
+++ b/sale.py Fri Apr 08 19:07:13 2022 +0200
@@ -75,28 +75,24 @@
| Eval('party', True)
| Eval('invoice_party', True)
| Eval('shipment_party', True)),
- },
- depends=['state'])
+ })
number = fields.Char('Number', readonly=True, select=True)
reference = fields.Char('Reference', select=True)
description = fields.Char('Description',
states={
'readonly': Eval('state') != 'draft',
- },
- depends=['state'])
+ })
sale_date = fields.Date('Sale Date',
states={
'readonly': ~Eval('state').in_(['draft', 'quotation']),
'required': ~Eval('state').in_(
['draft', 'quotation', 'cancelled']),
- },
- depends=['state'])
+ })
payment_term = fields.Many2One('account.invoice.payment_term',
'Payment Term',
states={
'readonly': Eval('state') != 'draft',
- },
- depends=['state'])
+ })
party = fields.Many2One('party.party', 'Party', required=True, select=True,
states={
'readonly': ((Eval('state') != 'draft')
@@ -105,7 +101,7 @@
context={
'company': Eval('company', -1),
},
- depends=['state', 'company'])
+ depends={'company'})
party_lang = fields.Function(fields.Char('Party Language'),
'on_change_with_party_lang')
contact = fields.Many2One(
@@ -116,7 +112,7 @@
search_context={
'related_party': Eval('party'),
},
- depends=['party', 'company'])
+ depends={'company'})
invoice_party = fields.Many2One('party.party', "Invoice Party",
states={
'readonly': ((Eval('state') != 'draft')
@@ -128,7 +124,7 @@
search_context={
'related_party': Eval('party'),
},
- depends=['state', 'party', 'company'])
+ depends={'company'})
invoice_address = fields.Many2One('party.address', 'Invoice Address',
domain=[
('party', '=', If(Bool(Eval('invoice_party')),
@@ -138,7 +134,7 @@
'readonly': Eval('state') != 'draft',
'required': ~Eval('state').in_(
['draft', 'quotation', 'cancelled']),
- }, depends=['party', 'invoice_party', 'state'])
+ })
shipment_party = fields.Many2One('party.party', 'Shipment Party',
states={
'readonly': (Eval('state') != 'draft'),
@@ -149,7 +145,7 @@
search_context={
'related_party': Eval('party'),
},
- depends=['state', 'party', 'company'])
+ depends={'company'})
shipment_address = fields.Many2One('party.address', 'Shipment Address',
domain=[
('party', '=', If(Bool(Eval('shipment_party')),
@@ -157,23 +153,20 @@
],
states={
'readonly': Eval('state') != 'draft',
- },
- depends=['party', 'shipment_party', 'state'])
+ })
warehouse = fields.Many2One('stock.location', 'Warehouse',
domain=[('type', '=', 'warehouse')], states={
'readonly': Eval('state') != 'draft',
- },
- depends=['state'])
+ })
currency = fields.Many2One('currency.currency', 'Currency', required=True,
states={
'readonly': ((Eval('state') != 'draft')
| (Eval('lines', [0]) & Eval('currency', 0))),
- },
- depends=['state'])
+ })
lines = fields.One2Many('sale.line', 'sale', 'Lines', states={
'readonly': Eval('state') != 'draft',
},
- depends=['party', 'state'])
+ depends={'party'})
comment = fields.Text('Comment')
untaxed_amount = fields.Function(Monetary(
"Untaxed", digits='currency', currency='currency'), 'get_amount')
@@ -194,8 +187,7 @@
],
'Invoice Method', required=True, states={
'readonly': Eval('state') != 'draft',
- },
- depends=['state'])
+ })
invoice_method_string = invoice_method.translated('invoice_method')
invoice_state = fields.Selection([
('none', 'None'),
@@ -218,8 +210,7 @@
], 'Shipment Method', required=True,
states={
'readonly': Eval('state') != 'draft',
- },
- depends=['state'])
+ })
shipment_method_string = shipment_method.translated('shipment_method')
shipment_state = fields.Selection([
('none', 'None'),
@@ -239,8 +230,7 @@
origin = fields.Reference('Origin', selection='get_origin', select=True,
states={
'readonly': Eval('state') != 'draft',
- },
- depends=['state'])
+ })
shipping_date = fields.Date(
"Shipping Date",
domain=[If(Bool(Eval('sale_date')) & Bool(Eval('shipping_date')),
@@ -250,7 +240,6 @@
states={
'readonly': Eval('state').in_(['processing', 'done', 'cancelled']),
},
- depends=['state', 'sale_date'],
help="When the shipping of goods should start.")
quoted_by = employee_field(
@@ -1088,8 +1077,7 @@
states={
'readonly': ((Eval('sale_state') != 'draft')
& Bool(Eval('sale'))),
- },
- depends=['sale_state'])
+ })
type = fields.Selection([
('line', 'Line'),
('subtotal', 'Subtotal'),
@@ -1098,22 +1086,19 @@
], 'Type', select=True, required=True,
states={
'readonly': Eval('sale_state') != 'draft',
- },
- depends=['sale_state'])
+ })
quantity = fields.Float(
"Quantity", digits='unit',
states={
'invisible': Eval('type') != 'line',
'required': Eval('type') == 'line',
'readonly': Eval('sale_state') != 'draft',
- },
- depends=['type', 'sale_state'])
+ })
actual_quantity = fields.Float(
"Actual Quantity", digits='unit', readonly=True,
states={
'invisible': Eval('type') != 'line',
- },
- depends=['type'])
+ })
unit = fields.Many2One('product.uom', 'Unit', ondelete='RESTRICT',
states={
'required': Bool(Eval('product')),
@@ -1124,8 +1109,7 @@
If(Bool(Eval('product_uom_category')),
('category', '=', Eval('product_uom_category')),
('category', '!=', -1)),
- ],
- depends=['product', 'type', 'product_uom_category', 'sale_state'])
+ ])
product = fields.Many2One('product.product', 'Product',
ondelete='RESTRICT',
domain=[
@@ -1152,7 +1136,7 @@
'taxes': Eval('taxes', []),
'quantity': Eval('quantity'),
},
- depends=['type', 'sale_state', 'company'])
+ depends={'company'})
product_uom_category = fields.Function(
fields.Many2One('product.uom.category', 'Product Uom Category'),
'on_change_with_product_uom_category')
@@ -1162,13 +1146,13 @@
'invisible': Eval('type') != 'line',
'required': Eval('type') == 'line',
'readonly': Eval('sale_state') != 'draft'
- }, depends=['type', 'sale_state'])
+ })
amount = fields.Function(Monetary(
"Amount", digits='currency', currency='currency',
states={
'invisible': ~Eval('type').in_(['line', 'subtotal']),
},
- depends=['type', 'sale_state']), 'get_amount')
+ depends={'sale_state'}), 'get_amount')
currency = fields.Function(
fields.Many2One('currency.currency', 'Currency'),
'on_change_with_currency')
@@ -1191,7 +1175,7 @@
'invisible': Eval('type') != 'line',
'readonly': Eval('sale_state') != 'draft',
},
- depends=['type', 'sale_state', 'sale'])
+ depends={'sale'})
invoice_lines = fields.One2Many('account.invoice.line', 'origin',
'Invoice Lines', readonly=True)
moves = fields.One2Many('stock.move', 'origin', 'Moves', readonly=True)
@@ -1211,8 +1195,7 @@
shipping_date = fields.Function(fields.Date('Shipping Date',
states={
'invisible': Eval('type') != 'line',
- },
- depends=['type']),
+ }),
'on_change_with_shipping_date')
sale_state = fields.Function(
fields.Selection('get_sale_states', "Sale State"),
@@ -1857,7 +1840,7 @@
__name__ = 'sale.handle.shipment.exception.ask'
recreate_moves = fields.Many2Many(
'stock.move', None, None, 'Recreate Moves',
- domain=[('id', 'in', Eval('domain_moves'))], depends=['domain_moves'])
+ domain=[('id', 'in', Eval('domain_moves'))])
domain_moves = fields.Many2Many(
'stock.move', None, None, 'Domain Moves')
@@ -1917,7 +1900,6 @@
recreate_invoices = fields.Many2Many(
'account.invoice', None, None, 'Recreate Invoices',
domain=[('id', 'in', Eval('domain_invoices'))],
- depends=['domain_invoices'],
help='The selected invoices will be recreated. '
'The other ones will be ignored.')
domain_invoices = fields.Many2Many(
diff -r 5076ae40e1f5 -r 3aa0d3c52d33 sale_reporting.py
--- a/sale_reporting.py Wed Apr 06 23:37:43 2022 +0200
+++ b/sale_reporting.py Fri Apr 08 19:07:13 2022 +0200
@@ -250,15 +250,13 @@
If(Eval('to_date') & Eval('from_date'),
('from_date', '<=', Eval('to_date')),
()),
- ],
- depends=['to_date'])
+ ])
to_date = fields.Date("To Date",
domain=[
If(Eval('from_date') & Eval('to_date'),
('to_date', '>=', Eval('from_date')),
()),
- ],
- depends=['from_date'])
+ ])
period = fields.Selection([
('year', "Year"),
('month', "Month"),
@@ -330,7 +328,7 @@
context={
'company': Eval('company', -1),
},
- depends=['company'])
+ depends={'company'})
@classmethod
def _columns(cls, tables, withs):
@@ -577,7 +575,7 @@
context={
'company': Eval('company', -1),
},
- depends=['company'])
+ depends={'company'})
@classmethod
def _columns(cls, tables, withs):
@@ -632,7 +630,7 @@
context={
'company': Eval('company', -1),
},
- depends=['company'])
+ depends={'company'})
@classmethod
def _joins(cls):