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

10.0 fix point of sale bad invoice journal #2331

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
Original file line number Diff line number Diff line change
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)
MiquelRForgeFlow marked this conversation as resolved.
Show resolved Hide resolved

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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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