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 Sep 23, 2024
1 parent a606c9c commit 6a44b78
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 36 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
3 changes: 1 addition & 2 deletions pos_cash_move_reason/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
"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": [
"security/ir_rule.xml",
"security/res_groups.xml",
"security/ir.model.access.csv",
"views/view_pos_move_reason.xml",
"views/view_pos_session.xml",
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]>\>
11 changes: 0 additions & 11 deletions pos_cash_move_reason/security/res_groups.xml

This file was deleted.

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 6a44b78

Please sign in to comment.