Skip to content

Commit

Permalink
Merge PR #1048 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Dec 12, 2022
2 parents 948d993 + edc897c commit 14b4de2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions project_stock/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def _prepare_analytic_line_from_task(self):
vals["ref"] = task.name
if "product_id" in analytic_line_fields:
vals["product_id"] = product.id
# Prevent incoherence when hr_timesheet addon is installed.
if "project_id" in analytic_line_fields:
vals["project_id"] = False
# tags + distributions
if task.stock_analytic_tag_ids:
vals["tag_ids"] = [(6, 0, task.stock_analytic_tag_ids.ids)]
Expand Down
3 changes: 3 additions & 0 deletions project_stock/tests/test_project_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def _test_task_analytic_lines_from_task(self, amount):
self.analytic_account,
stock_analytic_lines.mapped("account_id"),
)
# Prevent incoherence when hr_timesheet addon is installed.
if "project_id" in self.task.stock_analytic_line_ids._fields:
self.assertFalse(self.task.stock_analytic_line_ids.project_id)

def test_project_task_without_analytic_account(self):
self.task = self.env["project.task"].browse(self.task.id)
Expand Down

0 comments on commit 14b4de2

Please sign in to comment.