Skip to content

Commit b912763

Browse files
rov-adhocjjscarafia
authored andcommitted
[FIX] account_payment_group: Allow when setting to draft the posibility to change the journal or payment method
1 parent 1714043 commit b912763

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

account_payment_group/models/account_payment.py

+16
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,19 @@ def _compute_label(self):
280280
else:
281281
rec.label_journal_id = "Diario de destino"
282282
rec.label_destination_journal_id = "Diario de origen"
283+
284+
def action_draft(self):
285+
# Seteamos posted_before en true para que nos permita pasar a borrador el pago y poder realizar cambio sobre el mismo
286+
# Nos salteamos la siguente validacion
287+
# https://github.com/odoo/odoo/blob/b6b90636938ae961c339807ea893cabdede9f549/addons/account/models/account_move.py#L2474
288+
self.posted_before = False
289+
super().action_draft()
290+
291+
def write(self, vals):
292+
for rec in self:
293+
# Lo siguiente lo evaluamos para evitar la validacion de odoo de
294+
# https://github.com/odoo/odoo/blob/b6b90636938ae961c339807ea893cabdede9f549/addons/account/models/account_move.py#L2476
295+
# y permitirnos realizar la modificacion del journal.
296+
if 'journal_id' in vals and rec.journal_id.id != vals['journal_id']:
297+
rec.move_id.sequence_number = 0
298+
return super().write(vals)

0 commit comments

Comments
 (0)