Skip to Content
Menu
This question has been flagged
1 Odpoveď
1569 Zobrazenia

I have two companies and if I create a manufacture order under the first one, then everything is fine, the move_finished_ids value is written, but under the other one nothing is written

there are no errors, just the value is not written, if you replace = with write() then an error occurs, but in both companies

I can't understand why this is happening

I will write the code of the standard function in which I found this error in the comments, this is an ode to version 14

Avatar
Zrušiť
Autor Best Answer
def _create_update_move_finished(self):
""" This is a helper function to support complexity of onchange logic for MOs.
It is important that the special *2Many commands used here remain as long as function
is used within onchanges.
"""
# keep manual entries
list_move_finished = [(4, move.id) for move in self.move_finished_ids.filtered(
lambda m: not m.byproduct_id and m.product_id != self.product_id)]
list_move_finished = []
moves_finished_values = self._get_moves_finished_values()
moves_byproduct_dict = {move.byproduct_id.id: move for move in self.move_finished_ids.filtered(lambda m: m.byproduct_id)}
move_finished = self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id)
for move_finished_values in moves_finished_values:
if move_finished_values.get('byproduct_id') in moves_byproduct_dict:
# update existing entries
list_move_finished += [(1, moves_byproduct_dict[move_finished_values['byproduct_id']].id, move_finished_values)]
elif move_finished_values.get('product_id') == self.product_id.id and move_finished:
list_move_finished += [(1, move_finished.id, move_finished_values)]
else:
# add new entries
list_move_finished += [(0, 0, move_finished_values)]
self.move_finished_ids = list_move_finished


Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
aug 21
2989
0
mar 25
823
1
dec 23
3053
2
sep 24
5553
0
máj 23
2809