diff --git a/ao_rma/__manifest__.py b/ao_rma/__manifest__.py
index f2750d22..dc152adb 100644
--- a/ao_rma/__manifest__.py
+++ b/ao_rma/__manifest__.py
@@ -12,12 +12,15 @@
"repair_account", "repair_refurbish", "rma_kanban_stage",
"base_automation",
],
- "data": ["data/account_data.xml",
- "data/rma_stage.xml",
- "data/stock_data.xml",
- "data/repair_data.xml",
- "data/rma_operation.xml",
- "data/base_automation_data.xml",
+ "data": ["data/rma_stage.xml",
+ "views/rma_operation_view.xml",
+ "views/rma_order_line_view.xml",
+ "wizards/rma_order_line_make_repair_view.xml",
+ ],
+ "demo": ["demo/account_data.xml",
+ "demo/stock_data.xml",
+ "demo/repair_data.xml",
+ "demo/rma_operation.xml",
"views/rma_operation_view.xml",
"views/rma_order_line_view.xml",
"wizards/rma_order_line_make_repair_view.xml",
diff --git a/ao_rma/data/base_automation_data.xml b/ao_rma/data/base_automation_data.xml
deleted file mode 100644
index 5411a8bd..00000000
--- a/ao_rma/data/base_automation_data.xml
+++ /dev/null
@@ -1,261 +0,0 @@
-
-
-
-
-
-
-
- New > Awaiting Return
-
- object_write
- on_write
- object_write
-
- ['|', ('state', '=', 'draft'), ('state', '=', 'to_approve')]
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', True)]
-
-
-
-
- reference
- 5
-
-
-
-
-
-
- New > Awaiting Payment
-
- object_write
- on_write
- object_write
-
- ['|', ('state', '=', 'draft'), ('state', '=', 'to_approve')]
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), ('sale_policy', '=', 'ordered')]
-
-
-
-
- reference
- 5
-
-
-
-
-
-
-
- Awaiting Return > New
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved')]
- [('state', '=', 'draft')]
-
-
-
-
- reference
- 5
-
-
-
-
-
-
- Awaiting return > Awaiting Eval/Repair
-
- object_write
- on_write
- object_write
-
- [('qty_to_repair', '>', 0)]
- [('qty_to_repair', '=', '0'), ('qty_to_receive', '=', 0), ('qty_repaired', '=', '0')]
-
-
-
-
- reference
- 5
-
-
-
-
-
-
- Awaiting Eval/Repair > Under Repair/Being evaluated
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', True), ('qty_under_repair', '=', 0)]
- ['&','&', ('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', True), '|', ('qty_under_repair', '>', 0)]
-
-
-
-
- reference
- 5
-
-
-
-
-
- Awaiting Eval/Repair > Awaiting Payment
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), ('qty_under_repair', '=', 0)]
- ['&','&', ('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), '|', ('repair_ids.state', '=', 'confirmed'), ('qty_under_repair', '>', 0)]
-
-
-
-
- reference
- 5
-
-
-
-
-
-
- Under Repair/Being Evaluated > Ready To Be Shipped
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.to_refurbish', '=', False), ('qty_under_repair', '>', 0)]
- [('state', '=', 'approved'), ('qty_under_repair', '=', 0), ('qty_to_repair', '=', 0), ('qty_repaired', '>', 0)]
-
-
-
-
- reference
- 5
-
-
-
-
-
- Under Repair/Being Evaluated > To Be Refurbed
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.to_refurbish', '=', True), ('qty_under_repair', '>', 0)]
- [('state', '=', 'approved'), ('qty_repaired', '>', 0), ('qty_under_repair', '=', 0)]
-
-
-
-
- reference
- 5
-
-
-
-
-
-
- Awaiting Payment > Awaiting Return
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), ('sale_line_ids.invoice_status', '=', 'open'), ('repair_ids', '=', False)]
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), ('sale_line_ids.invoice_status', '=', 'paid')]
-
-
-
-
- reference
- 5
-
-
-
-
-
- Awaiting Payment > Under Repair/Being Evaluated
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), ('repair_ids.invoice_id.state', '=', 'open')]
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), ('repair_ids.invoice_id.state', '=', 'paid')]
-
-
-
-
- reference
- 5
-
-
-
-
-
-
- To be Refurbed > Closed
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.to_refurbish', '=', True), ('qty_to_deliver', '>', 0)]
- [('state', '=', 'approved'), ('operation_id.repair_type_id.to_refurbish', '=', True), ('qty_to_deliver', '=', 0)]
-
-
-
-
- reference
- 5
-
-
-
-
-
- Ready to be Shipped > CSR Followup
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), ('qty_to_deliver', '>', 0)]
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', False), ('qty_to_deliver', '=', 0)]
-
-
-
-
- reference
- 5
-
-
-
-
-
- Ready to be Shipped > Closed
-
- object_write
- on_write
- object_write
-
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', True), ('qty_to_deliver', '>', 0)]
- [('state', '=', 'approved'), ('operation_id.repair_type_id.under_warranty', '=', True), ('qty_to_deliver', '=', 0)]
-
-
-
-
- reference
- 5
-
-
-
-
diff --git a/ao_rma/data/account_data.xml b/ao_rma/demo/account_data.xml
similarity index 100%
rename from ao_rma/data/account_data.xml
rename to ao_rma/demo/account_data.xml
diff --git a/ao_rma/data/repair_data.xml b/ao_rma/demo/repair_data.xml
similarity index 99%
rename from ao_rma/data/repair_data.xml
rename to ao_rma/demo/repair_data.xml
index 65e9c1fb..461bf3a5 100644
--- a/ao_rma/data/repair_data.xml
+++ b/ao_rma/demo/repair_data.xml
@@ -56,6 +56,7 @@
+ none
diff --git a/ao_rma/data/rma_operation.xml b/ao_rma/demo/rma_operation.xml
similarity index 100%
rename from ao_rma/data/rma_operation.xml
rename to ao_rma/demo/rma_operation.xml
diff --git a/ao_rma/data/stock_data.xml b/ao_rma/demo/stock_data.xml
similarity index 73%
rename from ao_rma/data/stock_data.xml
rename to ao_rma/demo/stock_data.xml
index 354ed20c..b43b7779 100644
--- a/ao_rma/data/stock_data.xml
+++ b/ao_rma/demo/stock_data.xml
@@ -25,48 +25,6 @@
-
- RMA -> Supplier
-
-
-
-
- outgoing
-
-
-
- Supplier -> RMA
-
-
-
-
- incoming
-
-
-
- RMA → Supplier
- pull
-
-
-
- make_to_stock
-
-
-
-
-
- Supplier → RMA
- pull
-
-
-
- make_to_stock
-
-
-
-
RMA External Location
diff --git a/ao_rma/tests/test_ao_rma.py b/ao_rma/tests/test_ao_rma.py
index e372b3b2..34b896fc 100644
--- a/ao_rma/tests/test_ao_rma.py
+++ b/ao_rma/tests/test_ao_rma.py
@@ -15,6 +15,7 @@ def setUpClass(cls):
cls.rma = cls.env['rma.order']
cls.rma_line = cls.env['rma.order.line']
cls.rma_op = cls.env['rma.operation']
+ cls.RepairMakeInvoice = cls.env['repair.order.make_invoice']
cls.product_id = cls.env.ref('product.product_product_4')
cls.uom_unit = cls.env.ref('uom.product_uom_unit')
cls.partner_id = cls.env.ref('base.res_partner_2')
@@ -255,6 +256,15 @@ def test_11_repair_no_warranty(cls):
repair.action_repair_ready()
repair.action_repair_start()
repair.action_repair_end()
+ make_invoice = cls.RepairMakeInvoice.create({
+ 'group': True})
+ # I click on "Create Invoice" button of this wizard to make invoice.
+ context = {
+ "active_model": 'repair_order',
+ "active_ids": [repair.id],
+ "active_id": repair.id
+ }
+ make_invoice.with_context(context).make_invoices()
# deliver
cls.assertEqual(rma.qty_to_deliver, 1.0)
wizard = cls.rma_make_picking.with_context({
@@ -280,7 +290,7 @@ def test_12_repair_under_warranty(cls):
# create rma and receive in external location
rma = cls.create_customer_rma(cls.partner_id, cls.product_id,
- cls.operation_nw)
+ cls.operation_warranty)
rma._onchange_operation_id()
cls.assertEqual(rma.repair_type, 'received')
rma.action_rma_approve()
@@ -331,8 +341,8 @@ def test_12_repair_under_warranty(cls):
repair.action_repair_ready()
repair.action_repair_start()
repair.action_repair_end()
-
# deliver
+ cls.assertEqual(rma.qty_repaired, 1.0)
cls.assertEqual(rma.qty_to_deliver, 1.0)
wizard = cls.rma_make_picking.with_context({
'active_ids': rma.id,