Skip to content

[ADD] account_payment_extension: Migration scripts to bank-payment modules - #35

Merged
pedrobaeza merged 2 commits into
OCA:8.0from
pedrobaeza:8.0-account_payment_extension-migration
Mar 24, 2016
Merged

pedrobaeza merged 2 commits into
OCA:8.0from
pedrobaeza:8.0-account_payment_extension-migration

Conversation

@pedrobaeza

Copy link
Copy Markdown
Member

Migration scripts for account_payment_extension v7 set of modules

This module includes the needed migration script for making a smooth transition
from v7 account_payment_extension module to the set of v8 bank-payment
modules.

This module doesn't provide any functionality at user level.

Installation

You need OpenUpgrade for using these scripts. Put this module in a path
included on OpenUpgrade addons path. You need also to have accesible the
repository bank-payment from https://github.com/OCA/bank-payment.

Start the OpenUpgrade migration and the conversion will be automatically done,
and this module will be automatically uninstall.

@pedrobaeza
pedrobaeza force-pushed the 8.0-account_payment_extension-migration branch 2 times, most recently from cc78e79 to 86b3faa Compare July 6, 2015 16:10
@max3903 max3903 added this to the 8.0 milestone Aug 12, 2015
@pedrobaeza
pedrobaeza force-pushed the 8.0-account_payment_extension-migration branch 6 times, most recently from 4529e13 to d247942 Compare August 18, 2015 18:59
@angelmoya

Copy link
Copy Markdown
Member

👍

@pedrobaeza
pedrobaeza force-pushed the 8.0-account_payment_extension-migration branch from d247942 to 5f494e2 Compare November 6, 2015 01:26
@pedrobaeza
pedrobaeza force-pushed the 8.0-account_payment_extension-migration branch 5 times, most recently from b86e371 to ff4fbf3 Compare January 27, 2016 13:07
VALUES (%%s, %%s, %%s, %%s, %%s)
RETURNING id;""" % openupgrade.get_legacy_name('type'),
(payment_type[0], payment_type[1], payment_type[2],
journal_id, bank_id, company_id))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull works like a charm but I've had to change this insert code in order to be able to run it. For me works this:

                # Create the payment mode
                cr.execute(
                    """
                    INSERT INTO payment_mode
                    (id, name, active, journal, bank_id, company_id)
                    VALUES (%s, '%s', %s, %s, %s, %s)
                    RETURNING id;""" %
                    (payment_type[0], payment_type[1], payment_type[2],
                     journal_id, bank_id, company_id,))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the error? I think this is because and old PG version, and with that SQL, you can overwrite some id values.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got two errors. One is easy:

openerp.sql_db: bad query: 
                    INSERT INTO payment_mode
                    (openupgrade_legacy_8_0_type, name, active, journal, bank_id, company_id)
                    VALUES (%s, %s, %s, %s, %s)
                    RETURNING id;
Traceback (most recent call last):
  File "/home/cubells/projectes/git/odoo80/8.0/server/openerp/sql_db.py", line 234, in execute
    res = self._obj.execute(query, params)
TypeError: not all arguments converted during string formatting

The second is the error that made me to change the insert code:

2016-02-10 05:06:17,078 15371 ERROR openerp.sql_db: Programming error: column "openupgrade_legacy_8_0_type" of relation "payment_mode" does not exist
LINE 3:                     (openupgrade_legacy_8_0_type, name, acti...
                             ^
, in query 
                    INSERT INTO payment_mode
                    (openupgrade_legacy_8_0_type, name, active, journal, bank_id, company_id)
                    VALUES (%s, %s, %s, %s, %s, %s)
                    RETURNING id;

…ion scripts

Dummy modules with migration scripts that allows to migrate to bank-payment suite.
@pedrobaeza
pedrobaeza force-pushed the 8.0-account_payment_extension-migration branch from 844984f to d56f73f Compare March 7, 2016 18:02
@pedrobaeza

Copy link
Copy Markdown
Member Author

@cubells, the correct SQL statement has been fixed in pedrobaeza@d56f73f

@pedrobaeza

Copy link
Copy Markdown
Member Author

As all comments have been honoured and the Travis problem is unrelated, I merge this one to have it finally on the repo.

@pedrobaeza
pedrobaeza merged commit a7453ef into OCA:8.0 Mar 24, 2016
@pedrobaeza
pedrobaeza deleted the 8.0-account_payment_extension-migration branch March 24, 2016 01:59
@sebalix

sebalix commented Mar 25, 2016

Copy link
Copy Markdown

Arg, too late... I found a bug and was not able to find your branch anymore ;)
See #69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants