Skip to content

Commit

Permalink
post-migrate script to set bank on invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
GSLabIt authored and SirAionTech committed Sep 28, 2023
1 parent dd24f43 commit 0554267
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion l10n_it_ricevute_bancarie/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{
'name': "ITA - Ricevute bancarie",
'version': "12.0.1.6.0",
'version': "12.0.1.6.1",
'author': "Odoo Community Association (OCA)",
'category': 'Localization/Italy',
'summary': 'Ricevute bancarie',
Expand Down
10 changes: 10 additions & 0 deletions l10n_it_ricevute_bancarie/migrations/12.0.1.6.1/post-migrate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
invoices = env['account.invoice'].search([
('payment_term_id.riba', '=', True), ('riba_partner_bank_id', '=', False)
])
for invoice in invoices:
invoice._onchange_riba_partner_bank_id()
1 change: 1 addition & 0 deletions l10n_it_ricevute_bancarie/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
* Sergio Zanchetta <https://github.com/primes2h>
* Simone Vanin <[email protected]>
* Sergio Corato <https://github.com/sergiocorato>
* Giovanni Serra <[email protected]>
5 changes: 3 additions & 2 deletions l10n_it_ricevute_bancarie/wizard/wizard_riba_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ def create_rdl(countme, bank_id, rd_id, date_maturity, partner_id,
bank_id = move_line.invoice_id.riba_partner_bank_id
else:
raise exceptions.Warning(
_('No bank has been specified for partner %s!') %
move_line.partner_id.name)
_('No bank has been specified for invoice %s!') %
move_line.invoice_id.name
)
if move_line.partner_id.group_riba and do_group_riba:
for key in grouped_lines:
if (key[0] == move_line.partner_id.id and
Expand Down

0 comments on commit 0554267

Please sign in to comment.