Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG][14.0] account_edi: Migration script #3040

Merged
merged 1 commit into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules130-140.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Module coverage 13.0 -> 14.0
+--------------------------------------------+-------------------------------------------------+
|account_debit_note | |
+--------------------------------------------+-------------------------------------------------+
| |new| account_edi | |
| |new| account_edi | Nothing to do |
tranngocson1996 marked this conversation as resolved.
Show resolved Hide resolved
+--------------------------------------------+-------------------------------------------------+
| |new| account_edi_extended | |
+--------------------------------------------+-------------------------------------------------+
Expand Down
22 changes: 22 additions & 0 deletions openupgrade_scripts/scripts/account/14.0.1.1/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,27 @@ def add_move_id_field_account_payment(env):
)


def add_edi_state_field_account_move(env):
"""
Module account_edi: Created edi_state column and set the default value is false
"""
if not openupgrade.column_exists(env.cr, "account_move", "edi_state"):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE account_move
ADD COLUMN edi_state varchar
""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_move
SET edi_state = false
""",
)
pedrobaeza marked this conversation as resolved.
Show resolved Hide resolved


def fill_empty_partner_type_account_payment(env):
openupgrade.logged_query(
env.cr,
Expand Down Expand Up @@ -383,6 +404,7 @@ def migrate(env, version):
remove_constrains_reconcile_models(env)
add_move_id_field_account_payment(env)
add_move_id_field_account_bank_statement_line(env)
add_edi_state_field_account_move(env)
fill_empty_partner_type_account_payment(env)
fill_account_move_line_currency_id(env)
fill_account_payment_partner_id(env)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---Models in module 'account_edi'---
new model account.edi.document
new model account.edi.format
# NOTHING TO DO: new models

---Fields in module 'account_edi'---
tranngocson1996 marked this conversation as resolved.
Show resolved Hide resolved
account_edi / account.edi.document / attachment_id (many2one) : NEW relation: ir.attachment
account_edi / account.edi.document / edi_format_id (many2one) : NEW relation: account.edi.format, required
account_edi / account.edi.document / error (html) : NEW
account_edi / account.edi.document / move_id (many2one) : NEW relation: account.move, required
account_edi / account.edi.document / state (selection) : NEW selection_keys: ['cancelled', 'sent', 'to_cancel', 'to_send']
account_edi / account.edi.format / code (char) : NEW required
account_edi / account.edi.format / name (char) : NEW
account_edi / account.journal / edi_format_ids (many2many) : NEW relation: account.edi.format, isfunction: function, stored
# NOTHING TO DO

account_edi / account.move / edi_document_ids (one2many) : NEW relation: account.edi.document
account_edi / account.move / edi_state (selection) : NEW selection_keys: ['cancelled', 'sent', 'to_cancel', 'to_send'], isfunction: function, stored
pedrobaeza marked this conversation as resolved.
Show resolved Hide resolved
# NOTHING TO DO: created edi_state column and set the default value is false (in pre-migration on account module)

---XML records in module 'account_edi'---
NEW ir.actions.act_window: account_edi.action_open_edi_documents
NEW ir.actions.act_window: account_edi.action_open_payment_edi_documents
NEW ir.cron: account_edi.ir_cron_edi_network
NEW ir.model.access: account_edi.access_account_edi_document_group_invoice
NEW ir.model.access: account_edi.access_account_edi_document_readonly
NEW ir.model.access: account_edi.access_account_edi_format_group_invoice
NEW ir.model.access: account_edi.access_account_edi_format_readonly
NEW ir.model.constraint: account_edi.constraint_account_edi_document_unique_edi_document_by_move_by_format
NEW ir.model.constraint: account_edi.constraint_account_edi_format_unique_code
NEW ir.ui.view: account_edi.account_invoice_send_inherit_account_wizard_form
NEW ir.ui.view: account_edi.view_account_journal_form_inherited
NEW ir.ui.view: account_edi.view_move_form_inherit
NEW ir.ui.view: account_edi.view_payment_form_inherit
NEW ir.ui.view: account_edi.view_tree_account_edi_document
# NOTHING TO DO