Skip to content
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
2 changes: 1 addition & 1 deletion docsource/modules160-170.rst
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ Module coverage 16.0 -> 17.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| phone_validation | Nothing to do | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| point_of_sale | | |
| point_of_sale | Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| portal | Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<record id="0_01" model="pos.bill" forcecreate="0">
<!--<record id="0_01" model="pos.bill" forcecreate="0">
<field name="pos_config_ids"/>
</record>
<record id="0_02" model="pos.bill" forcecreate="0">
Expand Down Expand Up @@ -44,7 +44,7 @@
</record>
<record id="5_00" model="pos.bill" forcecreate="0">
<field name="pos_config_ids"/>
</record>
</record>-->
<record id="product_product_consumable" model="product.product">
<field name="available_in_pos">True</field>
</record>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


def fill_account_move_pos_refunded_invoice_ids(env):
openupgrade.logged_query(
env.cr,
"""
INSERT INTO refunded_invoices (refund_account_move, original_account_move)
SELECT am.id as refund_account_move, am2.id as original_account_move
FROM account_move am
JOIN pos_order pos ON pos.account_move = am.id
JOIN pos_order_line pol ON pol.order_id = pos.id
JOIN pos_order_line pol2 ON pol.refunded_orderline_id = pol2.id
JOIN pos_order pos2 ON pol2.order_id = pos2.id
JOIN account_move am2 ON pos2.account_move = am2.id""",
)


def fill_pos_order_shipping_date(env):
openupgrade.logged_query(
env.cr,
"""
UPDATE pos_order pos
SET shipping_date = date_order
WHERE to_ship
""",
)


def product_template_convert_pos_categ_id_m2o_to_m2m(env):
openupgrade.m2o_to_x2m(
env.cr,
env["product.template"],
"product_template",
"pos_categ_ids",
"pos_categ_id",
)


@openupgrade.migrate()
def migrate(env, version):
fill_account_move_pos_refunded_invoice_ids(env)
fill_pos_order_shipping_date(env)
product_template_convert_pos_categ_id_m2o_to_m2m(env)
openupgrade.load_data(env, "point_of_sale", "17.0.1.0.1/noupdate_changes.xml")
openupgrade.delete_records_safely_by_xml_id(
env,
[
"point_of_sale.rule_pos_account_move_line",
"point_of_sale.rule_pos_account_move",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade

_models_renames = [
("restaurant.printer", "pos.printer"),
]

_tables_renames = [
("restaurant_printer", "pos_printer"),
]

_field_renames = [
("pos.order.line", "pos_order_line", "mp_skip", "skip_change"),
]


def precreate_pos_config_auto_validate_terminal_payment(env):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE pos_config
ADD COLUMN auto_validate_terminal_payment boolean DEFAULT TRUE
""",
)
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE pos_config
ALTER COLUMN auto_validate_terminal_payment DROP DEFAULT
""",
)


def fill_pos_order_config_id(env):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE pos_order ADD COLUMN IF NOT EXISTS config_id INTEGER
""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE pos_order pos
SET config_id = ses.config_id
FROM pos_session ses
WHERE pos.session_id = ses.id AND pos.config_id IS NULL
""",
)


def fill_pos_payment_method_sequence(env):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE pos_payment_method ADD COLUMN IF NOT EXISTS sequence INTEGER
""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE pos_payment_method
SET sequence = id
WHERE sequence IS NULL
""",
)


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_models(env.cr, _models_renames)
openupgrade.rename_tables(env.cr, _tables_renames)
openupgrade.rename_fields(env, _field_renames)
precreate_pos_config_auto_validate_terminal_payment(env)
fill_pos_order_config_id(env)
fill_pos_payment_method_sequence(env)
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---Models in module 'point_of_sale'---
obsolete model pos.cache
obsolete model pos.session.check_product_wizard [transient]
new model pos.combo
new model pos.combo.line
# NOTHING TO DO

new model pos.printer (renamed from restaurant.printer in module pos_restaurant)
# DONE: pre-migration: rename model if pos_restaurant was installed

---Fields in module 'point_of_sale'---
point_of_sale / account.move / pos_refunded_invoice_ids (many2many): NEW relation: account.move
# DONE: post-migration: filled

point_of_sale / pos.combo / combo_line_ids (one2many) : NEW relation: pos.combo.line
point_of_sale / pos.combo / name (char) : NEW required
point_of_sale / pos.combo / sequence (integer) : NEW
point_of_sale / pos.combo.line / combo_id (many2one) : NEW relation: pos.combo
point_of_sale / pos.combo.line / combo_price (float) : NEW hasdefault: default
point_of_sale / pos.combo.line / product_id (many2one) : NEW relation: product.product, required
# NOTHING TO DO: new models

