forked from OCA/account-invoicing
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] account_move_substate: mail template, views, tests
[IMP] account_move_substate: Improve views add substate to tree view, group buy and search and fix form view [IMP] account_move_substate: add tests [IMP] account_move_substate: add tests [IMP] account_move_substate: documentation
- Loading branch information
Showing
9 changed files
with
128 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
* `Ecosoft <http://ecosoft.co.th>`__: | ||
|
||
* Pimolnat Suntian <[email protected]> | ||
|
||
* `360ERP <https://360ERP.com>`__: | ||
|
||
* Bosd <bosd> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#. Go to ** Settings > Technical > Database Structure ** and Add "Base substate". | ||
If necessery you can add "target State values" (ex define a substate for "cancel" | ||
If necessary you can add "target State values" (ex define a substate for "cancel" | ||
state). | ||
Substate sequence is very important. | ||
#. Create a journal entry and check if the substate are displayed on the header of | ||
form view. Check if you can't set substate defined for journal entry if state is a draft. | ||
form view. Check if you can't set substate defined for journal entry if state is a draft. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_account_move_substate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright 2023 bosd (<bosd>) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo.exceptions import ValidationError | ||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestBaseSubstate(TransactionCase): | ||
def setUp(self): | ||
super(TestBaseSubstate, self).setUp() | ||
self.substate_test_account_move = self.env["account.move"] | ||
self.substate_test_account_move_line = self.env["account.move.line"] | ||
|
||
self.substate_to_verify = self.env.ref( | ||
"account_move_substate.base_substate_to_verify_account_move" | ||
) | ||
self.substate_checked = self.env.ref( | ||
"account_move_substate.base_substate_checked_account_move" | ||
) | ||
self.substate_verified = self.env.ref( | ||
"account_move_substate.base_substate_verified_account_move" | ||
) | ||
|
||
self.product = self.env["product.product"].create({"name": "Test"}) | ||
|
||
def test_account_move_substate(self): | ||
partner = self.env.ref("base.res_partner_12") | ||
invoice_test1 = self.substate_test_account_move.create( | ||
{ | ||
# "name": "Test base substate to basic invoice", | ||
"move_type": "out_invoice", | ||
"partner_id": partner.id, | ||
"invoice_line_ids": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"name": "Test product", | ||
"quantity": 1, | ||
"price_unit": 450, | ||
"tax_ids": [(6, 0, [])], | ||
}, | ||
) | ||
], | ||
} | ||
) | ||
|
||
self.assertTrue(invoice_test1.state == "draft") | ||
|
||
with self.assertRaises(ValidationError): | ||
invoice_test1.substate_id = self.substate_verified | ||
# post the invoice | ||
invoice_test1.action_post() | ||
self.assertTrue(invoice_test1.substate_id == self.substate_verified) | ||
|
||
# test that there is no substate id | ||
invoice_test1.button_cancel() | ||
self.assertTrue(invoice_test1.state == "cancel") | ||
self.assertTrue(not invoice_test1.substate_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters