|
|
for move in self:
if valid_status := move.nemhandel_response_ids.filtered(lambda r: r.nemhandel_state == 'done').mapped('response_code'):
move.nemhandel_move_state = valid_status[0]
elif all([
move.company_id.l10n_dk_nemhandel_proxy_state == 'receiver',
move.commercial_partner_id.nemhandel_verification_state == 'valid',
move.state == 'posted',
move.is_sale_document(include_receipts=True),
not move.nemhandel_move_state,
]):
move.nemhandel_move_state = 'ready'
elif (
move.state == 'draft'
and move.is_sale_document(include_receipts=True)
and move.nemhandel_move_state not in {'processing', 'done'}
):
move.nemhandel_move_state = False
else:
move.nemhandel_move_state = move.nemhandel_move_state
|
|