Tiffany Chang (tic) 2363b63dce [FIX] stock: avoid duplicate picking type seqs
Fixes 2 bugs:

- Users were confused when creating a picking type with a duplicated
  prefix name. Because of it, they were unable to distinguish between
  the 2 auto-generated ir_sequences since they default to the same name

https://github.com/odoo/odoo/blob/fe29860b22563bcae58a2e118b2a5ea79637589e/addons/stock/models/stock_picking.py#L102-L115

  Therefore we add a warning when they try to reuse an existing prefix
  (within a company), but not reuse the same seq id. We do not want to
  completely block duplicated prefixes in case the user really wants it
  and/or it is duplicated programmatically by accident (e.g. doing
  uninstall + reinstall of a module).

- When users duplicate an existing picking type, the auto-generated
  ir_sequence could result in duplicated picking names, which can result
  in a block due to the constraint:

https://github.com/odoo/odoo/blob/fe29860b22563bcae58a2e118b2a5ea79637589e/addons/stock/models/stock_picking.py#L440C1-L441

  A previous solution involved linking the existing sequence_id to the
  duplicated picking type, but this was NOT a good solution because it
  could lead to an inconsistency between the prefix used by the picking
  types due to one being changed and the other not, i.e.

https://github.com/odoo/odoo/blob/fe29860b22563bcae58a2e118b2a5ea79637589e/addons/stock/models/stock_picking.py#L123-L136

  would be applied, but the user may not see that it auto-changes it for
  the other picking type

Note that there are some other bugs that still exist related to these
bugs, but there's only so much time in the world to fix this mechanism,
so posterity (i.e. if someone else wants to fix them) they are:

- Previous fix: odoo/odoo#138471 ensures that the company of a picking
  type correctly matches its sequence_id's company. Unfortunately it
  does not take into account if the prefix has been changed (i.e. the
  picking type prefix WON'T match its sequence's prefix). This mismatch
  can also occur if the name of the warehouse is changed.
- Previous fix: odoo/odoo#139277 ensures that the sequence names are
  unique so that they are more easily noticed/fixed, but the prefix is
  left unchanged. Therefore there can still be issues with duplicate
  prefixes leading to the sql_constraints being triggered for pickings
  that use both the existing and the new sequence value.

Part-of: odoo/odoo#146362
2023-12-18 23:31:58 +00:00
2023-11-02 21:02:44 +00:00
2023-12-18 14:34:23 +00:00
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%