Skip to content

Commit

Permalink
TA#74487 [14.0][FIX] project_wip_supply_cost : fix unit test (#518)
Browse files Browse the repository at this point in the history
Version of module was incremented
  • Loading branch information
lanto-razafindrabe authored Feb 14, 2025
1 parent 00f46d3 commit f28ebfa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
30 changes: 15 additions & 15 deletions project_wip_supply_cost/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
'name': 'Project WIP Supply Cost',
'version': '14.0.0.1.0.1',
'author': 'Numigi',
'maintainer': 'Numigi',
'website': 'https://bit.ly/numigi-com',
'license': 'LGPL-3',
'category': 'Project',
'summary': 'Generate indirect cost entries from timesheets',
'depends': [
'project_wip',
'project_task_analytic_lines',
'hr_timesheet',
"name": "Project WIP Supply Cost",
"version": "14.0.0.1.0.2",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
"license": "LGPL-3",
"category": "Project",
"summary": "Generate indirect cost entries from timesheets",
"depends": [
"project_wip",
"project_task_analytic_lines",
"hr_timesheet",
],
'data': [
'views/project_type_views.xml',
"data": [
"views/project_type_views.xml",
],
'installable': True,
"installable": True,
}
5 changes: 4 additions & 1 deletion project_wip_supply_cost/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def _update_shop_supply_move(self):
)
)

self.shop_supply_account_move_id.state = "draft"
self.shop_supply_account_move_id.button_draft()

vals = self._get_shop_supply_move_vals()
self.shop_supply_account_move_id.write(vals)
self.shop_supply_account_move_id.action_post()
Expand Down Expand Up @@ -239,6 +240,8 @@ def _get_shop_supply_move_vals(self):
"company_id": self.company_id.id,
"journal_id": self._get_shop_supply_journal().id,
"date": self.date,
# Clearing name to repost move for new sequence (draft > posted)
"name": "",
"move_type": "entry",
"no_analytic_lines": False,
"ref": self._get_shop_supply_move_reference(),
Expand Down
14 changes: 6 additions & 8 deletions project_wip_supply_cost/tests/test_wip_journal_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import pytest
from datetime import datetime
from datetime import datetime, timedelta
from odoo.tests.common import SavepointCase
from odoo.exceptions import ValidationError

Expand Down Expand Up @@ -300,13 +300,11 @@ def test_if_new_project_requires_no_timesheet__account_move_reversed(self):
)
assert wip_line.reconciled

# In odoo 14 we can't change an account move date because the constrains
# _constrains_date_sequence in 'sequence.mixin'
# def test_on_change_timesheet_a_date__account_move_date_updated(self):
# timesheet_line = self._create_timesheet()
# new_date = datetime.now().date() + timedelta(30)
# timesheet_line.with_user(self.timesheet_user).date = new_date
# assert timesheet_line.shop_supply_account_move_id.date == new_date
def test_on_change_timesheet_a_date__account_move_date_updated(self):
timesheet_line = self._create_timesheet()
new_date = datetime.now().date() + timedelta(30)
timesheet_line.with_user(self.timesheet_user).date = new_date
assert timesheet_line.shop_supply_account_move_id.date == new_date

def test_reversal_move_wip_line_has_task(self):
timesheet_line = self._create_timesheet()
Expand Down

0 comments on commit f28ebfa

Please sign in to comment.