Skip to Content

[FIX] point_of_sale: pass noupdate True for pos load demo data

Killed 135m merged
PR
#1338
PR Author
Roy Le
Committer
Roy Le
Commit
f13ee15bd1fa
Branch
16.0
Age
Up-time
Commit message
[FIX] point_of_sale: pass noupdate True for pos load demo data

Backport of odoo/odoo@1bed05062d1a76763156220e6626ab071b3c578d (17.0),
adapted to 16.0 where the onboarding data is loaded by
pos.session.check_product_wizard.load_demo_products().

When a database has no PoS product, the user can load sample products
from the PoS opening wizard. They are created from
data/point_of_sale_onboarding.xml, which is not listed in the manifest,
with noupdate=False. On the next upgrade of point_of_sale these xmlids
are not reloaded, so _process_end() tries to delete the records. Once
one of the sample products has been sold, the upgrade crashes:

  psycopg2.errors.ForeignKeyViolation: update or delete on table
  "product_product" violates foreign key constraint
  "pos_order_line_product_id_fkey" on table "pos_order_line"

and the unsold sample products are silently deleted.

Load the file with noupdate=True so the records are left alone on
upgrade.

Databases which already loaded the sample products keep their
noupdate=False xmlids and must be fixed by setting noupdate on them.