details: https://code.tryton.org/tryton/commit/d859e52b7ba4
branch: default
user: Cédric Krier <[email protected]>
date: Tue Feb 03 10:20:59 2026 +0100
description:
Add searcher to the shipments field on invoice line
diffstat:
modules/account_invoice_stock/account.py | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diffs (39 lines):
diff -r 0a667448a4dd -r d859e52b7ba4 modules/account_invoice_stock/account.py
--- a/modules/account_invoice_stock/account.py Sat Jan 31 17:22:42 2026 +0100
+++ b/modules/account_invoice_stock/account.py Tue Feb 03 10:20:59 2026 +0100
@@ -68,7 +68,10 @@
(Eval('type') != 'line')
| ~Eval('product')),
})
- shipments = fields.Function(fields.Char("Shipments"), 'get_shipments')
+ shipments = fields.Function(
+ fields.Char("Shipments"),
+ 'get_shipments',
+ searcher='search_shipments')
correction = fields.Boolean(
"Correction",
states={
@@ -115,6 +118,23 @@
return ', '.join(sorted(shipments))
@classmethod
+ def search_shipments(cls, name, clause):
+ pool = Pool()
+ Move = pool.get('stock.move')
+ _, operator, operand, *extra = clause
+ if operator.startswith('!') or operator.startswith('not '):
+ bool_op = 'AND'
+ else:
+ bool_op = 'OR'
+ domain = [bool_op]
+ for shipment, _ in Move.get_shipment():
+ if shipment:
+ domain.append(
+ ('stock_moves.shipment.rec_name',
+ operator, operand, shipment, *extra))
+ return domain
+
+ @classmethod
def on_modification(cls, mode, lines, field_names=None):
pool = Pool()
Move = pool.get('stock.move')