Skip to content

Commit f0a11e3

Browse files
committed
[FIX] account_background_post: When account_background_post is installed, validated invoices always use action_post instead of _post
X-original-commit: 50ce5c5
1 parent 984f56f commit f0a11e3

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

account_background_post/wizards/validate_account_move.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ def validate_move(self):
4141
4242
3. Limitamos sui el usuario quiere validar mas facturas que el batch size definido directamente
4343
le pedimos que las valide en background."""
44-
if self.count_inv <= 1: # or 0 or 1
45-
return super().validate_move()
46-
47-
if self.count_inv > self.batch_size:
48-
raise UserError(
49-
_(
50-
"You can only validate on batches of size < %s invoices. If you need to validate"
51-
" more invoices please use the validate on background option",
52-
self.batch_size,
44+
if self.count_inv:
45+
if self.count_inv > self.batch_size:
46+
raise UserError(
47+
_(
48+
"You can only validate on batches of size < %s invoices. If you need to validate"
49+
" more invoices please use the validate on background option",
50+
self.batch_size,
51+
)
5352
)
54-
)
5553

56-
for move in self.move_ids:
57-
_logger.info("Validating invoice %s", move.id)
58-
move.action_post()
59-
move.env.cr.commit()
54+
for move in self.move_ids:
55+
_logger.info("Validating invoice %s", move.id)
56+
move.action_post()
57+
move.env.cr.commit()
6058

61-
return {"type": "ir.actions.act_window_close"}
59+
return {"type": "ir.actions.act_window_close"}
60+
else:
61+
return super().validate_move()

0 commit comments

Comments
 (0)