Hi,
I think the question was already asked but i don’t find where. Why is is necessary to have outgoing moves with quantity 0 in picked state on customer shipments ?
So i tried to make a custo.
The field “outgoing_moves” is a Function field on One2Many field.
outgoing_moves = fields.Function(fields.One2Many('stock.move', 'shipment',
'Outgoing Moves',
domain=[
If(Eval('warehouse_output') == Eval('warehouse_storage'),
('from_location', 'child_of',
[Eval('warehouse_output', -1)], 'parent'),
('from_location', '=', Eval('warehouse_output'))),
If(~Eval('state').in_(['done', 'cancelled']),
('to_location', '=', Eval('customer_location')),
()),
('company', '=', Eval('company')),
],
order=[
('product', 'ASC'),
('id', 'ASC'),
],
states={
'readonly': (Eval('state').in_(
If(Eval('warehouse_storage')
== Eval('warehouse_output'),
['done', 'cancelled'],
['waiting', 'packed', 'done', 'cancelled'],
))
| ~Eval('warehouse') | ~Eval('customer')),
},
help="The moves that send the stock to the customer."),
'get_outgoing_moves', setter='set_outgoing_moves')
To remove moves with quantity =0, I did with adding such line in the domain:
...
domain=[
...
('company', '=', Eval('company')),
('quantity', '!=', 0),
],
But this is not working. It’s seems domain is useless when using Function field. (???)
The only way I found was to limit the results in the method ‘get_outgoing_moves’.
Thanks for help