Skip to content

Commit

Permalink
Merge PR #2331 into 10.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed Sep 1, 2020
2 parents 5083c85 + acd4f01 commit 3ee95cb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
Expand Up @@ -13,7 +13,7 @@ point_of_sale / pos.config / state (selection) : DEL r
point_of_sale / pos.config / default_fiscal_position_id (many2one): NEW relation: account.fiscal.position
point_of_sale / pos.config / iface_fullscreen (boolean) : DEL
point_of_sale / pos.config / invoice_journal_id (many2one) : NEW relation: account.journal
# NOTHING TO DO
# Done: pre-migration. We set the invoice_journal_id with the journal_id value, because, default function return bad journal in multicompany context. We populate the value only if the column doesn't exist. (that is the case if the OCA module pos_invoice_journal is installed in previous version)

point_of_sale / pos.order.line / pack_lot_ids (one2many) : NEW relation: pos.pack.operation.lot
# NOTHING TO DO
Expand Down
30 changes: 30 additions & 0 deletions addons/point_of_sale/migrations/10.0.1.0.1/pre-migration.py
@@ -0,0 +1,30 @@
# coding: utf-8
# Copyright (C) 2020 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade
from psycopg2 import ProgrammingError


def _populate_invoice_journal_id(env):
try:
# We try to create the new field.
# It will fail if pos_invoice_journal has been installed
openupgrade.logged_query(
env.cr, """
ALTER TABLE pos_config
ADD column invoice_journal_id integer;"""
)
except ProgrammingError:
return
openupgrade.logged_query(
env.cr, """
UPDATE pos_config
SET invoice_journal_id = journal_id;"""
)


@openupgrade.migrate(use_env=True)
def migrate(env, version):
_populate_invoice_journal_id(env)
2 changes: 2 additions & 0 deletions odoo/addons/openupgrade_records/lib/apriori.py
Expand Up @@ -63,6 +63,8 @@
('website_sale_b2c', 'sale'), # used groups are in sale
# OCA/manufacture
('mrp_production_unreserve', 'mrp'),
# OCA/pos
('pos_invoice_journal', 'point_of_sale'),
# OCA/purchase-workflow
('purchase_fiscal_position_update', 'purchase'),
# OCA/sale-workflow
Expand Down

0 comments on commit 3ee95cb

Please sign in to comment.