Skip to content

Commit

Permalink
TA#64531 [FIX] project_wip_material (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
majouda committed Apr 9, 2024
1 parent 438e77d commit 1113141
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions project_wip_material/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,22 @@ def _generate_consumption_account_move(self, qty, description, svl_id, cost):
qty=qty,
description=description,
svl_id=svl_id,
cost=cost)
cost=cost
)

def _generate_consumption_return_account_move(self, qty, description, svl_id, cost):
self._check_project_has_wip_account()
wip_account = self._get_wip_account()
journal_id, dummy, dummy, acc_valuation = self._get_accounting_data_for_valuation()
self.with_company(self.project_id.company_id.id)._create_account_move_line(
credit_account_id=acc_valuation,
debit_account_id=wip_account.id,
credit_account_id=wip_account.id,
debit_account_id=acc_valuation,
journal_id=journal_id,
qty=qty,
description=description,
svl_id=svl_id,
cost=cost)
cost=cost,
)

def _check_project_has_wip_account(self):
project = self.project_id
Expand Down Expand Up @@ -104,4 +106,5 @@ def _get_wip_account(self):
return self.project_id.type_id.wip_account_id

def _get_project_analytic_account(self):
self = self.with_company(self.company_id.id)
return self.project_id.analytic_account_id
6 changes: 4 additions & 2 deletions project_wip_timesheet/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def _update_salary_account_move(self):
move_name=self.salary_account_move_id.name,
)
)

self.salary_account_move_id.state = "draft"
vals = self._get_salary_account_move_vals()
self.salary_account_move_id.write(vals)
self.salary_account_move_id.post()
Expand All @@ -109,7 +111,7 @@ def _reverse_salary_account_move_for_updated_timesheet(self):
move_name=self.salary_account_move_id.name,
)
)
self.salary_account_move_id.reverse_moves()
self.salary_account_move_id._reverse_moves()

self.salary_account_move_id = False

Expand All @@ -126,7 +128,7 @@ def _reverse_salary_account_move_for_deleted_timesheet(self):
move_name=self.salary_account_move_id.name,
)
)
self.salary_account_move_id.reverse_moves()
self.salary_account_move_id._reverse_moves()

def _is_salary_account_move_reconciled(self):
return any(line.reconciled for line in self.salary_account_move_id.line_ids)
Expand Down

0 comments on commit 1113141

Please sign in to comment.