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 project_estimation_material/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Project Estimation Material",
"version": "1.2.0",
"version": "1.3.0",
"author": "Numigi",
"maintainer": "Numigi",
"license": "LGPL-3",
Expand Down
24 changes: 8 additions & 16 deletions project_estimation_material/wizard/project_estimation_exit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import api, models, fields
import logging

_logger = logging.getLogger(__name__)


class ProjectEstimationExit(models.TransientModel):
Expand All @@ -22,20 +19,15 @@ def _set_tasks(self):
)

def validate(self):
_logger.info("Project Estimation Exit: Start validation")
ctx = dict(self.env.context)
auto_assign_config = self.env["ir.config_parameter"].sudo().get_param(
"stock_auto_assign_disabled.config", "off"
)
if auto_assign_config == 'all':
ctx.update({
'stock_auto_assign_disable': True, # Force the auto assign disable
})
res = super(ProjectEstimationExit, self.with_context(ctx)).validate()
self.with_context(ctx)._trigger_procurements()
return res
# Set the Context
self = self.with_context(disable_reservation=True, stock_auto_assign_disable=True)
super(ProjectEstimationExit, self).validate()
self._trigger_procurements()

def _trigger_procurements(self):
for line in self.project_id.material_line_ids:
if line._should_generate_procurement():
line._run_procurements()
line.with_context(
disable_reservation=True,
stock_auto_assign_disable=True
)._run_procurements()