[IMP] Sale: sale related modules changes + yaml
bzr revid: mra@mra-laptop-20100804123819-zzl4gfy4mpcxc3ss
This commit is contained in:
parent
6bc14aefbf
commit
884a829c1f
|
@ -56,6 +56,10 @@
|
|||
'report/sale_journal_report_view.xml',
|
||||
],
|
||||
'demo_xml': ['sale_journal_demo.xml'],
|
||||
'test': [
|
||||
'test/sale_journal.yml',
|
||||
'test/picking_journal.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0077661619085',
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
-
|
||||
In order to test the sale_journal module in OpenERP,
|
||||
I create a picking journal
|
||||
-
|
||||
!record {model: sale_journal.picking.journal, id: sale_journal_picking_journal_pickjournal0}:
|
||||
code: PJ
|
||||
date: '2010-08-04'
|
||||
date_created: '2010-08-04'
|
||||
name: Pick_journal
|
||||
state: draft
|
||||
user_id: base.user_root
|
||||
-
|
||||
I create a picking for product keyboard, quantity 50
|
||||
-
|
||||
!record {model: stock.picking, id: stock_picking_out0}:
|
||||
address_id: base.res_partner_address_6
|
||||
company_id: base.main_company
|
||||
invoice_state: none
|
||||
journal_id: sale_journal_picking_journal_pickjournal0
|
||||
move_lines:
|
||||
- company_id: base.main_company
|
||||
date_expected: '2010-08-04 14:09:38'
|
||||
date_planned: '2010-08-04 14:09:38'
|
||||
location_id: stock.stock_location_stock
|
||||
product_id: product.product_product_24
|
||||
product_qty: 50.0
|
||||
product_uom: product.product_uom_unit
|
||||
location_dest_id: stock.stock_location_customers
|
||||
name: '[KEYA] Keyboard - AZERTY'
|
||||
product_uos_qty: 50.0
|
||||
move_type: direct
|
||||
name: OUT/00007
|
||||
type: out
|
||||
-
|
||||
I verify that a Journal consist of picking order
|
||||
-
|
||||
!python {model: sale_journal.picking.journal}: |
|
||||
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
|
||||
assert pick_jour.picking_stats_ids, "Journal does not consist of a picking order"
|
||||
-
|
||||
Then I click on the 'Open Journal' button
|
||||
-
|
||||
!python {model: sale_journal.picking.journal}: |
|
||||
self.button_open(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
|
||||
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
|
||||
"active_id": ref("sale_journal.menu_definition_journal_picking")})
|
||||
-
|
||||
I verify that a state of journal has transit from draft to open state
|
||||
-
|
||||
!python {model: sale_journal.picking.journal}: |
|
||||
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
|
||||
assert (pick_jour.state == 'open'), "Journal is not in the open state"
|
||||
-
|
||||
Then I click on the 'Confirm Picking' button
|
||||
-
|
||||
!python {model: sale_journal.picking.journal}: |
|
||||
self.button_picking_confirm(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
|
||||
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
|
||||
"active_id": ref("sale_journal.menu_definition_journal_picking")})
|
||||
-
|
||||
I verify that a state of journal has transit from open to confirm state
|
||||
-
|
||||
!python {model: sale_journal.picking.journal}: |
|
||||
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
|
||||
assert (pick_jour.state == 'confirm'), "Journal is not in the open state"
|
||||
-
|
||||
I verify that an picking order is now in the confirm state
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
pick_jour_obj = self.pool.get('sale_journal.picking.journal')
|
||||
jour = pick_jour_obj.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
|
||||
stock_pick = self.browse(cr, uid, ref("stock_picking_out0"))
|
||||
pick_jour = self.search(cr, uid, [('journal_id','=',jour.name) and ('state','=','confirmed')])
|
||||
assert pick_jour, "Sale order is not in the confirm state"
|
||||
-
|
||||
Then I click on the 'Close Journal' button
|
||||
-
|
||||
!python {model: sale_journal.picking.journal}: |
|
||||
self.button_close(cr, uid, [ref("sale_journal_picking_journal_pickjournal0")], {"lang": "en_US", "search_default_user_id":
|
||||
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal_picking")],
|
||||
"active_id": ref("sale_journal.menu_definition_journal_picking")})
|
||||
-
|
||||
I verify that a state of journal has transit from confirm to close state
|
||||
-
|
||||
!python {model: sale_journal.picking.journal}: |
|
||||
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
|
||||
assert (pick_jour.state == 'close'), "Journal is not in the open state"
|
|
@ -0,0 +1,95 @@
|
|||
-
|
||||
In order to test the sale_journal module in OpenERP,
|
||||
I create a sale journal and place a sale order related to a journal
|
||||
-
|
||||
I create a sale journal
|
||||
-
|
||||
!record {model: sale_journal.sale.journal, id: sale_journal_sale_journal_journal0}:
|
||||
code: J1
|
||||
date: '2010-08-04'
|
||||
date_created: '2010-08-04'
|
||||
name: Journal_1
|
||||
state: draft
|
||||
user_id: base.user_root
|
||||
-
|
||||
I place a sale order for product keyboard, quantity 100
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so0}:
|
||||
date_order: '2010-08-04'
|
||||
invoice_quantity: order
|
||||
invoice_type_id: sale_journal.daily
|
||||
journal_id: sale_journal_sale_journal_journal0
|
||||
name: Test_SO012
|
||||
order_line:
|
||||
- name: '[KEYA] Keyboard - AZERTY'
|
||||
price_unit: 7.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 100.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: product.product_product_24
|
||||
product_uos_qty: 100.0
|
||||
th_weight: 0.0
|
||||
type: make_to_stock
|
||||
order_policy: manual
|
||||
partner_id: base.res_partner_4
|
||||
partner_invoice_id: base.res_partner_address_7
|
||||
partner_order_id: base.res_partner_address_7
|
||||
partner_shipping_id: base.res_partner_address_7
|
||||
picking_policy: direct
|
||||
pricelist_id: product.list0
|
||||
shop_id: sale.shop
|
||||
-
|
||||
I verify that a Journal consist of sale order
|
||||
-
|
||||
!python {model: sale_journal.sale.journal}: |
|
||||
sal_jour = self.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
|
||||
assert sal_jour.sale_stats_ids, "Journal does not consist of a sale order details"
|
||||
-
|
||||
Then I click on the 'Open Journal' button
|
||||
-
|
||||
!python {model: sale_journal.sale.journal}: |
|
||||
self.button_open(cr, uid, [ref("sale_journal_sale_journal_journal0")], {"lang": "en_US", "search_default_user_id":
|
||||
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal")],
|
||||
"active_id": ref("sale_journal.menu_definition_journal")})
|
||||
-
|
||||
I verify that a state of journal has transit from draft to open state
|
||||
-
|
||||
!python {model: sale_journal.sale.journal}: |
|
||||
sal_jour = self.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
|
||||
assert (sal_jour.state == 'open'), "Journal is not in the open state"
|
||||
-
|
||||
Then I click on the 'Confirm Sales' button
|
||||
-
|
||||
!python {model: sale_journal.sale.journal}: |
|
||||
self.button_sale_confirm(cr, uid, [ref("sale_journal_sale_journal_journal0")], {"lang": "en_US", "search_default_user_id":
|
||||
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal")],
|
||||
"active_id": ref("sale_journal.menu_definition_journal")})
|
||||
-
|
||||
I verify that a state of journal has transit from open to confirm state
|
||||
-
|
||||
!python {model: sale_journal.sale.journal}: |
|
||||
sal_jour = self.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
|
||||
assert (sal_jour.state == 'confirm'), "Journal is not in the confirm state"
|
||||
-
|
||||
I verify that a sale order is now in the confirm state
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
sale_jour_obj = self.pool.get('sale_journal.sale.journal')
|
||||
jour = sale_jour_obj.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
so_jour = self.search(cr, uid, [('journal_id','=',jour.name) and ('state','=','manual')])
|
||||
assert so_jour, "Sale order is not in the confirm state"
|
||||
-
|
||||
Then I click on the 'Close Journal' button
|
||||
-
|
||||
!python {model: sale_journal.sale.journal}: |
|
||||
self.button_close(cr, uid, [ref("sale_journal_sale_journal_journal0")], {"lang": "en_US", "search_default_user_id":
|
||||
1, "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale_journal.menu_definition_journal")],
|
||||
"active_id": ref("sale_journal.menu_definition_journal")})
|
||||
-
|
||||
I verify that a state of journal has transit from confirm to close state
|
||||
-
|
||||
!python {model: sale_journal.sale.journal}: |
|
||||
sal_jour = self.browse(cr, uid, ref("sale_journal_sale_journal_journal0"))
|
||||
assert (sal_jour.state == 'close'), "Journal is not in the close state"
|
|
@ -38,6 +38,7 @@
|
|||
'sale_mrp_view.xml',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'test':['test/sale_mrp.yml'],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '',
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
-
|
||||
In order to test the sale_mrp module in OpenERP,I start by creating a new product 'Slider Mobile'
|
||||
-
|
||||
I define product category Mobile Products Sellable.
|
||||
-
|
||||
!record {model: product.category, id: product_category_allproductssellable0}:
|
||||
name: Mobile Products Sellable
|
||||
-
|
||||
I define product category Mobile Services.
|
||||
-
|
||||
!record {model: product.category, id: product_category_services0}:
|
||||
name: Mobile Services
|
||||
-
|
||||
I define product template for Slider Mobile.
|
||||
-
|
||||
!record {model: product.template, id: product_template_slidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: Slider Mobile
|
||||
procure_method: make_to_order
|
||||
standard_price: 189.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I define a product Slider Mobile
|
||||
-
|
||||
!record {model: product.product, id: product_product_slidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: Slider Mobile
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 189.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 200.00\n'
|
||||
procure_method: make_to_order
|
||||
seller_delay: '1'
|
||||
seller_ids:
|
||||
- delay: 1
|
||||
name: base.res_partner_agrolait
|
||||
min_qty: 2.0
|
||||
qty: 5.0
|
||||
standard_price: 189.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
I create a Bill of Material record for Slider Mobile
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_slidermobile0}:
|
||||
company_id: base.main_company
|
||||
name: Slider Mobile
|
||||
product_efficiency: 1.0
|
||||
product_id: product_product_slidermobile0
|
||||
product_qty: 1.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 0.0
|
||||
sequence: 0.0
|
||||
type: normal
|
||||
-
|
||||
I create a sale order for product Slider mobile
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so0}:
|
||||
client_order_ref: ref1
|
||||
date_order: '2010-08-4'
|
||||
invoice_quantity: order
|
||||
name: Test_SO001
|
||||
order_line:
|
||||
- name: Slider Mobile
|
||||
price_unit: 200
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: product_product_slidermobile0
|
||||
product_uos_qty: 500.0
|
||||
type: make_to_order
|
||||
order_policy: manual
|
||||
partner_id: base.res_partner_4
|
||||
partner_invoice_id: base.res_partner_address_7
|
||||
partner_order_id: base.res_partner_address_7
|
||||
partner_shipping_id: base.res_partner_address_7
|
||||
picking_policy: direct
|
||||
pricelist_id: product.list0
|
||||
shop_id: sale.shop
|
||||
-
|
||||
I confirm the sale order
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
|
||||
-
|
||||
I verify that a procurement has been generated for sale order
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
assert proc_ids, _('No Procurements!')
|
||||
-
|
||||
Then I click on the "Run Procurement" button
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
|
||||
for proc in proc_ids:
|
||||
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
|
||||
-
|
||||
I verify that a procurement state is "running"
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
|
||||
assert proc_ids, _('Procurement is not in the running state!')
|
||||
-
|
||||
I verify that a manufacturing order has been generated
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
mnf_obj=self.pool.get('mrp.production')
|
||||
mnf_id=mnf_obj.search(cr, uid, [('origin','=',so.name)])
|
||||
assert mnf_id, _('Manufacturing order has not been generated')
|
||||
-
|
||||
I verify that a 'Sale Name' field of Manufacturing order gets bind with the value
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
mnf_obj=self.pool.get('mrp.production')
|
||||
mnf_id=mnf_obj.search(cr, uid, [('sale_name','=',so.name)])
|
||||
assert mnf_id, _('Sale Name is not bind with the value')
|
||||
-
|
||||
I verify that a 'Sale Reference' field of Manufacturing order gets bind with the value
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
mnf_obj=self.pool.get('mrp.production')
|
||||
mnf_id=mnf_obj.search(cr, uid, [('sale_ref','=',so.client_order_ref)])
|
||||
assert mnf_id, _('Sale Reference is not bind with the value')
|
Loading…
Reference in New Issue