Skip to content

Commit

Permalink
[MIG] sale_cancel_reason: fix test and pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo committed Apr 17, 2023
1 parent ba026b9 commit 6b9d4ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions sale_cancel_reason/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
* Bhavesh Odedra <[email protected]>
* Alan Ramos <[email protected]>
* Aritz Olea <[email protected]>, Landoo SL
* Hugo Córdoba <[email protected]>
9 changes: 3 additions & 6 deletions sale_cancel_reason/tests/test_sale_cancel_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ def test_sale_order_cancel_reason(self):
- Then the sale order should be canceled and the reason stored
"""
SaleOrderCancel = self.env["sale.order.cancel"]
context = {
"active_model": "sale.order",
"active_ids": [self.sale_order.id],
}
wizard = SaleOrderCancel.create(
{"reason_id": self.reason.id, "order_id": self.sale_order.id}
)
wizard.with_context(context).action_cancel()
wizard.with_context(
active_model="sale.order", active_ids=self.sale_order.id
).action_cancel()
self.assertEqual(
self.sale_order.state, "cancel", "the sale order should be canceled"
)
Expand All @@ -37,6 +35,5 @@ def setUp(self):
"order_line": [
(0, 0, {"product_id": self.product.id, "product_uom_qty": 8})
],
"cancel_confirm": True,
}
)
10 changes: 7 additions & 3 deletions sale_cancel_reason/view/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="/form/sheet/div/h1" position="after">
<p >
<label for="cancel_reason_id" string="Cancellation reason:" attrs="{'invisible': [('state', '!=', 'cancel')]}"/>
<p>
<label
for="cancel_reason_id"
string="Cancellation reason:"
attrs="{'invisible': [('state', '!=', 'cancel')]}"
/>
<field
name="cancel_reason_id"
class="oe_inline"
Expand All @@ -31,7 +35,7 @@
<field name="name">Sale Order Cancel Reason</field>
<field name="model">sale.order.cancel.reason</field>
<field name="arch" type="xml">
<tree string="Sale Order Cancel Reasons">
<tree>
<field name="name" />
</tree>
</field>
Expand Down

0 comments on commit 6b9d4ec

Please sign in to comment.