[19.0][MIG] project_task_stock: Migration to 19.0#1653
[19.0][MIG] project_task_stock: Migration to 19.0#1653bizzappdev wants to merge 54 commits intoOCA:19.0from
Conversation
TT34554 [UPD] Update project_stock.pot [UPD] README.rst
…e access to stock. TT35899 project_stock 13.0.1.1.0
…ailability materials" button (if movements have been added after confirming the materials). TT35602 project_stock 13.0.1.1.1
…e if there is any assigned move. TT36812 [UPD] Update project_stock.pot project_stock 13.0.1.1.2 Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-13.0/project-13.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-13-0/project-13-0-project_stock/
TT34555 [UPD] Update project_stock.pot
… sections (project and task) from stock to stock.group_stock_user. TT35602
…in moves to prevent merge moves from another tasks. TT37708 [UPD] Update project_stock.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-13.0/project-13.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-13-0/project-13-0-project_stock/
TT37708 project_stock 13.0.2.0.1 project_stock 13.0.2.1.0
TT37028 [UPD] Update project_stock.pot [UPD] README.rst
Translated using Weblate (Croatian) Currently translated at 94.6% (53 of 56 strings) Translation: project-14.0/project-14.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_stock/hr/
We need to apply sudo to avoid error if the user does not have access to analytical accounting. TT38702 project_stock 14.0.1.0.1
The possibility of set a specific date in project or task has been added so that if it is set it will be used in analytic items linked to materials. TT38988 [UPD] Update project_stock.pot project_stock 14.0.1.1.0 Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-14.0/project-14.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_stock/
Translated using Weblate (Italian) Currently translated at 33.3% (19 of 57 strings) Translation: project-14.0/project-14.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_stock/it/
…ns in tasks. TT39639 project_stock 14.0.1.1.1
TT40363 [UPD] Update project_stock.pot [UPD] README.rst
project_stock 15.0.1.0.1
… to avoid incoherence. project_stock 15.0.1.0.2
[UPD] Update project_stock.pot [UPD] README.rst
Currently translated at 100.0% (57 of 57 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/hr/
Currently translated at 33.3% (19 of 57 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/
Currently translated at 100.0% (57 of 57 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/ Translated using Weblate (Italian) Currently translated at 100.0% (57 of 57 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/ Translated using Weblate (Italian) Currently translated at 100.0% (57 of 57 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/ [UPD] Update project_stock.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/
Currently translated at 100.0% (59 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/
…d cancelled) in action_done() to avoid side effects. Use case: - Product A with 1 qty - Confirm materials - Edit Product A line to 0 qty - Transfer Materials - New line: Product B with 1 qty - Confirm materials - Transfer Materials TT44572 project_stock 16.0.1.0.1
Translated using Weblate (Portuguese (Brazil)) Currently translated at 94.9% (56 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/pt_BR/ Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (59 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/pt_BR/
…"Transfer Materials" process. TT44572 project_stock 16.0.1.0.2 [UPD] README.rst
Currently translated at 100.0% (59 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/es/
Currently translated at 91.5% (54 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/hr/
…_analytic_tag if necessary [UPD] Update project_stock.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/
Currently translated at 100.0% (59 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/
Currently translated at 100.0% (59 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/pt_BR/ Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (59 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/pt_BR/
Currently translated at 100.0% (59 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/
Currently translated at 100.0% (59 of 59 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/
… tasks TT47932 [UPD] Update project_stock.pot [BOT] post-merge updates Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/
…users without permissions in stock.move TT49583 [BOT] post-merge updates
Currently translated at 100.0% (60 of 60 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/pt_BR/
Currently translated at 100.0% (60 of 60 strings) Translation: project-16.0/project-16.0-project_stock Translate-URL: https://translation.odoo-community.org/projects/project-16-0/project-16-0-project_stock/it/
…om, qty) in confirmed moves TT54633 [BOT] post-merge updates
… rules TT55725 [BOT] post-merge updates
… (tasks and pickings) In addition to generating the analytical lines at the end of the task, they must also be generated if the pickings is done. Fixes OCA#1492
Similar process to the existing "Cancel materials" in the task (applies to all moves). TT58839
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: project-18.0/project-18.0-project_task_stock Translate-URL: https://translation.odoo-community.org/projects/project-18-0/project-18-0-project_task_stock/
Currently translated at 100.0% (62 of 62 strings) Translation: project-18.0/project-18.0-project_task_stock Translate-URL: https://translation.odoo-community.org/projects/project-18-0/project-18-0-project_task_stock/it/
|
Please, cherry-pick #1638 to commit history before migration commit |
alexey-pelykh
left a comment
There was a problem hiding this comment.
Clean 19.0 migration, all CI green. LGTM
alexey-pelykh
left a comment
There was a problem hiding this comment.
This PR is currently in Draft status, so this is an early review with observations that may help as you prepare the module for formal review.
Overview
Migration of project_task_stock to 19.0. The module links project tasks to stock/inventory moves, allowing material consumption directly from tasks.
Key Findings
Bug: stock_scrap.py -- Wrong class name and non-existent field references
Class name mismatch: The class is named StockMove but inherits stock.scrap. It should be StockScrap:
class StockMove(models.Model): # Should be StockScrap
_inherit = "stock.scrap"Non-existent field references in _onchange_task_id:
self.task_id.move_raw_ids-- theproject.taskmodel in this module definesmove_ids, notmove_raw_ids(this was likely carried over frommrpmanufacturing terminology)self.task_id.location_src_id-- the field is namedlocation_idonproject.task, notlocation_src_id
This will cause AttributeError at runtime when the onchange fires.
Bug: project_task.py action_done() -- picking_id may be empty
Line:
moves_to_do.picking_id.with_context(skip_sanity_check=True).button_validate()Stock moves created from tasks (via default_get in stock_move.py) are not associated with a picking. So moves_to_do.picking_id will be an empty recordset, and button_validate() will effectively be a no-op. The moves will never actually be validated/done through this code path. Consider calling moves_to_do._action_done() directly instead.
Missing security/ir.model.access.csv
The manifest does not include a security/ir.model.access.csv file. While this module only extends existing models (no new _name), it does add new fields and relationships. If any new model were introduced in the future, access rules would be needed. For OCA standards, it is good practice to include this file even if empty, and it is worth verifying that no access rules are needed for the stock.reference many2many relation table (stock_reference_task_rel).
Code style: _compute_unreserve_visible
any_quantity_done = any(
[
m.quantity > 0
for m in item.move_ids.filtered(lambda x: x.state == "done")
]
)any([...]) creates an unnecessary intermediate list. Use a generator expression instead: any(m.quantity > 0 for m in ...).
Code style: Old-style super() call in unlink()
def unlink(self):
return super(ProjectTask, self.sudo()).unlink()For Odoo 19.0, the new-style super() call is preferred. Also, using self.sudo() inside unlink() means the entire deletion (including cascade deletes on related records) runs with elevated privileges, which is a security concern. Consider scoping the sudo() more narrowly to just the analytic line cleanup, similar to how action_cancel handles it.
i18n: Version headers not updated
The .pot file header says Project-Id-Version: Odoo Server 18.0 -- should be 19.0 for this migration. Various .po files reference even older versions (14.0, 16.0). These should be regenerated with oca-gen-addon-readme / exported fresh from 19.0.
Missing migration scripts
This is labeled as [MIG] but there is no migrations/ directory. If any users had this module installed on 18.0, they would need migration scripts to handle potential data/schema changes between versions. If this is a straightforward port with no schema changes, a brief note in the PR description confirming this would be helpful.
No PR description
The PR body is empty. OCA migration PRs typically include a brief description of what was done for the migration (API changes addressed, tests updated, etc.).
_compute_scrap_move_count uses formatted_read_group
Good use of the 19.0 formatted_read_group API -- this is the correct modern approach.
_prepare_reference_vals decorated with @api.model but uses self
@api.model
def _prepare_reference_vals(self):
return {"name": f"Task-ID: {self.id}"}@api.model means self is the model class, not a recordset. But self.id is used, which requires a specific record. This will return False or None for self.id. The decorator should be removed, or the method should receive the task ID as a parameter.
Summary
The module has several issues that should be addressed before marking the PR as ready for review, most critically the broken field references in stock_scrap.py and the ineffective action_done() method. The codebase shows solid structure and good test coverage (15+ test methods), which is encouraging.
Happy to do a full review with inline comments once the PR is marked as ready.
Review posted via CorporateHub OCA review campaign
No description provided.