Skip to content

Commit

Permalink
[8.0.1.3.3] hr_cash_advance
Browse files Browse the repository at this point in the history
Task 004098 Issue #30 dan Unittest
  • Loading branch information
azmimr67 committed Oct 26, 2021
1 parent 2d7ca26 commit 8151e44
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 2 deletions.
1 change: 1 addition & 0 deletions hr_cash_advance/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Contributors

* Michael Viriyananda <[email protected]>
* Andhitia Rama <[email protected]>
* Nur Azmi <[email protected]>

Maintainer
----------
Expand Down
1 change: 1 addition & 0 deletions hr_cash_advance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
from . import (
models,
wizards,
tests,
)
2 changes: 1 addition & 1 deletion hr_cash_advance/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{
"name": "Employee Cash Advance",
"version": "8.0.1.3.2",
"version": "8.0.1.3.3",
"author": "OpenSynergy Indonesia, PT. Simetri Sinergi Indonesia",
"website": "https://simetri-sinergi.id",
"license": "AGPL-3",
Expand Down
4 changes: 3 additions & 1 deletion hr_cash_advance/models/hr_cash_advance_settlement.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,10 @@ def action_approve(self):
@api.multi
def action_cancel(self):
for document in self:
move = document.move_id
document.write(document._prepare_cancel_data())
document._unlink_accounting_entry()
if move:
document._unlink_accounting_entry()

@api.multi
def action_restart(self):
Expand Down
8 changes: 8 additions & 0 deletions hr_cash_advance/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2021 OpenSynergy Indonesia
# Copyright 2021 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import (
base,
test_onchange,
)
18 changes: 18 additions & 0 deletions hr_cash_advance/tests/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2020 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp.tests.common import TransactionCase


class BaseCase(TransactionCase):
def setUp(self, *args, **kwargs):
result = super(BaseCase, self).setUp(*args, **kwargs)
self.obj_ca_settlement = self.env["hr.cash_advance_settlement"]
self.advance_journal = self.env.ref("hr_cash_advance.demo_journal2")
self.advance_type = self.env.ref("hr_cash_advance.demo_cash_advance_type1")

self.obj_ca_settlement_line = self.env["hr.cash_advance_settlement_line"]

return result
23 changes: 23 additions & 0 deletions hr_cash_advance/tests/test_onchange.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2021 OpenSynergy Indonesia
# Copyright 2021 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from .base import BaseCase


class TestOnchange(BaseCase):
def test_hr_cash_advance_settlement_onchange_journal_id(self):
self.advance_type.write(
{
"journal_id": self.advance_journal.id,
}
)
values = {
"type_id": self.advance_type.id,
}
ca_settlement = self.obj_ca_settlement.new(values)
ca_settlement.onchange_journal_id()

self.assertEqual(ca_settlement.journal_id, self.advance_journal)

0 comments on commit 8151e44

Please sign in to comment.