point_of_sale / pos.config / auto_validate_terminal_payment (boolean): NEW hasdefault: default
DONE: pre-migration: precreate with default = True

point_of_sale / pos.config / iface_customer_facing_display_background_image_1920 (binary): NEW attachment: True, isfunction: function, stored
# NOTHING TO DO: let odoo compute it

point_of_sale / pos.config / is_order_printer (boolean) : previously in module pos_restaurant
point_of_sale / pos.config / printer_ids (many2many) : previously in module pos_restaurant
# NOTHING TO DO

point_of_sale / pos.config / limited_partners_amount (integer): DEL
point_of_sale / pos.config / limited_partners_loading (boolean): DEL
point_of_sale / pos.config / limited_products_amount (integer): DEL
point_of_sale / pos.config / limited_products_loading (boolean): DEL
point_of_sale / pos.config / partner_load_background (boolean): DEL
point_of_sale / pos.config / product_load_background (boolean): DEL
# NOTHING TO DO

point_of_sale / pos.config / trusted_config_ids (many2many): NEW relation: pos.config
# NOTHING TO DO: new feature

point_of_sale / pos.order / config_id (many2one) : is now stored
# DONE: pre-migration: it's a related field, let's fill it session_id.config_id

point_of_sale / pos.order / last_order_preparation_change (char): NEW
# NOTHING TO DO: new feature

point_of_sale / pos.order / shipping_date (date) : NEW
point_of_sale / pos.order / to_ship (boolean) : DEL
# DONE: post-migration: fill by date_order if to_ship

point_of_sale / pos.order / ticket_code (char) : NEW
point_of_sale / res.company / point_of_sale_ticket_unique_code (boolean): NEW
# NOTHING TO DO: new feature

point_of_sale / pos.order.line / attribute_value_ids (many2many): NEW relation: product.template.attribute.value
# NOTHING TO DO: to fill in pos_self_order using selected_attributes field

point_of_sale / pos.order.line / combo_line_ids (one2many) : NEW relation: pos.order.line
point_of_sale / pos.order.line / combo_parent_id (many2one) : NEW relation: pos.order.line
# NOTHING TO DO: related to new combos

point_of_sale / pos.order.line / custom_attribute_value_ids (one2many): NEW relation: product.attribute.custom.value
point_of_sale / product.attribute.custom.value / pos_order_line_id (many2one) : NEW relation: pos.order.line
# NOTHING TO DO: new feature

point_of_sale / pos.order.line / skip_change (boolean) : NEW
# DONE: pre-migration: renamed from mp_skip (pos_restaurant)

point_of_sale / pos.order.line / uuid (char) : previously in module pos_restaurant
# NOTHING TO DO

point_of_sale / pos.payment.method / _order : _order is now 'sequence, id' ('id asc')
point_of_sale / pos.payment.method / sequence (integer) : NEW
# DONE: pre-migration: let's put sequence = id

point_of_sale / pos.payment.method / image (binary) : NEW attachment: True
# NOTHING TO DO

point_of_sale / pos.session / access_token (char) : NEW
# NOTHING TO DO: new feature

point_of_sale / pos.session / activity_user_id (many2one) : not related anymore
point_of_sale / pos.session / activity_user_id (many2one) : now a function
point_of_sale / pos.session / message_main_attachment_id (many2one): DEL relation: ir.attachment
point_of_sale / pos.session / rating_ids (one2many) : NEW relation: rating.rating
# NOTHING TO DO

point_of_sale / product.template / combo_ids (many2many) : NEW relation: pos.combo
point_of_sale / product.template / detailed_type (False) : NEW selection_keys: ['combo', 'consu', 'product', 'service'], mode: modify
point_of_sale / product.template / type (False) : NEW selection_keys: ['combo', 'consu', 'product', 'service'], mode: modify
# NOTHING TO DO: combo

point_of_sale / product.template / pos_categ_id (many2one) : DEL relation: pos.category
point_of_sale / product.template / pos_categ_ids (many2many) : NEW relation: pos.category
# DONE: post-migration: many2one to many2many

point_of_sale / restaurant.printer / _order : previously in module pos_restaurant
point_of_sale / restaurant.printer / display_name (char) : previously in module pos_restaurant
point_of_sale / restaurant.printer / name (char) : previously in module pos_restaurant
point_of_sale / restaurant.printer / printer_type (selection) : previously in module pos_restaurant
point_of_sale / restaurant.printer / product_categories_ids (many2many): previously in module pos_restaurant
point_of_sale / restaurant.printer / proxy_ip (char) : previously in module pos_restaurant
# NOTHING TO DO

