Raise NotImplementedError when setting Function field without setter

issue7985
review265101002
This commit is contained in:
Cédric Krier
2019-03-27 00:28:57 +01:00
parent 8ad67c0e79
commit 8d1c5e4f1f
2 changed files with 10 additions and 7 deletions
+2 -1
View File
@@ -31,7 +31,8 @@ class Invoice(metaclass=PoolMeta):
('ignored', 'Ignored'),
('recreated', 'Recreated'),
], 'Exception State'), 'get_sale_exception_state')
sales = fields.Function(fields.One2Many('sale.sale', None, 'Sales'),
sales = fields.Function(fields.Many2Many(
'sale.sale', None, None, "Sales"),
'get_sales', searcher='search_sales')
def get_sale_exception_state(self, name):
+8 -6
View File
@@ -187,8 +187,9 @@ class Sale(Workflow, ModelSQL, ModelView, TaxableMixin):
('paid', 'Paid'),
('exception', 'Exception'),
], 'Invoice State', readonly=True, required=True)
invoices = fields.Function(fields.One2Many('account.invoice', None,
'Invoices'), 'get_invoices', searcher='search_invoices')
invoices = fields.Function(fields.Many2Many(
'account.invoice', None, None, "Invoices"),
'get_invoices', searcher='search_invoices')
invoices_ignored = fields.Many2Many('sale.sale-ignored-account.invoice',
'sale', 'invoice', 'Ignored Invoices', readonly=True)
invoices_recreated = fields.Many2Many(
@@ -210,10 +211,11 @@ class Sale(Workflow, ModelSQL, ModelView, TaxableMixin):
('sent', 'Sent'),
('exception', 'Exception'),
], 'Shipment State', readonly=True, required=True)
shipments = fields.Function(fields.One2Many('stock.shipment.out', None,
'Shipments'), 'get_shipments', searcher='search_shipments')
shipment_returns = fields.Function(
fields.One2Many('stock.shipment.out.return', None, 'Shipment Returns'),
shipments = fields.Function(fields.Many2Many(
'stock.shipment.out', None, None, "Shipments"),
'get_shipments', searcher='search_shipments')
shipment_returns = fields.Function(fields.Many2Many(
'stock.shipment.out.return', None, None, "Shipment Returns"),
'get_shipment_returns', searcher='search_shipment_returns')
moves = fields.One2Many('stock.move', 'sale', 'Moves', readonly=True)
origin = fields.Reference('Origin', selection='get_origin', select=True,