With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.
This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.
closesodoo/odoo#46325
Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Stock introduces the option 'product' for the field `type` of the
`product.template` model.
If there exists records for this model with the aforementioned option
selected when the stock module is uninstalled, the records will remain
in the database for an indefinite amount of time, all while pointing to
an option that does no longer exist (except if the record was created by
the stock module itself), making the registry inconsistent and
eventually leading to a crash.
This is a known limitation of the ORM regarding Selection fields and
more specifically the `selection_add` mechanism, no "generic" solution
has been chosen thus far because it is not always clear which approach
should be taken:
1) Delete the record?
2) Set the option to a fallback, base option?
3) Something else handled by the module itself?
...
In this case the second approach has been chosen and whenever the module
stock is uninstalled, all remaining product.template records of `type`
'product' will be reset to the default option defined by the field,
which as of this commit is 'consu'.
See opw#2193814
closesodoo/odoo#45341
X-original-commit: a84b2829c5fac9e2b0d8cb49a4e7aa73f7e0e2b2
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
The user can already send a confirmation email when the
Stock Picking is done. It'd be great to communicate the
same information by SMS.
In addition, the current mailing tool requires a manual
action. The idea is to automate the process via a
Setting instead.
id=1972567
closesodoo/odoo#35662
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
We move the code from the 'post_init_hook' into a function tag, to be
consistent with the way we populate missing data when stock module is
installed.
TASK-ID: 1882269
If companies are created before the installation of module stock, the
warehouses of those companes won't be created when stock module is
installed.
So we've created a post init hook to create the warehouses for the
existing companies.
TASK-ID: 58645
Previous to this rev.:
*Install stock w/ demo data
*Uninstall stock
*Reinstall stock
Result: Boom! Installation crashes.
Reason: The demo data installed with stock is not properly deleted after
the module is uninstalled, which causes issues/conflicts upon
reinstallation of the same demo data.
Solution: Remove any demo data of stock models upon installation if any
exist through a pre_init_hook, ideally this would be done by overriding
the unlink() of the affected models / setting some ondelete='cascade',
or even a uninstall_hook, however these solutions prove insufficient for
databases that are currently affected by the problem.
Fixes#22243
Incoterms models and views are moved in their own file. Impacted:
- stock.incoterms
This commit only moves files. No change is done.
This last commit is done by renaming the remaining code in stock.py file. We
hope this helps keeping a bit of history by being able to retrieve the original
stock.py file.
Move models not located in stock.py file and their views:
- barcode
- procurement
- product
- product.putaway, product.removal and stock.fixed.putaway.strat are
extracted from product.py to their own product_strategy file
to separate product and product.template code from stock specific
code related to products
- res_*
- settings
- web_planner
This commit only moves files. No change is done.
- Preserved explicit 3rd-party copyright notices
- Explicit boilerplate should not be necessary - copyright law applies
automatically in all countries thanks to Berne Convention + WTO rules,
and a reference to the applicable license is clear enough.