Skip to content

Commit

Permalink
[MIG] pos_cash_move_reason: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
traitrantrobz committed Aug 7, 2024
1 parent a8290a8 commit 9951c4f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 24 deletions.
1 change: 1 addition & 0 deletions pos_cash_move_reason/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Contributors

- Sylvain LE GAL <https://twitter.com/legalsylvain>
- Dhara Solanki <[email protected]>
- Tran Thanh Trai <[email protected]>

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion pos_cash_move_reason/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "ACSONE SA/NV," "GRAP," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"category": "Point Of sale",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"depends": ["point_of_sale"],
"data": [
Expand Down
1 change: 1 addition & 0 deletions pos_cash_move_reason/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
- Sylvain LE GAL \<<https://twitter.com/legalsylvain>\>
- Dhara Solanki \<<[email protected]>\>
- Tran Thanh Trai \<<[email protected]>\>
10 changes: 5 additions & 5 deletions pos_cash_move_reason/tests/test_pos_cash_move_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ def setUpClass(cls):
cls.WizardReason = cls.env["wizard.pos.move.reason"]
cls.AccountMoveLine = cls.env["account.move.line"]

cls.config = cls.env.ref("point_of_sale.pos_config_main").copy()
cls.config = cls.env.ref("point_of_sale.pos_config_main")
cls.cash_journal = cls.env["account.journal"].search(
[
("type", "=", "cash"),
("company_id", "=", cls.env.ref("base.main_company").id),
]
)[0]
],
limit=1,
)
cls.deposit_reason = cls.env.ref("pos_cash_move_reason.bank_out_reason")

def test_onchange_expense_reason(self):
Expand Down Expand Up @@ -70,7 +71,6 @@ def test_take_invalid_amount(self):
session = self.PosSession.search(
[("state", "=", "opening_control"), ("config_id", "=", self.config.id)]
)

# Enter Invalid money
with self.assertRaises(UserError):
self.WizardReason.with_context(
Expand All @@ -88,7 +88,7 @@ def test_take_invalid_amount(self):
def test_button_put_money(self):
self.config._action_to_open_ui()
session = self.PosSession.search(
[("state", "=", "opened"), ("config_id", "=", self.config.id)]
[("state", "=", "opening_control"), ("config_id", "=", self.config.id)]
)
wiz = session.button_move_income()
self.assertEqual(wiz["context"]["default_move_type"], "income")
10 changes: 4 additions & 6 deletions pos_cash_move_reason/views/view_pos_move_reason.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,14 @@
<field name="is_income_reason" />
<field
name="income_account_id"
attrs="{
'required': [('is_income_reason', '=', True)],
'invisible': [('is_income_reason', '=', False)]}"
required="is_income_reason"
invisible="not is_income_reason"
/>
<field name="is_expense_reason" />
<field
name="expense_account_id"
attrs="{
'required': [('is_expense_reason', '=', True)],
'invisible': [('is_expense_reason', '=', False)]}"
required="is_expense_reason"
invisible="not is_expense_reason"
/>
</group>
</sheet>
Expand Down
8 changes: 2 additions & 6 deletions pos_cash_move_reason/views/view_pos_session.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
name="button_move_income"
type="object"
icon="fa-level-down"
attrs="{'invisible': ['|',
('display_move_reason_income', '=', False),
('state', 'not in', ['opened', 'closing_control'])]}"
invisible="not display_move_reason_income or state not in ('opened', 'closing_control')"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Put</span>
Expand All @@ -28,9 +26,7 @@
name="button_move_expense"
type="object"
icon="fa-level-up"
attrs="{'invisible': ['|',
('display_move_reason_expense', '=', False),
('state', 'not in', ['opened', 'closing_control'])]}"
invisible="not display_move_reason_expense or state not in ('opened', 'closing_control')"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Take</span>
Expand Down
9 changes: 3 additions & 6 deletions pos_cash_move_reason/wizard/wizard_pos_move_reason.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@
<form>
<separator
string="Fill in this form if you put money in the cash register"
attrs="{'invisible': [('move_type', '=', 'expense')]}"
invisible="move_type == 'expense'"
/>
<separator
string="Describe why you take money from the cash register"
attrs="{'invisible': [('move_type', '=', 'income')]}"
invisible="move_type == 'income'"
/>
<group>
<field name="move_type" invisible="1" />
<field name="session_id" />
<field name="move_reason_id" />
<field
name="journal_id"
attrs="{'invisible': [('move_reason_id', '=', False)]}"
/>
<field name="journal_id" invisible="not move_reason_id" />
<field name="journal_ids" invisible="1" />
<field name="name" />
<field name="amount" />
Expand Down

0 comments on commit 9951c4f

Please sign in to comment.