pos_cache / pos.cache / cache (binary) : DEL attachment: True
pos_cache / pos.cache / compute_user_id (many2one) : DEL relation: res.users, required
pos_cache / pos.cache / config_id (many2one) : DEL relation: pos.config, required
pos_cache / pos.cache / product_domain (text) : DEL required
pos_cache / pos.cache / product_fields (text) : DEL required
pos_cache / pos.config / cache_ids (one2many) : DEL relation: pos.cache
# NOTHING TO DO

pos_epson_printer_restaurant / restaurant.printer / epson_printer_ip (char) : module is now 'pos_epson_printer' ('pos_epson_printer_restaurant')
pos_epson_printer_restaurant / restaurant.printer / printer_type (False) : module is now 'pos_epson_printer' ('pos_epson_printer_restaurant')
# NOTHING TO DO

---XML records in module 'point_of_sale'---
NEW ir.actions.act_window: point_of_sale.action_pos_combo
NEW ir.actions.act_window: point_of_sale.action_pos_config_tree
NEW ir.actions.act_window: point_of_sale.action_pos_printer_form
NEW ir.actions.act_window: point_of_sale.action_report_pos_daily_sales_reports [renamed from pos_daily_sales_reports module]
DEL ir.actions.act_window: pos_daily_sales_reports.action_report_pos_daily_sales_reports [renamed to point_of_sale module]
NEW ir.actions.client: point_of_sale.action_client_product_menu (noupdate)
DEL ir.cron: pos_cache.refresh_pos_cache_cron
NEW ir.model.access: point_of_sale.access_account_journal_entry
NEW ir.model.access: point_of_sale.access_pos_combo_line_manager
NEW ir.model.access: point_of_sale.access_pos_combo_line_user
NEW ir.model.access: point_of_sale.access_pos_combo_manager
NEW ir.model.access: point_of_sale.access_pos_combo_user
NEW ir.model.access: point_of_sale.access_pos_daily_sales_reports_wizard [renamed from pos_daily_sales_reports module]
NEW ir.model.access: point_of_sale.access_pos_printer
NEW ir.model.access: point_of_sale.access_pos_printer_manager
DEL ir.model.access: point_of_sale.access_account_bank_statement
DEL ir.model.access: point_of_sale.access_account_bank_statement_manager
DEL ir.model.access: point_of_sale.access_account_move
DEL ir.model.access: point_of_sale.access_account_move_line
DEL ir.model.access: point_of_sale.access_pos_session_check_product_wizard
DEL ir.model.access: pos_cache.access_pos_cache
DEL ir.model.access: pos_daily_sales_reports.access_pos_daily_sales_reports_wizard [renamed to point_of_sale module]
NEW ir.rule: point_of_sale.rule_invoice_pos_user (noupdate)
# NOTHING TO DO

DEL ir.rule: point_of_sale.rule_pos_account_move (noupdate)
DEL ir.rule: point_of_sale.rule_pos_account_move_line (noupdate)
# DONE: post-migration: safely remove

NEW ir.ui.menu: point_of_sale.menu_point_of_sale_list
NEW ir.ui.menu: point_of_sale.menu_pos_combo
NEW ir.ui.menu: point_of_sale.menu_pos_preparation_printer
NEW ir.ui.menu: point_of_sale.menu_report_daily_details [renamed from pos_daily_sales_reports module]
DEL ir.ui.menu: pos_daily_sales_reports.menu_report_daily_details [renamed to point_of_sale module]
NEW ir.ui.view: point_of_sale.account_product_template_form_view
NEW ir.ui.view: point_of_sale.ticket_request_with_code
NEW ir.ui.view: point_of_sale.view_pos_combo_form
NEW ir.ui.view: point_of_sale.view_pos_combo_tree
NEW ir.ui.view: point_of_sale.view_pos_daily_sales_reports_wizard
NEW ir.ui.view: point_of_sale.view_pos_printer
NEW ir.ui.view: point_of_sale.view_pos_printer_form
DEL ir.ui.view: point_of_sale.assets_common
DEL ir.ui.view: point_of_sale.qunit_suite_assets
DEL ir.ui.view: point_of_sale.view_pos_session_check_product_wizard
DEL ir.ui.view: pos_cache.view_pos_config_kanban
DEL ir.ui.view: pos_daily_sales_reports.pos_daily_report
DEL ir.ui.view: pos_daily_sales_reports.view_pos_daily_sales_reports_wizard
DEL ir.ui.view: pos_epson_printer_restaurant.view_restaurant_printer_iot_form
# NOTHING TO DO
Loading