mirror of
https://github.com/bringout/oca-financial.git
synced 2026-04-27 11:22:07 +02:00
Initial commit: OCA Financial packages (186 packages)
This commit is contained in:
commit
3e0e8473fb
8757 changed files with 947473 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
cr.execute(
|
||||
"""
|
||||
SELECT *
|
||||
FROM information_schema.columns
|
||||
WHERE table_name='account_move_line_ecotax' and column_name='product_id';
|
||||
"""
|
||||
)
|
||||
# field could already be stored in case account_ecotax_report is installed.
|
||||
# then no need to managed these new stored fields.
|
||||
if cr.fetchall():
|
||||
return
|
||||
cr.execute(
|
||||
"""
|
||||
ALTER TABLE account_move_line_ecotax ADD COLUMN product_id integer
|
||||
"""
|
||||
)
|
||||
cr.execute(
|
||||
"""
|
||||
ALTER TABLE account_move_line_ecotax ADD COLUMN quantity numeric
|
||||
"""
|
||||
)
|
||||
cr.execute(
|
||||
"""
|
||||
ALTER TABLE account_move_line_ecotax ADD COLUMN currency_id integer
|
||||
"""
|
||||
)
|
||||
cr.execute(
|
||||
"""
|
||||
UPDATE account_move_line_ecotax
|
||||
SET product_id = l.product_id,
|
||||
quantity = l.quantity,
|
||||
currency_id = l.currency_id
|
||||
FROM account_move_line l
|
||||
WHERE l.id = account_move_line_ecotax.account_move_line_id
|
||||
"""
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue