From 5a3acd71ed1aba2817189d4e8ffef72099c1148b Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Thu, 14 Mar 2013 19:07:50 +0530 Subject: [PATCH] [IMP] give access rights in yml of sale_stock bzr revid: fka@tinyerp.com-20130314133750-r034ygbcna6l49m6 --- addons/sale_stock/__openerp__.py | 3 +- .../test/cancel_order_sale_stock.yml | 17 +++++++- .../sale_stock/test/picking_order_policy.yml | 25 ++++++++++- .../sale_stock/test/prepaid_order_policy.yml | 5 ++- .../sale_stock/test/sale_order_onchange.yml | 5 +++ addons/sale_stock/test/sale_stock_users.yml | 41 +++++++++++++++++++ 6 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 addons/sale_stock/test/sale_stock_users.yml diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py index a849df295d4..a1941524868 100644 --- a/addons/sale_stock/__openerp__.py +++ b/addons/sale_stock/__openerp__.py @@ -59,7 +59,8 @@ You can choose flexible invoicing methods: ], 'data': ['sale_stock_data.xml'], 'demo_xml': ['sale_stock_demo.xml'], - 'test': ['test/cancel_order_sale_stock.yml', + 'test': ['test/sale_stock_users.yml', + 'test/cancel_order_sale_stock.yml', 'test/picking_order_policy.yml', 'test/prepaid_order_policy.yml', 'test/sale_order_onchange.yml', diff --git a/addons/sale_stock/test/cancel_order_sale_stock.yml b/addons/sale_stock/test/cancel_order_sale_stock.yml index 9081cac9fa3..397bc0e49fe 100644 --- a/addons/sale_stock/test/cancel_order_sale_stock.yml +++ b/addons/sale_stock/test/cancel_order_sale_stock.yml @@ -1,6 +1,9 @@ - - In order to test the cancel sale order. + In order to test the cancel sale order with that user which have salesman rights. First I confirm order. +- + !context + uid: 'res_sale_stock_salesman' - !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_8} - @@ -8,7 +11,7 @@ - !python {model: stock.picking}: | delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))]) - first_picking = self.browse(cr, uid, delivery_orders[0], context=context) + first_picking = self.browse(cr, uid, delivery_orders[0], context=None) if first_picking.force_assign(cr, uid, first_picking): first_move = first_picking.move_lines[0] values = {'move%s'%(first_move.id): {'product_qty': 2, 'product_uom':ref('product.product_uom_unit')}} @@ -20,12 +23,22 @@ delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))]) last_delivery_order_id = delivery_orders[0] self.pool.get('stock.picking').signal_button_cancel(cr, uid, [last_delivery_order_id]) +- + Only Stock User can change data related warehouse therfore test with that user which have stcok user rights, +- + !context + uid: 'res_stock_user' - I run the scheduler. - !python {model: procurement.order}: | self.run_scheduler(cr, uid) +- + Salesman can also check order therfore test with that user which have salesman rights, +- + !context + uid: 'res_sale_stock_salesman' - I check order status in "Ship Exception". - diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml index f761dfb65db..003bfbc1f30 100644 --- a/addons/sale_stock/test/picking_order_policy.yml +++ b/addons/sale_stock/test/picking_order_policy.yml @@ -1,5 +1,8 @@ - - In order to test process of the Sale Order, + In order to test process of the Sale Order with access rights of saleman, +- + !context + uid: 'res_sale_stock_salesman' - First I check the total amount of the Quotation before Approved. - @@ -33,11 +36,21 @@ assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond." assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond." assert procurement.procure_method == order_line.type, "Procurement method is not correspond." +- + Only Stock User can change data related warehouse therfore test with that user which have stcok user rights, +- + !context + uid: 'res_stock_user' - I run the scheduler. - !python {model: procurement.order}: | self.run_scheduler(cr, uid) +- + Salesman can also check order therfore test with that user which have salesman rights, +- + !context + uid: 'res_sale_stock_salesman' - I check the details of delivery order after confirmed quotation. - @@ -128,6 +141,11 @@ assert inv_line.price_unit == so_line.price_unit , "Price Unit is not correspond." assert inv_line.quantity == (so_line.product_uos and so_line.product_uos_qty) or so_line.product_uom_qty , "Product qty is not correspond." assert inv_line.price_subtotal == so_line.price_subtotal, "Price sub total is not correspond." +- + Only Stock manager can open the Invoice therfore test with that user which have stock manager rights, +- + !context + uid: 'res_stock_manager' - I open the Invoice. - @@ -149,6 +167,11 @@ journal_ids[0], ref('account.cash'), ref('account.period_8'), journal_ids[0], name='test') +- + To test process of the Sale Order with access rights of saleman, +- + !context + uid: 'res_sale_stock_salesman' - I check the order after paid invoice. - diff --git a/addons/sale_stock/test/prepaid_order_policy.yml b/addons/sale_stock/test/prepaid_order_policy.yml index e35a9a82cf9..0e0345868d0 100644 --- a/addons/sale_stock/test/prepaid_order_policy.yml +++ b/addons/sale_stock/test/prepaid_order_policy.yml @@ -1,5 +1,8 @@ - - Now I confirm the Quotation with "Pay before delivery" policy. + Now I confirm the Quotation with "Pay before delivery" policy with access rights of salesman. +- + !context + uid: 'res_sale_stock_salesman' - !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_4} - diff --git a/addons/sale_stock/test/sale_order_onchange.yml b/addons/sale_stock/test/sale_order_onchange.yml index 1026e5627c3..d37dd74e1ef 100644 --- a/addons/sale_stock/test/sale_order_onchange.yml +++ b/addons/sale_stock/test/sale_order_onchange.yml @@ -1,3 +1,8 @@ +- + In sale order to test process of onchange of Sale Order with access rights of salemanager, +- + !context + uid: 'res_sale_stock_salesmanager' - In order to test the onchange of the Sale Order, I create a product - diff --git a/addons/sale_stock/test/sale_stock_users.yml b/addons/sale_stock/test/sale_stock_users.yml new file mode 100644 index 00000000000..f9bd1cf1727 --- /dev/null +++ b/addons/sale_stock/test/sale_stock_users.yml @@ -0,0 +1,41 @@ +- + Create a user as 'Salesmanager' +- + !record {model: res.users, id: res_sale_stock_salesmanager}: + company_id: base.main_company + name: Sales manager + login: ssm + password: ssm + groups_id: + - base.group_sale_manager +- + Create a user as 'Salesman' +- + !record {model: res.users, id: res_sale_stock_salesman}: + company_id: base.main_company + name: Salesman + login: ssu + password: ssu + groups_id: + - base.group_sale_salesman_all_leads +- + Create a user as 'Stock User' +- + !record {model: res.users, id: res_stock_user}: + company_id: base.main_company + name: Stock User + login: sau + password: sau + groups_id: + - stock.group_stock_user +- + Create a user as 'Stock Manager' +- + !record {model: res.users, id: res_stock_manager}: + company_id: base.main_company + name: Stock Manager + login: sam + password: sam + email: admin@portal.example.com + groups_id: + - stock.group_stock_manager \ No newline at end of file