Skip to content

Commit

Permalink
[OU-IMP] point_of_sale: assure company_id is filled
Browse files Browse the repository at this point in the history
  • Loading branch information
MiquelRForgeFlow committed Dec 17, 2024
1 parent 70c9282 commit c68f462
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ def merge_pos_order_line_module(env):
)


def fill_pos_payment_method_company_id(env):
"""required field"""
openupgrade.logged_query(
env.cr,
"""UPDATE pos_payment_method ppm
SET company_id = aj.company_id
FROM account_journal aj
WHERE ppm.company_id IS NULL AND ppm.journal_id = aj.id""",
)
openupgrade.logged_query(
env.cr,
"""UPDATE pos_payment_method ppm
SET company_id = aa.company_id
FROM account_account aa
WHERE ppm.company_id IS NULL AND ppm.receivable_account_id = aa.id""",
)


@openupgrade.migrate()
def migrate(env, version):
merge_pos_order_return_module(env)
Expand Down Expand Up @@ -74,3 +92,4 @@ def migrate(env, version):
ALTER TABLE pos_config ADD COLUMN IF NOT EXISTS warehouse_id INTEGER
""",
)
fill_pos_payment_method_company_id(env)
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ point_of_sale / pos.payment / company_id (many2one) : is no
point_of_sale / pos.payment.method / is_cash_count (boolean) : now a function
# NOTHING TO DO

point_of_sale / pos.payment.method / company_id (many2one) : now required
# DONE: pre-migration: filled field if empty

point_of_sale / pos.payment.method / cash_journal_id (many2one) : DEL relation: account.journal
point_of_sale / pos.payment.method / journal_id (many2one) : NEW relation: account.journal
# DONE: pre-migration: renamed fields
Expand Down

0 comments on commit c68f462

Please sign in to comment.