-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
porting l10n_it_invoices_data_communication to 14.0
- Loading branch information
Showing
17 changed files
with
171 additions
and
288 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
l10n_it_invoices_data_communication/migrations/13.0.1.0.0/post-migrate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from openupgradelib import openupgrade | ||
from psycopg2 import sql | ||
|
||
invoice_data = ("comunicazione_dati_iva_escludi",) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
if openupgrade.column_exists(env.cr, "account_move", "old_invoice_id"): | ||
openupgrade.logged_query( | ||
env.cr, | ||
sql.SQL( | ||
"""UPDATE account_move m | ||
SET {} | ||
FROM account_invoice i | ||
WHERE m.old_invoice_id = i.id | ||
""" | ||
).format( | ||
sql.SQL(", ").join( | ||
sql.Composed( | ||
[ | ||
sql.Identifier(col), | ||
sql.SQL(" = "), | ||
sql.SQL("i."), | ||
sql.Identifier(col), | ||
] | ||
) | ||
for col in invoice_data | ||
) | ||
), | ||
) | ||
|
||
elif openupgrade.table_exists(env.cr, "account_invoice"): | ||
openupgrade.logged_query( | ||
env.cr, | ||
sql.SQL( | ||
"""UPDATE account_move m | ||
SET {} | ||
FROM account_invoice i | ||
WHERE i.move_id = m.id | ||
""" | ||
).format( | ||
sql.SQL(", ").join( | ||
sql.Composed( | ||
[ | ||
sql.Identifier(col), | ||
sql.SQL(" = "), | ||
sql.SQL("i."), | ||
sql.Identifier(col), | ||
] | ||
) | ||
for col in invoice_data | ||
) | ||
), | ||
) |
8 changes: 8 additions & 0 deletions
8
l10n_it_invoices_data_communication/migrations/14.0.1.0.0/noupdate_changes.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version='1.0' encoding='utf-8' ?> | ||
<odoo> | ||
<record id="comunucazione_fatture_multi_company" model="ir.rule"> | ||
<field | ||
name="domain_force" | ||
>['|',('company_id','=',False),('company_id','in',company_ids)]</field> | ||
</record> | ||
</odoo> |
10 changes: 10 additions & 0 deletions
10
l10n_it_invoices_data_communication/migrations/14.0.1.0.0/post-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from openupgradelib import openupgrade # pylint: disable=W7936 | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.load_data( | ||
env.cr, | ||
"l10n_it_invoices_data_communication", | ||
"migrations/14.0.1.0.0/noupdate_changes.xml", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.