Use explicit order for shipments and invoices on sale and purchase

Closes #15090
(grafted from 05dbc76d7b374aebf7aaef7c03617cbec6c67393)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier
2026-09-13 13:57:29 +02:00
parent 4d383d2a32
commit 6dd5f5873e
2 changed files with 22 additions and 12 deletions
+12 -7
View File
@@ -191,14 +191,17 @@ class Purchase(
('exception', 'Exception'),
], 'Invoice State', readonly=True, required=True, sort=False)
invoices = fields.Function(fields.Many2Many(
'account.invoice', None, None, "Invoices"),
'account.invoice', None, None, "Invoices",
order=[('id', 'ASC')]),
'get_invoices', searcher='search_invoices')
invoices_ignored = fields.Many2Many(
'purchase.purchase-ignored-account.invoice',
'purchase', 'invoice', 'Ignored Invoices', readonly=True)
'purchase.purchase-ignored-account.invoice',
'purchase', 'invoice', 'Ignored Invoices', readonly=True,
order=[('id', 'ASC')])
invoices_recreated = fields.Many2Many(
'purchase.purchase-recreated-account.invoice',
'purchase', 'invoice', 'Recreated Invoices', readonly=True)
'purchase.purchase-recreated-account.invoice',
'purchase', 'invoice', 'Recreated Invoices', readonly=True,
order=[('id', 'ASC')])
origin = fields.Reference(
"Origin", selection='get_origin',
states={
@@ -219,10 +222,12 @@ class Purchase(
('exception', 'Exception'),
], 'Shipment State', readonly=True, required=True, sort=False)
shipments = fields.Function(fields.Many2Many(
'stock.shipment.in', None, None, "Shipments"),
'stock.shipment.in', None, None, "Shipments",
order=[('id', 'ASC')]),
'get_shipments', searcher='search_shipments')
shipment_returns = fields.Function(fields.Many2Many(
'stock.shipment.in.return', None, None, "Shipment Returns"),
'stock.shipment.in.return', None, None, "Shipment Returns",
order=[('id', 'ASC')]),
'get_shipment_returns', searcher='search_shipment_returns')
moves = fields.Function(
fields.Many2Many('stock.move', None, None, "Moves"),
+10 -5
View File
@@ -219,13 +219,16 @@ class Sale(
('exception', 'Exception'),
], 'Invoice State', readonly=True, required=True, sort=False)
invoices = fields.Function(fields.Many2Many(
'account.invoice', None, None, "Invoices"),
'account.invoice', None, None, "Invoices",
order=[('id', 'ASC')]),
'get_invoices', searcher='search_invoices')
invoices_ignored = fields.Many2Many('sale.sale-ignored-account.invoice',
'sale', 'invoice', 'Ignored Invoices', readonly=True)
'sale', 'invoice', 'Ignored Invoices', readonly=True,
order=[('id', 'ASC')])
invoices_recreated = fields.Many2Many(
'sale.sale-recreated-account.invoice', 'sale', 'invoice',
'Recreated Invoices', readonly=True)
'Recreated Invoices', readonly=True,
order=[('id', 'ASC')])
shipment_method = fields.Selection([
('manual', 'Manual'),
('order', 'On Order Processed'),
@@ -243,10 +246,12 @@ class Sale(
('exception', 'Exception'),
], "Shipment State", readonly=True, required=True, sort=False)
shipments = fields.Function(fields.Many2Many(
'stock.shipment.out', None, None, "Shipments"),
'stock.shipment.out', None, None, "Shipments",
order=[('id', 'ASC')]),
'get_shipments', searcher='search_shipments')
shipment_returns = fields.Function(fields.Many2Many(
'stock.shipment.out.return', None, None, "Shipment Returns"),
'stock.shipment.out.return', None, None, "Shipment Returns",
order=[('id', 'ASC')]),
'get_shipment_returns', searcher='search_shipment_returns')
moves = fields.Function(
fields.Many2Many('stock.move', None, None, "Moves"),