diff --git a/invoice.py b/invoice.py index 790d667b1c..13b17f2d1d 100644 --- a/invoice.py +++ b/invoice.py @@ -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): diff --git a/sale.py b/sale.py index a0a8b16733..19fed9721f 100644 --- a/sale.py +++ b/sale.py @@ -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,