Skip to content

Commit

Permalink
Merge pull request #6 from AmetrasIntelligence/quality_control_stock_…
Browse files Browse the repository at this point in the history
…oca_singleton_fix

[FIX] quality_control_stock_oca: Fixed the singleton issue when valid…
  • Loading branch information
baguenth authored Nov 19, 2024
2 parents 262e1ca + a6e5d13 commit 155b9fb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion quality_control_stock_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{
"name": "Quality control - Stock (OCA)",
"version": "13.0.1.0.0",
"version": "13.0.1.0.1",
"category": "Quality control",
"license": "AGPL-3",
"author": "OdooMRP team, AvanzOSC, Serv. Tecnol. Avanzados - Pedro M. Baeza, "
Expand Down
39 changes: 22 additions & 17 deletions quality_control_stock_oca/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,27 @@ def _compute_count_inspections(self):
def action_done(self):
res = super().action_done()
inspection_model = self.env["qc.inspection"]
qc_trigger = self.env["qc.trigger"].search(
[("picking_type_id", "=", self.picking_type_id.id)]
)
for operation in self.move_lines:
trigger_lines = set()
for model in [
"qc.trigger.product_category_line",
"qc.trigger.product_template_line",
"qc.trigger.product_line",
]:
partner = self.partner_id if qc_trigger.partner_selectable else False
trigger_lines = trigger_lines.union(
self.env[model].get_trigger_line_for_product(
qc_trigger, operation.product_id, partner=partner
qc_trigger_model = self.env["qc.trigger"]
for picking in self:
qc_trigger = qc_trigger_model.search(
[("picking_type_id", "=", picking.picking_type_id.id)]
)
for operation in picking.move_lines:
trigger_lines = set()
for model in [
"qc.trigger.product_category_line",
"qc.trigger.product_template_line",
"qc.trigger.product_line",
]:
partner = (
picking.partner_id if qc_trigger.partner_selectable else False
)
)
for trigger_line in _filter_trigger_lines(trigger_lines):
inspection_model._make_inspection(operation, trigger_line)
trigger_lines = trigger_lines.union(
self.env[model].get_trigger_line_for_product(
qc_trigger, operation.product_id, partner=partner
)
)
for trigger_line in _filter_trigger_lines(trigger_lines):
inspection_model._make_inspection(operation, trigger_line)

return res

0 comments on commit 155b9fb

Please sign in to comment.