[IMP, FIX]: mrp_repair: taken proper destination location for yml demo

* Fixed flow of repair cancel yml
* Improvement in test statements

bzr revid: rpa@tinyerp.com-20110926133334-la8tj3yqf98gd3jm
This commit is contained in:
Rucha (Open ERP) 2011-09-26 19:03:34 +05:30
parent ad46817291
commit a8e8a033ff
2 changed files with 29 additions and 40 deletions

View File

@ -1,13 +1,11 @@
-
In order to test "mrp_repair" module.
-
I have create stock move line record.
In order to test repair orders I have created stock move line record.
-
!record {model: stock.move, id: stock_move_pcbasicpc0}:
company_id: base.main_company
date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
location_dest_id: stock.stock_location_stock
location_dest_id: stock.stock_location_14
location_id: stock.stock_location_stock
name: '[PC1] Basic PC'
product_id: product.product_product_pc1
@ -16,18 +14,17 @@
product_uos_qty: 1.0
-
I start by creating new Repair order for "Basic Pc" product and Invoice Type b4repair.
I start by creating new Repair order for "Basic PC" product and Invoice Method is "No Invoice".
-
!record {model: mrp.repair, id: mrp_repair_rma2}:
address_id: base.res_partner_address_1
guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d")
invoice_method: 'b4repair'
invoice_method: 'none'
partner_invoice_id: base.res_partner_address_1
location_dest_id: stock.stock_location_14
location_id: stock.stock_location_14
move_id: 'stock_move_pcbasicpc0'
name: RMA000055
invoiced: 1
operations:
- location_dest_id: stock.location_production
location_id: stock.stock_location_stock
@ -48,56 +45,52 @@
partner_id: base.res_partner_9
product_id: product.product_product_pc1
-
I confirm This Repair order.
I confirm this Repair order.
-
!workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2}
-
Cancel Repair order.
I Cancel this Repair order.
-
!python {model: mrp.repair.cancel}: |
context = {"lang": 'en_US', "active_model":"mrp.repair", "active_ids": [ref("mrp_repair_rma2")], "tz": False, "active_id":ref('mrp_repair_rma2')}
self.fields_view_get(cr, uid, False, "form", context)
self.cancel_repair(cr, uid, [ref("mrp_repair_rma2")], context=context)
- |
I check that Repair order is in "Cancel" state.
-
Reopen the repair order in draft state.
!assert {model: mrp.repair, id: mrp_repair_rma2}:
- state == 'cancel'
-
I Reopen the repair order as new.
-
!python {model: mrp.repair}: |
self.action_cancel_draft(cr, uid, [ref('mrp_repair_rma2')])
-
I change the Invoice method of the repair order to Before repair.
-
!python {model: mrp.repair}: |
self.write(cr, uid, [ref('mrp_repair_rma2')], {'invoice_method': 'b4repair'})
-
I confirm the Repair order again.
-
!workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2}
-
Repair order state to 'Ready'.
-
!python {model: mrp.repair}: |
self.action_repair_ready(cr, uid, [ref('mrp_repair_rma2')], context=None)
-
Cancel repair order.
-
!python {model: mrp.repair}: |
self.action_cancel(cr, uid, [ref('mrp_repair_rma2')], context=None)
-
Reopen the repair order in draft state.
-
!python {model: mrp.repair}: |
self.action_cancel_draft(cr, uid, [ref('mrp_repair_rma2')])
-
I confirm This Repair order For Invoice Type b4repair.
-
!workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma2}
-
I click on "Create Invoice" button of this wizard to make invoice.
-
!python {model: mrp.repair}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.repair', ref("mrp_repair.mrp_repair_rma2"), 'action_invoice_create', cr)
!workflow {model: mrp.repair, action: action_invoice_create, ref: mrp_repair_rma2}
-
I check that Invoice is created for this repair order.
-
!python {model: account.invoice}: |
mrp_obj = self.pool.get('mrp.repair')
repair_id = mrp_obj.browse(cr, uid, [ref('mrp_repair_rma2')], context=context)[0]
assert repair_id.invoice_id.id, _("No invoice existing for this partner")
!python {model: mrp.repair}: |
repair_id = self.browse(cr, uid, [ref('mrp_repair_rma2')], context=context)[0]
assert repair_id.invoice_id.id, _("No invoice exists for this repair order.")
-
I start the repairing process by click on "Start Repair" Button For Invoice Type b4repair.
I start the repairing process by click on "Start Repair" Button.
-
!workflow {model: mrp.repair, action: action_repair_start, ref: mrp_repair_rma2}
-

View File

@ -8,7 +8,7 @@
company_id: base.main_company
date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
location_dest_id: stock.stock_location_stock
location_dest_id: stock.stock_location_14
location_id: stock.stock_location_stock
name: '[PC1] Basic PC'
product_id: product.product_product_pc1
@ -17,7 +17,7 @@
product_uos_qty: 1.0
- |
I start by creating new Repair order for "Basic Pc" product.
I start by creating new Repair order for "Basic PC" product.
-
!record {model: mrp.repair, id: mrp_repair_rma0}:
address_id: base.res_partner_address_1
@ -115,9 +115,5 @@
I check that Invoice is created for this repair order.
-
!python {model: mrp.repair}: |
obj_lines = self.pool.get('account.invoice.line')
inv_obj = self.pool.get('account.invoice')
repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)])
invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0]
assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner"
assert repair_id.invoice_id.id, _("No invoice exists for this repair order")