diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index a380a69dc03..e06e41cf001 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -146,6 +146,7 @@ for a particular financial year and for preparation of vouchers there is a modul 'account_unit_test.xml', ], 'test': [ + 'test/account_test_users.yml', 'test/account_customer_invoice.yml', 'test/account_supplier_invoice.yml', 'test/account_change_currency.yml', diff --git a/addons/account/test/account_customer_invoice.yml b/addons/account/test/account_customer_invoice.yml index b2d87e753de..d0b445fcff5 100644 --- a/addons/account/test/account_customer_invoice.yml +++ b/addons/account/test/account_customer_invoice.yml @@ -1,7 +1,10 @@ - In order to test account invoice I create a new customer invoice - - I will create bank detail + I will create bank detail with using manager access rights because account manager can only create bank details. +- + !context + uid: 'res_users_account_manager' - !record {model: res.partner.bank, id: res_partner_bank_0}: state: bank @@ -11,6 +14,11 @@ footer: True bank: base.res_bank_1 bank_name: Reserve +- + Test with that user which have rights to make Invoicing and payment and who is accountant. +- + !context + uid: 'res_users_account_user' - I create a customer invoice - diff --git a/addons/account/test/account_invoice_state.yml b/addons/account/test/account_invoice_state.yml index 7b995150af0..34ac53e7b85 100644 --- a/addons/account/test/account_invoice_state.yml +++ b/addons/account/test/account_invoice_state.yml @@ -1,3 +1,8 @@ +- + Test with that user which have rights to make Invoicing. +- + !context + uid: 'res_users_account_user' - In order to test Confirm Draft Invoice wizard I create an invoice and confirm it with this wizard - diff --git a/addons/account/test/account_supplier_invoice.yml b/addons/account/test/account_supplier_invoice.yml index 2232b8dc00e..a59ede03e4e 100644 --- a/addons/account/test/account_supplier_invoice.yml +++ b/addons/account/test/account_supplier_invoice.yml @@ -1,3 +1,8 @@ +- + Test with that Finance manager who can only create supplier invoice. +- + !context + uid: 'res_users_account_manager' - In order to test account invoice I create a new supplier invoice - diff --git a/addons/account/test/account_test_users.yml b/addons/account/test/account_test_users.yml new file mode 100644 index 00000000000..143e8bb5473 --- /dev/null +++ b/addons/account/test/account_test_users.yml @@ -0,0 +1,32 @@ +- + Create a user as 'Accountant' +- + !record {model: res.users, id: res_users_account_user}: + company_id: base.main_company + name: Accountant + login: acc + password: acc + email: accountuser@yourcompany.com +- + I added groups for Accountant. +- + !record {model: res.users, id: res_users_account_user}: + groups_id: + - account.group_account_user + - base.group_partner_manager +- + Create a user as 'Financial Manager' +- + !record {model: res.users, id: res_users_account_manager}: + company_id: base.main_company + name: Financial Manager + login: fm + password: fm + email: accountmanager@yourcompany.com +- + I added groups for Financial Manager. +- + !record {model: res.users, id: res_users_account_manager}: + groups_id: + - account.group_account_manager + - base.group_partner_manager \ No newline at end of file diff --git a/addons/account/test/account_validate_account_move.yml b/addons/account/test/account_validate_account_move.yml index d47ee564019..a99ae3b4d43 100644 --- a/addons/account/test/account_validate_account_move.yml +++ b/addons/account/test/account_validate_account_move.yml @@ -1,3 +1,8 @@ +- + Test validate account move with user who is accountant which have its rights.' +- + !context + uid: 'res_users_account_user' - In order to test the account move lines in OpenERP, I create account move - diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py index a043b15a518..0659e4f4bae 100644 --- a/addons/account_voucher/__openerp__.py +++ b/addons/account_voucher/__openerp__.py @@ -61,6 +61,7 @@ This module manages: 'account_voucher_data.xml', ], 'test' : [ + 'test/account_voucher_users.yml', 'test/case5_suppl_usd_usd.yml', 'test/account_voucher.yml', 'test/sales_receipt.yml', diff --git a/addons/account_voucher/test/account_voucher.yml b/addons/account_voucher/test/account_voucher.yml index 2cd612affc7..46d3a6a0f5b 100644 --- a/addons/account_voucher/test/account_voucher.yml +++ b/addons/account_voucher/test/account_voucher.yml @@ -1,3 +1,9 @@ +- + I check the voucher module with user who is accountant. +- + !context + uid: 'res_users_account_voucher_user' + - In order to check account voucher module in OpenERP I create a customer voucher - diff --git a/addons/account_voucher/test/account_voucher_users.yml b/addons/account_voucher/test/account_voucher_users.yml new file mode 100644 index 00000000000..c96645f0190 --- /dev/null +++ b/addons/account_voucher/test/account_voucher_users.yml @@ -0,0 +1,32 @@ +- + Create a user as 'Accountant for account voucher' +- + !record {model: res.users, id: res_users_account_voucher_user}: + company_id: base.main_company + name: Voucher Accountant + login: vacc + password: acc + email: accountant@yourcompany.com +- + I added groups to Accountant for account voucher. +- + !record {model: res.users, id: res_users_account_voucher_user}: + groups_id: + - base.group_partner_manager + - account.group_account_user +- + Create a user as 'Financial Manager for account voucher' +- + !record {model: res.users, id: res_users_account_voucher_manager}: + company_id: base.main_company + name: Financial Manager for voucher + login: fmv + password: fmv + email: finmanager@yourcompany.com +- + I added groups to Financial Manager for account voucher. +- + !record {model: res.users, id: res_users_account_voucher_manager}: + groups_id: + - base.group_partner_manager + - account.group_account_manager diff --git a/addons/account_voucher/test/case_eur_usd.yml b/addons/account_voucher/test/case_eur_usd.yml index 8dce677fd9a..825fae1d1af 100644 --- a/addons/account_voucher/test/case_eur_usd.yml +++ b/addons/account_voucher/test/case_eur_usd.yml @@ -1,4 +1,9 @@ ##YAML test on the account_voucher as depicted in this bug report: https://bugs.launchpad.net/openobject-addons/+bug/954155 +- + Only manager can create and take decision about bank and currency there I checkd this test with user who is finance manager. +- + !context + uid: 'res_users_account_voucher_manager' - In order to check the payment with multi-currency in OpenERP, I create an invoice in EUR and make payment in USD based on the currency rating. diff --git a/addons/account_voucher/test/sales_payment.yml b/addons/account_voucher/test/sales_payment.yml index 71e605d5651..3679c34dc52 100644 --- a/addons/account_voucher/test/sales_payment.yml +++ b/addons/account_voucher/test/sales_payment.yml @@ -1,3 +1,8 @@ +- + I test sales payment with user who is accountant. +- + !context + uid: 'res_users_account_voucher_user' - Create an invoice for the partner Seagate with amount 450.0 - diff --git a/addons/account_voucher/test/sales_receipt.yml b/addons/account_voucher/test/sales_receipt.yml index d27083b4513..e75eda2aac0 100644 --- a/addons/account_voucher/test/sales_receipt.yml +++ b/addons/account_voucher/test/sales_receipt.yml @@ -1,3 +1,8 @@ +- + Accountant can also be created receipt and validate it there for I checked it with that user who is accountant. +- + !context + uid: 'res_users_account_voucher_user' - Creating a Voucher Receipt for partner Seagate with amount 30000.0 - diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 1b4ba191b82..b677e7ee10f 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -105,6 +105,7 @@ Dashboard for CRM will include: 'crm_action_rule_demo.xml', ], 'test': [ + 'test/crm_access_group_users.yml', 'test/crm_lead_message.yml', 'test/lead2opportunity2win.yml', 'test/lead2opportunity_assign_salesmen.yml', diff --git a/addons/crm/security/crm_security.xml b/addons/crm/security/crm_security.xml index 34137dc0fac..ef7eb8b24db 100644 --- a/addons/crm/security/crm_security.xml +++ b/addons/crm/security/crm_security.xml @@ -5,6 +5,7 @@ User: Own Leads Only + the user will have access to his own data in the sales application. diff --git a/addons/crm/test/crm_access_group_users.yml b/addons/crm/test/crm_access_group_users.yml new file mode 100644 index 00000000000..51cf52c0abc --- /dev/null +++ b/addons/crm/test/crm_access_group_users.yml @@ -0,0 +1,31 @@ +- + Create a user as 'Crm Salesmanager' +- + !record {model: res.users, id: crm_res_users_salesmanager}: + company_id: base.main_company + name: Crm Sales manager + login: csm + password: csm + email: crmmanager@yourcompany.com +- + I added groups for Crm Salesmanager. +- + !record {model: res.users, id: crm_res_users_salesmanager}: + groups_id: + - base.group_sale_manager +- + Create a user as 'Crm Salesman' +- + !record {model: res.users, id: crm_res_users_salesman}: + company_id: base.main_company + name: Crm Salesman + login: csu + password: csu + email: crmuser@yourcompany.com +- + I added groups for Crm Salesman. +- + !record {model: res.users, id: crm_res_users_salesman}: + groups_id: + - base.group_sale_salesman_all_leads + - base.group_partner_manager diff --git a/addons/crm/test/crm_lead_cancel.yml b/addons/crm/test/crm_lead_cancel.yml index 127fe4d6726..dd475d54919 100644 --- a/addons/crm/test/crm_lead_cancel.yml +++ b/addons/crm/test/crm_lead_cancel.yml @@ -1,21 +1,24 @@ - - I set a new sale team (with Marketing at parent) . + I set a new sale team (with Marketing at parent) giving access rights of salesman. +- + !context + uid: 'crm_res_users_salesmanager' - !python {model: crm.lead}: | section_id = self.pool.get('crm.case.section').create(cr, uid, {'name': "Phone Marketing", 'parent_id': ref("crm.crm_case_section_2")}) self.write(cr, uid, [ref("crm_case_1")], {'section_id': section_id}) - - I check unqualified lead . + Salesman check unqualified lead . - !assert {model: crm.lead, id: crm.crm_case_1, string: Lead is in new stage}: - stage_id.sequence == 1 - - I escalate the lead to parent team. + Salesman escalate the lead to parent team. - !python {model: crm.lead}: | self.case_escalate(cr, uid, [ref("crm_case_1")]) - - I check the lead is correctly escalated to the parent team. + Salesman check the lead is correctly escalated to the parent team. - !assert {model: crm.lead, id: crm.crm_case_1, string: Escalate lead to parent team}: - section_id.name == "Marketing" diff --git a/addons/crm/test/crm_lead_merge.yml b/addons/crm/test/crm_lead_merge.yml index fb166e0486f..0659b55054c 100644 --- a/addons/crm/test/crm_lead_merge.yml +++ b/addons/crm/test/crm_lead_merge.yml @@ -1,6 +1,8 @@ - - - During a mixed merge (involving leads and opps), data should be handled a certain way following their type (m2o, m2m, text, ...) Start by creating two leads and an opp. + During a mixed merge (involving leads and opps), data should be handled a certain way following their type (m2o, m2m, text, ...) Start by creating two leads and an opp and giving the rights of Sales manager. +- + !context + uid: 'crm_res_users_salesmanager' - !record {model: crm.lead, id: test_crm_opp_1}: type: 'opportunity' diff --git a/addons/crm/test/crm_lead_message.yml b/addons/crm/test/crm_lead_message.yml index 0f7d4655398..fcfe658a8f5 100644 --- a/addons/crm/test/crm_lead_message.yml +++ b/addons/crm/test/crm_lead_message.yml @@ -1,3 +1,8 @@ +- + Give the access rights of Salesman to communicate with customer. +- + !context + uid: 'crm_res_users_salesman' - Customer interested in our product, so he sends request by email to get more details. - diff --git a/addons/crm/test/crm_lead_onchange.yml b/addons/crm/test/crm_lead_onchange.yml index d4843ec57e4..f6300d7b965 100644 --- a/addons/crm/test/crm_lead_onchange.yml +++ b/addons/crm/test/crm_lead_onchange.yml @@ -1,5 +1,8 @@ - - I create a lead record to call a partner onchange, stage onchange and mailing opt-in onchange method. + Sales manager create a lead record to call a partner onchange, stage onchange and mailing opt-in onchange method. +- + !context + uid: 'crm_res_users_salesmanager' - !record {model: crm.lead, id: crm_case_25}: name: 'Need more info about your pc2' @@ -7,7 +10,7 @@ type: opportunity stage_id: crm.stage_lead1 - - I create a lead record to call a mailing opt-out onchange method. + Sales manager create a lead record to call a mailing opt-out onchange method. - !record {model: crm.lead, id: crm_case_18}: name: 'Need 20 Days of Consultancy' @@ -15,7 +18,7 @@ stage_id: crm.stage_lead1 opt_out: True - - I create a phonecall record to call a partner onchange method. + Sales manager create a phonecall record to call a partner onchange method. - !record {model: crm.phonecall, id: crm_phonecall_5}: name: 'Bad time' diff --git a/addons/crm/test/crm_lead_unlink.yml b/addons/crm/test/crm_lead_unlink.yml index 49713039f22..be545e53773 100644 --- a/addons/crm/test/crm_lead_unlink.yml +++ b/addons/crm/test/crm_lead_unlink.yml @@ -1,5 +1,8 @@ - - I Unlink the Lead. + Only Sales manager Unlink the Lead so test with Manager's access rights'. +- + !context + uid: 'crm_res_users_salesmanager' - !python {model: crm.lead}: | self.unlink(cr, uid, [ref("crm_case_4")]) diff --git a/addons/crm/test/lead2opportunity2win.yml b/addons/crm/test/lead2opportunity2win.yml index a2499cf4aa9..0a078b9a47c 100644 --- a/addons/crm/test/lead2opportunity2win.yml +++ b/addons/crm/test/lead2opportunity2win.yml @@ -1,3 +1,8 @@ +- + Giving access rights of salesman to convert the lead into opportunity. +- + !context + uid: 'crm_res_users_salesman' - In order to test the conversion of a lead into a opportunity, - diff --git a/addons/crm/test/lead2opportunity_assign_salesmen.yml b/addons/crm/test/lead2opportunity_assign_salesmen.yml index 0edd3b8edce..5a750c94b72 100644 --- a/addons/crm/test/lead2opportunity_assign_salesmen.yml +++ b/addons/crm/test/lead2opportunity_assign_salesmen.yml @@ -1,5 +1,30 @@ - - During a lead to opp conversion, salesmen should be assigned to leads following the round-robin method. Start by creating 6 leads (1 to 6) and 4 salesmen (A to D). + During a lead to opp conversion, salesmen should be assigned to leads following the round-robin method. Start by creating 4 salesmen (A to D) and 6 leads (1 to 6). +- + !record {model: res.users, id: test_res_user_01}: + name: 'Test user A' + login: 'tua' + new_password: 'tua' +- + !record {model: res.users, id: test_res_user_02}: + name: 'Test user B' + login: 'tub' + new_password: 'tub' +- + !record {model: res.users, id: test_res_user_03}: + name: 'Test user C' + login: 'tuc' + new_password: 'tuc' +- + !record {model: res.users, id: test_res_user_04}: + name: 'Test user D' + login: 'tud' + new_password: 'tud' +- + Salesman also creates lead so giving access rights of salesman. +- + !context + uid: 'crm_res_users_salesman' - !record {model: crm.lead, id: test_crm_lead_01}: type: 'lead' @@ -37,27 +62,7 @@ partner_name: 'Agrolait SuperSeed SA' stage_id: stage_lead1 - - !record {model: res.users, id: test_res_user_01}: - name: 'Test user A' - login: 'tua' - new_password: 'tua' -- - !record {model: res.users, id: test_res_user_02}: - name: 'Test user B' - login: 'tub' - new_password: 'tub' -- - !record {model: res.users, id: test_res_user_03}: - name: 'Test user C' - login: 'tuc' - new_password: 'tuc' -- - !record {model: res.users, id: test_res_user_04}: - name: 'Test user D' - login: 'tud' - new_password: 'tud' -- - I create a mass convert wizard and convert all the leads. + Salesman create a mass convert wizard and convert all the leads. - !python {model: crm.lead2opportunity.partner.mass}: | context.update({'active_model': 'crm.lead', 'active_ids': [ref("test_crm_lead_01"), ref("test_crm_lead_02"), ref("test_crm_lead_03"), ref("test_crm_lead_04"), ref("test_crm_lead_05"), ref("test_crm_lead_06")], 'active_id': ref("test_crm_lead_01")}) diff --git a/addons/crm/test/phonecalls.yml b/addons/crm/test/phonecalls.yml index b1ea184f59b..dfc3d6e33b3 100644 --- a/addons/crm/test/phonecalls.yml +++ b/addons/crm/test/phonecalls.yml @@ -1,3 +1,8 @@ +- + Salesman check the phone calls data so test with the access rights of salesman. +- + !context + uid: 'crm_res_users_salesman' - I schedule a phone call with a customer. - diff --git a/addons/event/__openerp__.py b/addons/event/__openerp__.py index 54b77c82f69..e8ecb09bf03 100644 --- a/addons/event/__openerp__.py +++ b/addons/event/__openerp__.py @@ -52,7 +52,7 @@ Key Features 'email_template.xml', ], 'demo': ['event_demo.xml'], - 'test': ['test/process/event_draft2done.yml'], + 'test': ['test/ui/event_users.yml','test/process/event_draft2done.yml'], 'css': ['static/src/css/event.css'], 'installable': True, 'application': True, diff --git a/addons/event/security/event_security.xml b/addons/event/security/event_security.xml index 90a232731a7..5cdd7c9b459 100644 --- a/addons/event/security/event_security.xml +++ b/addons/event/security/event_security.xml @@ -10,6 +10,7 @@ User + diff --git a/addons/event/test/process/event_draft2done.yml b/addons/event/test/process/event_draft2done.yml index eb40340befd..2ad762682e5 100644 --- a/addons/event/test/process/event_draft2done.yml +++ b/addons/event/test/process/event_draft2done.yml @@ -1,3 +1,8 @@ +- + Give the access rights of Event user to organize an event and also do registration. +- + !context + uid: 'res_users_eventuser' - I want to organize an event, into this conference I should create two registration. diff --git a/addons/event/test/ui/event_users.yml b/addons/event/test/ui/event_users.yml new file mode 100644 index 00000000000..cda4ebda750 --- /dev/null +++ b/addons/event/test/ui/event_users.yml @@ -0,0 +1,30 @@ +- + Create a user as 'Event manager' +- + !record {model: res.users, id: res_users_eventmanager}: + company_id: base.main_company + name: Event manager + login: em + password: em + email: eventmanager@yourcompany.com +- + I added groups for Event manager. +- + !record {model: res.users, id: res_users_eventmanager}: + groups_id: + - event.group_event_manager +- + Create a user as 'Event user' +- + !record {model: res.users, id: res_users_eventuser}: + company_id: base.main_company + name: User + login: eu + password: eu + email: eventuser@yourcompany.com +- + I added groups for Event user. +- + !record {model: res.users, id: res_users_eventuser}: + groups_id: + - event.group_event_user diff --git a/addons/hr/__openerp__.py b/addons/hr/__openerp__.py index b074a80aa88..8435d787381 100644 --- a/addons/hr/__openerp__.py +++ b/addons/hr/__openerp__.py @@ -64,6 +64,7 @@ You can manage: ], 'demo': ['hr_demo.xml'], 'test': [ + 'test/hr_users.yml', 'test/open2recruit2close_job.yml', 'test/hr_demo.yml', ], diff --git a/addons/hr/test/hr_demo.yml b/addons/hr/test/hr_demo.yml index 7c184a25c52..db0d0037c4a 100644 --- a/addons/hr/test/hr_demo.yml +++ b/addons/hr/test/hr_demo.yml @@ -1,3 +1,8 @@ +- + Give the access rights of Hr Officer to create employee. +- + !context + uid: 'res_users_hr_officer' - !record {model: hr.job, id: job_developer, view: False}: no_of_employee: 0.0 diff --git a/addons/hr/test/hr_users.yml b/addons/hr/test/hr_users.yml new file mode 100644 index 00000000000..115924d5c1c --- /dev/null +++ b/addons/hr/test/hr_users.yml @@ -0,0 +1,42 @@ +- + Create a user as 'HR Manager' +- + !record {model: res.users, id: res_users_hr_manager}: + company_id: base.main_company + name: HR manager + login: hrm + password: hrm +- + I added groups for HR Manager. +- + !record {model: res.users, id: res_users_hr_manager}: + groups_id: + - base.group_hr_manager +- + Create a user as 'HR Officer' +- + !record {model: res.users, id: res_users_hr_officer}: + company_id: base.main_company + name: HR Officer + login: hro + password: hro +- + I added groups for HR Officer. +- + !record {model: res.users, id: res_users_hr_officer}: + groups_id: + - base.group_hr_user +- + Create a user as 'Employee' +- + !record {model: res.users, id: res_users_employee}: + company_id: base.main_company + name: Employee + login: emp + password: emp +- + I added groups for Employee. +- + !record {model: res.users, id: res_users_employee}: + groups_id: + - base.group_user diff --git a/addons/hr/test/open2recruit2close_job.yml b/addons/hr/test/open2recruit2close_job.yml index 5a01b55439b..5519635d2fc 100644 --- a/addons/hr/test/open2recruit2close_job.yml +++ b/addons/hr/test/open2recruit2close_job.yml @@ -1,3 +1,8 @@ +- + Give the access rights of Hr Officer to the user to test the process of Human Resource Management. +- + !context + uid: 'res_users_hr_officer' - In order to test the process of Human Resource Management, I open Job Postion for "Developer". - diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml index 7902bf11d9d..814f0ee9b8a 100644 --- a/addons/hr_attendance/test/attendance_process.yml +++ b/addons/hr_attendance/test/attendance_process.yml @@ -1,3 +1,22 @@ +- + Create a user as 'HR Attendance Officer' +- + !record {model: res.users, id: res_users_attendance_officer}: + company_id: base.main_company + name: HR Officer + login: ao + password: ao +- + I added groups for HR Attendance Officer. +- + !record {model: res.users, id: res_users_attendance_officer}: + groups_id: + - base.group_hr_user +- + Give the access rights of Hr Officer to test attendance process. +- + !context + uid: 'res_users_attendance_officer' - In order to test attendance process in OpenERP, I entry of SignIn of employee. - diff --git a/addons/hr_holidays/security/ir_rule.xml b/addons/hr_holidays/security/ir_rule.xml index e2c0ffb1a6f..1ff12f41244 100644 --- a/addons/hr_holidays/security/ir_rule.xml +++ b/addons/hr_holidays/security/ir_rule.xml @@ -15,5 +15,12 @@ + + Leaves Officer + + [(1,'=',1)] + + + diff --git a/addons/hr_recruitment/security/hr_recruitment_security.xml b/addons/hr_recruitment/security/hr_recruitment_security.xml index 4fccca1a791..42dd53cda35 100644 --- a/addons/hr_recruitment/security/hr_recruitment_security.xml +++ b/addons/hr_recruitment/security/hr_recruitment_security.xml @@ -9,6 +9,9 @@ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml index a48b70a5683..50637281a70 100644 --- a/addons/hr_recruitment/test/recruitment_process.yml +++ b/addons/hr_recruitment/test/recruitment_process.yml @@ -1,5 +1,23 @@ - - In Order to test process of Recruitment, + Create a user as 'HR Recruitment Officer' +- + !record {model: res.users, id: res_users_hr_recruitment_officer}: + company_id: base.main_company + name: HR Recruitment Officer + login: hrro + password: hrro + email: hrofcr@yourcompany.com +- + I added groups for HR Recruitment Officer. +- + !record {model: res.users, id: res_users_hr_recruitment_officer}: + groups_id: + - base.group_hr_user +- + In Order to test process of Recruitment so giving HR officer's rights, +- + !context + uid: 'res_users_hr_recruitment_officer' - An applicant is interested in the job position. So he sends a resume by email. - diff --git a/addons/hr_timesheet/__openerp__.py b/addons/hr_timesheet/__openerp__.py index fa14c45f84a..f2e589d969e 100644 --- a/addons/hr_timesheet/__openerp__.py +++ b/addons/hr_timesheet/__openerp__.py @@ -57,6 +57,7 @@ up a management by affair. ], 'demo': ['hr_timesheet_demo.xml'], 'test': [ + 'test/hr_timesheet_users.yml', 'test/test_hr_timesheet.yml', 'test/hr_timesheet_report.yml', 'test/hr_timesheet_demo.yml', diff --git a/addons/hr_timesheet/test/hr_timesheet_demo.yml b/addons/hr_timesheet/test/hr_timesheet_demo.yml index a868be2d710..723e3a1a08c 100644 --- a/addons/hr_timesheet/test/hr_timesheet_demo.yml +++ b/addons/hr_timesheet/test/hr_timesheet_demo.yml @@ -1,3 +1,8 @@ +- + Give the access rights of Hr Officer to create employee. +- + !context + uid: 'res_hr_timesheet_officer' - !record {model: hr.analytic.timesheet, id: working_hours_coding, view: False}: user_id: base.user_demo diff --git a/addons/hr_timesheet/test/hr_timesheet_users.yml b/addons/hr_timesheet/test/hr_timesheet_users.yml new file mode 100644 index 00000000000..cb59f77df69 --- /dev/null +++ b/addons/hr_timesheet/test/hr_timesheet_users.yml @@ -0,0 +1,42 @@ +- + Create a user as 'HR timesheet Manager' +- + !record {model: res.users, id: res_hr_timesheet_manager}: + company_id: base.main_company + name: HR timesheet manager + login: hrtm + password: hrtm +- + I added groups for HR timesheet Manager. +- + !record {model: res.users, id: res_hr_timesheet_manager}: + groups_id: + - base.group_hr_manager +- + Create a user as 'HR timesheet Officer' +- + !record {model: res.users, id: res_hr_timesheet_officer}: + company_id: base.main_company + name: HR timesheet Officer + login: hrto + password: hrto +- + I added groups for HR timesheet Officer. +- + !record {model: res.users, id: res_hr_timesheet_officer}: + groups_id: + - base.group_hr_user +- + Create a user as 'Timesheet Employee' +- + !record {model: res.users, id: res_hr_timesheet_employee}: + company_id: base.main_company + name: Timesheet Employee + login: empt + password: empt +- + I added groups for Timesheet Employee. +- + !record {model: res.users, id: res_hr_timesheet_employee}: + groups_id: + - base.group_user diff --git a/addons/hr_timesheet/test/test_hr_timesheet.yml b/addons/hr_timesheet/test/test_hr_timesheet.yml index 01687dfe78a..e518ba683ea 100644 --- a/addons/hr_timesheet/test/test_hr_timesheet.yml +++ b/addons/hr_timesheet/test/test_hr_timesheet.yml @@ -1,6 +1,11 @@ - In order to test hr_timesheet Module in OpenERP, I make "Sign In/Sign Out for Project" to encode and track time spent on the different projects. +- + Give the access rights of Hr Officer to create employee. +- + !context + uid: 'res_hr_timesheet_officer' - I create employee "Gilles Gravie" as "User". - @@ -9,6 +14,11 @@ name: Gilles Gravie parent_id: 'hr.employee_al' user_id: 'base.user_demo' +- + Give the access rights of Employee to Sign In/Sign Out in Project. +- + !context + uid: 'res_hr_timesheet_employee' - On "Sign In/Sign Out by Project" wizard i click on "Sign In/Sign Out" button of this wizard. - diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py index 83f0a4f11eb..5f5ded337a7 100644 --- a/addons/mrp/__openerp__.py +++ b/addons/mrp/__openerp__.py @@ -77,6 +77,7 @@ Dashboard / Reports for MRP will include: #TODO: This yml tests are needed to be completely reviewed again because the product wood panel is removed in product demo as it does not suit for new demo context of computer and consultant company # so the ymls are too complex to change at this stage 'test': [ + 'test/mrp_users.yml', 'test/order_demo.yml', 'test/order_process.yml', 'test/cancel_order.yml', diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index b9187956c81..e4efc9a4779 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -27,7 +27,7 @@ from openerp.osv import fields, osv, orm from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP from openerp.tools import float_compare from openerp.tools.translate import _ -from openerp import tools +from openerp import tools, SUPERUSER_ID from openerp import SUPERUSER_ID #---------------------------------------------------------- @@ -817,7 +817,10 @@ class mrp_production(osv.osv): account = wc.costs_hour_account_id.id if value and account: amount += value - analytic_line_obj.create(cr, uid, { + # we user SUPERUSER_ID as we do not garantee an mrp user + # has access to account analytic lines but still should be + # able to produce orders + analytic_line_obj.create(cr, SUPERUSER_ID, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, @@ -833,7 +836,7 @@ class mrp_production(osv.osv): account = wc.costs_cycle_account_id.id if value and account: amount += value - analytic_line_obj.create(cr, uid, { + analytic_line_obj.create(cr, SUPERUSER_ID, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, diff --git a/addons/mrp/security/mrp_security.xml b/addons/mrp/security/mrp_security.xml index 35aae42b53d..9e5dc919720 100644 --- a/addons/mrp/security/mrp_security.xml +++ b/addons/mrp/security/mrp_security.xml @@ -4,6 +4,7 @@ User + diff --git a/addons/mrp/test/cancel_order.yml b/addons/mrp/test/cancel_order.yml index 9e197156b15..2f721b6c653 100644 --- a/addons/mrp/test/cancel_order.yml +++ b/addons/mrp/test/cancel_order.yml @@ -1,3 +1,8 @@ +- + MRP user can cancelled Production Order, so let's check data with giving the access rights of user. +- + !context + uid: 'res_users_mrp_user' - I first confirm order for PC Assemble SC349. - diff --git a/addons/mrp/test/mrp_users.yml b/addons/mrp/test/mrp_users.yml new file mode 100644 index 00000000000..05c4889cf28 --- /dev/null +++ b/addons/mrp/test/mrp_users.yml @@ -0,0 +1,31 @@ +- + Create a user as 'MRP Manager' +- + !record {model: res.users, id: res_users_mrp_manager}: + company_id: base.main_company + name: MRP Manager + login: mam + password: mam + email: mrp_manager@yourcompany.com +- + I added groups for MRP Manager. +- + !record {model: res.users, id: res_users_mrp_manager}: + groups_id: + - mrp.group_mrp_manager + - account.group_account_user +- + Create a user as 'MRP User' +- + !record {model: res.users, id: res_users_mrp_user}: + company_id: base.main_company + name: MRP User + login: mau + password: mau + email: mrp_user@yourcompany.com +- + I added groups for MRP User. +- + !record {model: res.users, id: res_users_mrp_user}: + groups_id: + - mrp.group_mrp_user \ No newline at end of file diff --git a/addons/mrp/test/order_demo.yml b/addons/mrp/test/order_demo.yml index ee21fee96df..0e4914390fb 100644 --- a/addons/mrp/test/order_demo.yml +++ b/addons/mrp/test/order_demo.yml @@ -1,3 +1,8 @@ +- + MRP user can create Production Order, so let's check data with giving the access rights of user. +- + !context + uid: 'res_users_mrp_user' - I create Production Order of PC Assemble SC349 to produce 5.0 Unit. - diff --git a/addons/mrp/test/order_process.yml b/addons/mrp/test/order_process.yml index 801f20f0747..c4050208570 100644 --- a/addons/mrp/test/order_process.yml +++ b/addons/mrp/test/order_process.yml @@ -1,3 +1,8 @@ +- + MRP user can doing all process related to Production Order, so let's check data with giving the access rights of user. +- + !context + uid: 'res_users_mrp_user' - I compute the production order. - @@ -23,6 +28,7 @@ I confirm the Production Order. - !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_test1} + - I check details of Produce Move of Production Order to trace Final Product. - @@ -58,6 +64,16 @@ assert move_line.product_uos.id == order_line.product_uos.id, "UOS is not correspond in 'To consume line'." assert move_line.location_id.id == routing_loc or order.location_src_id.id, "Source location is not correspond in 'To consume line'." assert move_line.location_dest_id.id == source_location_id, "Destination Location is not correspond in 'To consume line'." +- + I consume raw materials and put one material in scrap location due to waste it. +- + !python {model: mrp.production}: | + scrap_location_ids = self.pool.get('stock.location').search(cr, uid, [('scrap_location','=',True)]) + scrap_location_id = scrap_location_ids[0] + order = self.browse(cr, uid, ref("mrp_production_test1")) + for move in order.move_lines: + if move.product_id.id == ref("product.product_product_6"): + move.action_scrap(5.0, scrap_location_id) - I check details of an Internal Shipment after confirmed production order to bring components in Raw Materials Location. - @@ -155,17 +171,7 @@ order = self.browse(cr, uid, ref("mrp_production_test1")) assert order.state == 'in_production', 'Production order should be in production State.' - - I consume raw materials and put one material in scrap location due to waste it. -- - !python {model: mrp.production}: | - scrap_location_ids = self.pool.get('stock.location').search(cr, uid, [('scrap_location','=',True)]) - scrap_location_id = scrap_location_ids[0] - order = self.browse(cr, uid, ref("mrp_production_test1")) - for move in order.move_lines: - if move.product_id.id == ref("product.product_product_6"): - move.action_scrap(5.0, scrap_location_id) move.action_consume(move.product_qty) -- I produce product. - !python {model: mrp.product.produce}: | @@ -183,7 +189,10 @@ order = self.browse(cr, uid, ref("mrp_production_test1")) assert order.state == 'done', "Production order should be closed." - - I check Total Costs at End of Production. + I check Total Costs at End of Production as a manager. +- + !context + uid: 'res_users_mrp_manager' - !python {model: mrp.production}: | order = self.browse(cr, uid, ref("mrp_production_test1")) @@ -217,6 +226,9 @@ assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM is not correspond." - I print a "BOM Structure". +- + !context + uid: 'res_users_mrp_user' - !python {model: mrp.production}: | import os diff --git a/addons/mrp_operations/__openerp__.py b/addons/mrp_operations/__openerp__.py index 7fedb426edd..12d86e0b532 100644 --- a/addons/mrp_operations/__openerp__.py +++ b/addons/mrp_operations/__openerp__.py @@ -70,7 +70,7 @@ So, that we can compare the theoretic delay and real delay. 'mrp_operations_demo.yml' ], 'test': [ -# 'test/workcenter_operations.yml', + 'test/workcenter_operations.yml', ], 'installable': True, 'auto_install': False, diff --git a/addons/mrp_operations/test/workcenter_operations.yml b/addons/mrp_operations/test/workcenter_operations.yml index 4754bb463ff..588ad639659 100644 --- a/addons/mrp_operations/test/workcenter_operations.yml +++ b/addons/mrp_operations/test/workcenter_operations.yml @@ -1,6 +1,24 @@ +- + Create a user as 'MRP User' +- + !record {model: res.users, id: res_mrp_operation_user}: + company_id: base.main_company + name: MRP User + login: maou + password: maou + email: mrp_operation_user@yourcompany.com +- + I added groups for MRP User. +- + !record {model: res.users, id: res_mrp_operation_user}: + groups_id: + - mrp.group_mrp_user - In order to test mrp_operations with OpenERP, I refer created production order of PC Assemble SC349 - with routing - Manual Component's Assembly to test complete production process with respect of workcenter. + with routing - Manual Component's Assembly to test complete production process with respect of workcenter with giving access rights of MRP User. +- + !context + uid: 'res_mrp_operation_user' - I compute the production order. - @@ -92,7 +110,7 @@ I print a Barcode Report of Operation line. - !python {model: mrp_operations.operation.code}: | - import netsvc, tools, os + from openerp import netsvc, tools (data, format) = netsvc.LocalService('report.mrp.code.barcode').create(cr, uid, [ref('mrp_operations.mrp_op_1'),ref('mrp_operations.mrp_op_2'),ref('mrp_operations.mrp_op_3'),ref('mrp_operations.mrp_op_4'),ref('mrp_operations.mrp_op_5')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-barcode_report.'+format), 'wb+').write(data) @@ -101,7 +119,7 @@ I print Workcenter's Barcode Report. - !python {model: mrp.workcenter}: | - import netsvc, tools, os + from openerp import netsvc, tools (data, format) = netsvc.LocalService('report.mrp.wc.barcode').create(cr, uid, [ref('mrp.mrp_workcenter_0'),ref('mrp.mrp_workcenter_1')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-workcenter_barcode_report.'+format), 'wb+').write(data) diff --git a/addons/mrp_repair/__openerp__.py b/addons/mrp_repair/__openerp__.py index 26480e975ce..a274cbc3ef4 100644 --- a/addons/mrp_repair/__openerp__.py +++ b/addons/mrp_repair/__openerp__.py @@ -52,7 +52,8 @@ The following topics should be covered by this module: 'mrp_repair_report.xml', ], 'demo': ['mrp_repair_demo.yml'], - 'test': ['test/test_mrp_repair_noneinv.yml', + 'test': ['test/mrp_repair_users.yml', + 'test/test_mrp_repair_noneinv.yml', 'test/test_mrp_repair_b4inv.yml', 'test/test_mrp_repair_afterinv.yml', 'test/test_mrp_repair_cancel.yml', diff --git a/addons/mrp_repair/test/mrp_repair_users.yml b/addons/mrp_repair/test/mrp_repair_users.yml new file mode 100644 index 00000000000..d5762e69b27 --- /dev/null +++ b/addons/mrp_repair/test/mrp_repair_users.yml @@ -0,0 +1,30 @@ +- + Create a user as 'MRP Repair Manager' +- + !record {model: res.users, id: res_mrp_repair_manager}: + company_id: base.main_company + name: MRP Manager + login: marm + password: marm + email: mrp_repair_manager@yourcompany.com +- + I added groups for MRP Repair Manager. +- + !record {model: res.users, id: res_mrp_repair_manager}: + groups_id: + - mrp.group_mrp_manager +- + Create a user as 'MRP Repair User' +- + !record {model: res.users, id: res_mrp_repair_user}: + company_id: base.main_company + name: MRP User + login: maru + password: maru + email: mrp_repair_user@yourcompany.com +- + I added groups for MRP Repair User. +- + !record {model: res.users, id: res_mrp_repair_user}: + groups_id: + - mrp.group_mrp_user \ No newline at end of file diff --git a/addons/mrp_repair/test/test_mrp_repair_afterinv.yml b/addons/mrp_repair/test/test_mrp_repair_afterinv.yml index eed121050b8..4fb36052c77 100644 --- a/addons/mrp_repair/test/test_mrp_repair_afterinv.yml +++ b/addons/mrp_repair/test/test_mrp_repair_afterinv.yml @@ -1,5 +1,8 @@ - - In order to test Invoice Method 'After Repair'. + In order to test Invoice Method 'After Repair' with giving the access rights of mrp user. +- + !context + uid: 'res_mrp_repair_user' - I confirm Repair order taking Invoice Method 'After Repair'. - diff --git a/addons/mrp_repair/test/test_mrp_repair_b4inv.yml b/addons/mrp_repair/test/test_mrp_repair_b4inv.yml index 83badf48be9..d2ab76209bb 100644 --- a/addons/mrp_repair/test/test_mrp_repair_b4inv.yml +++ b/addons/mrp_repair/test/test_mrp_repair_b4inv.yml @@ -1,5 +1,8 @@ - - Now I test for Invoice Method 'Before Repair'. + Now I test for Invoice Method 'Before Repair' with giving the access rights of mrp user. +- + !context + uid: 'res_mrp_repair_user' - I confirm Repair order for Invoice Method 'Before Repair'. - diff --git a/addons/mrp_repair/test/test_mrp_repair_cancel.yml b/addons/mrp_repair/test/test_mrp_repair_cancel.yml index ee0e9c379e7..83a8b901fd3 100644 --- a/addons/mrp_repair/test/test_mrp_repair_cancel.yml +++ b/addons/mrp_repair/test/test_mrp_repair_cancel.yml @@ -1,6 +1,9 @@ - In order to test the cancel flow of mrp_repair module, - I start by creating new copy Repair order for "PC Assemble SC234" product. + I start by creating new copy Repair order for "PC Assemble SC234" product with giving access rights of mrp user. +- + !context + uid: 'res_mrp_repair_user' - !python {model: mrp.repair}: | copy_id = self.copy(cr, uid, ref("mrp_repair_rmrp1")) diff --git a/addons/mrp_repair/test/test_mrp_repair_noneinv.yml b/addons/mrp_repair/test/test_mrp_repair_noneinv.yml index b8006d0d485..bb3e7a096b2 100644 --- a/addons/mrp_repair/test/test_mrp_repair_noneinv.yml +++ b/addons/mrp_repair/test/test_mrp_repair_noneinv.yml @@ -1,5 +1,8 @@ - - In order to test "mrp_repair" module, I start with confirm state, and start repair. + In order to test "mrp_repair" module, I start with confirm state, and start repair with giving the access rights of mrp user. +- + !context + uid: 'res_mrp_repair_user' - I confirm Repair order for Invoice Method 'No Invoice'. - diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml index e674019443b..71db402641f 100644 --- a/addons/project/security/project_security.xml +++ b/addons/project/security/project_security.xml @@ -4,6 +4,7 @@ User + diff --git a/addons/project_issue/__openerp__.py b/addons/project_issue/__openerp__.py index 723f362ab4c..146cff0a407 100644 --- a/addons/project_issue/__openerp__.py +++ b/addons/project_issue/__openerp__.py @@ -52,6 +52,7 @@ It allows the manager to quickly check the issues, assign them and decide on the ], 'demo': ['project_issue_demo.xml'], 'test': [ + 'test/issue_users.yml', 'test/subscribe_issue.yml', 'test/issue_process.yml', 'test/issue_demo.yml' diff --git a/addons/project_issue/test/issue_demo.yml b/addons/project_issue/test/issue_demo.yml index 4e3790361e5..f84c716baeb 100644 --- a/addons/project_issue/test/issue_demo.yml +++ b/addons/project_issue/test/issue_demo.yml @@ -1,3 +1,8 @@ +- + Test the whole create project issue with project manager. +- + !context + uid: 'res_users_project_issue_manager' - !record {model: project.issue, id: project_task_1, view: False}: task_id: 'project.project_task_17' @@ -6,3 +11,4 @@ !record {model: project.issue, id: project01, view: False}: project_id: 'project.project_project_2' name: 'OpenERP Integration' + diff --git a/addons/project_issue/test/issue_process.yml b/addons/project_issue/test/issue_process.yml index 280df50ebea..61ebe2e646c 100644 --- a/addons/project_issue/test/issue_process.yml +++ b/addons/project_issue/test/issue_process.yml @@ -10,6 +10,11 @@ self.send_mail(cr, uid, [new_id], context=ctx) except Exception, e: pass +- + Only project manager can create Task for Issue, so let's check data with giving the access rights of manager. +- + !context + uid: 'res_users_project_issue_manager' - I create Task for Issue. - diff --git a/addons/project_issue/test/issue_users.yml b/addons/project_issue/test/issue_users.yml new file mode 100644 index 00000000000..c40d142684a --- /dev/null +++ b/addons/project_issue/test/issue_users.yml @@ -0,0 +1,30 @@ +- + Create a user as 'Project manager' +- + !record {model: res.users, id: res_users_project_issue_manager}: + company_id: base.main_company + name: Project Manager + login: prim + password: prim + email: issuemanager@yourcompany.com +- + I added groups for Project manager. +- + !record {model: res.users, id: res_users_project_issue_manager}: + groups_id: + - project.group_project_manager +- + Create a user as 'Project user' +- + !record {model: res.users, id: res_users_project_issue_user}: + company_id: base.main_company + name: Project User + login: priu + password: priu + email: issueuser@yourcompany.com +- + I added groups for Project user. +- + !record {model: res.users, id: res_users_project_issue_user}: + groups_id: + - project.group_project_user \ No newline at end of file diff --git a/addons/project_issue/test/subscribe_issue.yml b/addons/project_issue/test/subscribe_issue.yml index af81ff4d295..a3645feb156 100644 --- a/addons/project_issue/test/subscribe_issue.yml +++ b/addons/project_issue/test/subscribe_issue.yml @@ -1,5 +1,5 @@ - - In Order to test process of Issue in OpenERP, Custmer send the issue by email. + In Order to test process of Issue in OpenERP, Customer send the issue by email. - !python {model: mail.thread}: | request_file = open(openerp.modules.module.get_module_resource('project_issue','test', 'issue.eml'),'rb') diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index a7c66344f4a..9d72579cc77 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -67,6 +67,7 @@ Dashboard / Reports for Purchase Management will include: 'res_config_view.xml', ], 'test': [ + 'test/ui/purchase_users.yml', 'test/process/cancel_order.yml', 'test/process/rfq2order2done.yml', 'test/process/generate_invoice_from_reception.yml', diff --git a/addons/purchase/purchase_order_demo.yml b/addons/purchase/purchase_order_demo.yml index 9c83ff84406..7a0fae7ef68 100644 --- a/addons/purchase/purchase_order_demo.yml +++ b/addons/purchase/purchase_order_demo.yml @@ -1,3 +1,5 @@ +- + Give access rights of Purchase user to create purchase order - !record {model: purchase.order, id: purchase_order_1}: partner_id: base.res_partner_1 diff --git a/addons/purchase/test/process/cancel_order.yml b/addons/purchase/test/process/cancel_order.yml index 80fd7b5ff57..d3695cba6c8 100644 --- a/addons/purchase/test/process/cancel_order.yml +++ b/addons/purchase/test/process/cancel_order.yml @@ -1,3 +1,8 @@ +- + Purchase user can also cancel order therfore test with that user which have Purchase user rights. +- + !context + uid: 'res_users_purchase_user' - In order to test the cancel flow, I start it from canceling confirmed purchase order. - diff --git a/addons/purchase/test/process/generate_invoice_from_reception.yml b/addons/purchase/test/process/generate_invoice_from_reception.yml index 6390413b418..565f52f258f 100644 --- a/addons/purchase/test/process/generate_invoice_from_reception.yml +++ b/addons/purchase/test/process/generate_invoice_from_reception.yml @@ -1,3 +1,8 @@ +- + Purchase user can create an invoice for order on receptions therfore test with that user which have Purchase user rights. +- + !context + uid: 'res_users_purchase_user' - I confirm another order where invoice control is 'Bases on incoming shipments'. - diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml index 8a391b13ebb..d31b371f009 100644 --- a/addons/purchase/test/process/invoice_on_poline.yml +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -1,3 +1,8 @@ +- + Purchase User confirm the order and create invoice based on purchase order line. +- + !context + uid: 'res_users_purchase_user' - I confirm purchase order which has invoicing control method "Based on Purchase Order Lines". - @@ -17,10 +22,4 @@ !python {model: purchase.order}: | purchase_order = self.browse(cr, uid, ref("purchase_order_6")) for purchase_line in purchase_order.order_line: - assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." -- - I set the default invoicing control method "Based on Purchase Order Lines". -- - !python {model: purchase.config.settings}: | - new_id = self.create(cr, uid, {'default_invoice_method': 'manual'}) - self.execute(cr, uid, [new_id]) + assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." \ No newline at end of file diff --git a/addons/purchase/test/process/merge_order.yml b/addons/purchase/test/process/merge_order.yml index 24709aa1f43..dcf2616e79e 100644 --- a/addons/purchase/test/process/merge_order.yml +++ b/addons/purchase/test/process/merge_order.yml @@ -1,3 +1,8 @@ +- + Give access rights of Purchase user to merge two RFQ. +- + !context + uid: 'res_users_purchase_user' - In order to merge RFQ, I merge two RFQ which has same supplier and check new merged order. - diff --git a/addons/purchase/test/ui/delete_order.yml b/addons/purchase/test/ui/delete_order.yml index f8795007622..6f9ba54e89d 100644 --- a/addons/purchase/test/ui/delete_order.yml +++ b/addons/purchase/test/ui/delete_order.yml @@ -1,3 +1,8 @@ +- + Give access rights of Purchase user to delete purchase order +- + !context + uid: 'res_users_purchase_user' - In order to test to delete process on purchase order. - diff --git a/addons/purchase/test/ui/purchase_users.yml b/addons/purchase/test/ui/purchase_users.yml new file mode 100644 index 00000000000..bfff922bf83 --- /dev/null +++ b/addons/purchase/test/ui/purchase_users.yml @@ -0,0 +1,30 @@ +- + Create a user as 'Purchase manager' +- + !record {model: res.users, id: res_users_purchase_manager}: + company_id: base.main_company + name: Purchase Manager + login: pm + password: pm + email: purchasemanager@yourcompany.com +- + I added groups for Purchase manager. +- + !record {model: res.users, id: res_users_purchase_manager}: + groups_id: + - purchase.group_purchase_manager +- + Create a user as 'Purchase user' +- + !record {model: res.users, id: res_users_purchase_user}: + company_id: base.main_company + name: Purchase User + login: pu + password: pu + email: purchaseuser@yourcompany.com +- + I added groups for Purchase user. +- + !record {model: res.users, id: res_users_purchase_user}: + groups_id: + - purchase.group_purchase_user diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index 2ba0ad95e09..3f5fce3e8cc 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -43,6 +43,7 @@ keep track and order all your purchase orders. ], 'auto_install': False, 'test': [ + 'test/purchase_requisition_users.yml', 'test/purchase_requisition_demo.yml', 'test/purchase_requisition.yml', 'test/cancel_purchase_requisition.yml', diff --git a/addons/purchase_requisition/security/purchase_tender.xml b/addons/purchase_requisition/security/purchase_tender.xml index e60665e202b..f365643a8fe 100644 --- a/addons/purchase_requisition/security/purchase_tender.xml +++ b/addons/purchase_requisition/security/purchase_tender.xml @@ -10,6 +10,7 @@ User + diff --git a/addons/purchase_requisition/test/cancel_purchase_requisition.yml b/addons/purchase_requisition/test/cancel_purchase_requisition.yml index 389c328a5cf..a865cb0548a 100644 --- a/addons/purchase_requisition/test/cancel_purchase_requisition.yml +++ b/addons/purchase_requisition/test/cancel_purchase_requisition.yml @@ -1,3 +1,8 @@ +- + Give access rights of Purchase Requisition User to cancelled requisition +- + !context + uid: 'res_users_purchase_requisition_user' - I cancel requisition. - diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index 808b2eb5350..ffea3c2a8ce 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -30,6 +30,11 @@ assert line.product_id.id == procurement.product_id.id, "Product is not correspond." assert line.product_uom_id.id == procurement.product_uom.id, "UOM is not correspond." assert line.product_qty == procurement.product_qty, "Quantity is not correspond." +- + Give access rights of Purchase Requisition User to open requisition +- + !context + uid: 'res_users_purchase_requisition_user' - I open another requisition. - diff --git a/addons/purchase_requisition/test/purchase_requisition_demo.yml b/addons/purchase_requisition/test/purchase_requisition_demo.yml index 5e441f26ea3..8265e6c72da 100644 --- a/addons/purchase_requisition/test/purchase_requisition_demo.yml +++ b/addons/purchase_requisition/test/purchase_requisition_demo.yml @@ -1,3 +1,8 @@ +- + Give access rights of Purchase Requisition User to create requisition +- + !context + uid: 'res_users_purchase_requisition_user' - In order to test process of the purchase requisition ,I create requisition - diff --git a/addons/purchase_requisition/test/purchase_requisition_users.yml b/addons/purchase_requisition/test/purchase_requisition_users.yml new file mode 100644 index 00000000000..5b5e6d5e8cb --- /dev/null +++ b/addons/purchase_requisition/test/purchase_requisition_users.yml @@ -0,0 +1,30 @@ +- + Create a user as 'Purchase Requisition Manager' +- + !record {model: res.users, id: res_users_purchase_requisition_manager}: + company_id: base.main_company + name: Purchase requisition Manager + login: prm + password: prm + email: requisition_manager@yourcompany.com +- + I added groups for Purchase Requisition Manager. +- + !record {model: res.users, id: res_users_purchase_requisition_manager}: + groups_id: + - purchase_requisition.group_purchase_requisition_manager +- + Create a user as 'Purchase Requisition User' +- + !record {model: res.users, id: res_users_purchase_requisition_user}: + company_id: base.main_company + name: Purchase requisition User + login: pru + password: pru + email: requisition_user@yourcompany.com +- + I added groups for Purchase Requisition User. +- + !record {model: res.users, id: res_users_purchase_requisition_user}: + groups_id: + - purchase_requisition.group_purchase_requisition_user \ No newline at end of file diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index b8a9f57c910..806e02e8c2b 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -38,6 +38,7 @@ associated to every resource. It also manages the leaves of every resource. 'depends': ['process'], 'data': [ 'security/ir.model.access.csv', + 'security/resource_security.xml', 'resource_view.xml', ], 'demo': ['resource_demo.xml'], diff --git a/addons/resource/security/ir.model.access.csv b/addons/resource/security/ir.model.access.csv index 533ad419274..bf8504e2f46 100644 --- a/addons/resource/security/ir.model.access.csv +++ b/addons/resource/security/ir.model.access.csv @@ -3,4 +3,5 @@ access_resource_calendar,resource.calendar,model_resource_calendar,base.group_sy access_resource_calendar_attendance,resource.calendar.attendance,model_resource_calendar_attendance,base.group_system,1,1,1,1 access_resource_resource,resource.resource,model_resource_resource,base.group_system,1,0,0,0 access_resource_resource_all,resource.resource all,model_resource_resource,,1,0,0,0 +access_resource_calendar_leaves_user,resource.calendar.leaves,model_resource_calendar_leaves,base.group_user,1,0,0,0 access_resource_calendar_leaves,resource.calendar.leaves,model_resource_calendar_leaves,base.group_system,1,1,1,1 diff --git a/addons/resource/security/resource_security.xml b/addons/resource/security/resource_security.xml new file mode 100644 index 00000000000..43bfa6c3a4b --- /dev/null +++ b/addons/resource/security/resource_security.xml @@ -0,0 +1,16 @@ + + + + + + Resource: see own leaves + + + ['|', + ('resource_id', '=', False), + ('resource_id.user_id', '=', user.id), + ] + + + + diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py index 8cc4919e3a1..2bea86b41af 100644 --- a/addons/sale/__openerp__.py +++ b/addons/sale/__openerp__.py @@ -80,6 +80,7 @@ The Dashboard for the Sales Manager will include ], 'demo': ['sale_demo.xml'], 'test': [ + 'test/create_sale_users.yml', 'test/sale_order_demo.yml', 'test/manual_order_policy.yml', 'test/cancel_order.yml', diff --git a/addons/sale/test/cancel_order.yml b/addons/sale/test/cancel_order.yml index 12b28fcb7e8..a2c62e16031 100644 --- a/addons/sale/test/cancel_order.yml +++ b/addons/sale/test/cancel_order.yml @@ -1,3 +1,8 @@ +- + Salesman can also cancel order therefore test with that user which have salesman rights, +- + !context + uid: 'res_users_salesman' - In order to test the cancel sale order. I confirm order (with at least 2 lines) diff --git a/addons/sale/test/create_sale_users.yml b/addons/sale/test/create_sale_users.yml new file mode 100644 index 00000000000..e86fbc8ebfe --- /dev/null +++ b/addons/sale/test/create_sale_users.yml @@ -0,0 +1,30 @@ +- + Create a user as 'Salesmanager' +- + !record {model: res.users, id: res_users_salesmanager}: + company_id: base.main_company + name: Sales manager + login: sm + password: sm + email: salesmanager@yourcompany.com +- + I added groups for Salesmanager. +- + !record {model: res.users, id: res_users_salesmanager}: + groups_id: + - base.group_sale_manager +- + Create a user as 'Salesman' +- + !record {model: res.users, id: res_users_salesman}: + company_id: base.main_company + name: Salesman + login: su + password: su + email: salesman@yourcompany.com +- + I added groups for Salesman. +- + !record {model: res.users, id: res_users_salesman}: + groups_id: + - base.group_sale_salesman_all_leads diff --git a/addons/sale/test/delete_order.yml b/addons/sale/test/delete_order.yml index abc68cb3af3..9d8db337d5b 100644 --- a/addons/sale/test/delete_order.yml +++ b/addons/sale/test/delete_order.yml @@ -1,3 +1,8 @@ +- + Sales manager can only delete order therefore test with that user which have sales manager rights, +- + !context + uid: 'res_users_salesmanager' - I try to delete In progress order and check Error Message. - diff --git a/addons/sale/test/sale_order_demo.yml b/addons/sale/test/sale_order_demo.yml index 75e17ebeb02..84aaa43a3cf 100644 --- a/addons/sale/test/sale_order_demo.yml +++ b/addons/sale/test/sale_order_demo.yml @@ -1,3 +1,8 @@ +- + Test the data with salesman, +- + !context + uid: 'res_users_salesman' - In order to test process of the Sale Order, I create sale order - diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py index f68db56ea2f..bc797e8c369 100644 --- a/addons/sale_stock/__openerp__.py +++ b/addons/sale_stock/__openerp__.py @@ -58,7 +58,8 @@ You can choose flexible invoicing methods: 'process/sale_stock_process.xml', ], 'demo': ['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 d970e0c9cad..29581b944bf 100644 --- a/addons/sale_stock/test/cancel_order_sale_stock.yml +++ b/addons/sale_stock/test/cancel_order_sale_stock.yml @@ -1,12 +1,16 @@ - - 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} - I send delivery in two shipments, so I am doing a partial delivery order. - !python {model: stock.picking}: | + context={} delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))]) first_picking = self.browse(cr, uid, delivery_orders[-1], context=context) if first_picking.force_assign(cr, uid, first_picking): @@ -20,12 +24,22 @@ delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))]) last_delivery_order_id = delivery_orders[-1] self.pool.get('stock.picking').signal_button_cancel(cr, uid, [last_delivery_order_id]) +- + Only Stock User can change data related warehouse therefore 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 therefore test with that user which have salesman rights, +- + !context + uid: 'res_sale_stock_salesman' - I check order status in "Ship Exception". - @@ -65,4 +79,4 @@ I check state of order in 'In Progress'. - !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be In progress state}: - - state == 'progress' \ No newline at end of file + - state == 'progress' diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml index 4a6f3d38f97..609cd405bad 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. - @@ -40,11 +43,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 therefore test with that user which have stock 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 therefore test with that user which have salesman rights, +- + !context + uid: 'res_sale_stock_salesman' - I check the details of delivery order after confirmed quotation. - @@ -136,6 +149,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 therefore test with that user which have stock manager rights, +- + !context + uid: 'res_stock_manager' - I open the Invoice. - @@ -157,6 +175,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..f21f88c9eb7 100644 --- a/addons/sale_stock/test/sale_order_onchange.yml +++ b/addons/sale_stock/test/sale_order_onchange.yml @@ -1,3 +1,8 @@ +- + Only sales manager Creates product so let's check 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 - @@ -5,6 +10,11 @@ name: 'Devil Worship Book' list_price: 66.6 procure_method: 'make_to_order' +- + In sale order to test process of onchange of Sale Order with access rights of saleman. +- + !context + uid: 'res_sale_stock_salesman' - Now i create a sale order that uses my new 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..594cbe42240 --- /dev/null +++ b/addons/sale_stock/test/sale_stock_users.yml @@ -0,0 +1,61 @@ +- + Create a user as 'Stock Salesmanager' +- + !record {model: res.users, id: res_sale_stock_salesmanager}: + company_id: base.main_company + name: Stock Sales manager + login: ssm + password: ssm + email: ss_salesmanager@yourcompany.com +- + I added groups for Salesmanager. +- + !record {model: res.users, id: res_sale_stock_salesmanager}: + groups_id: + - base.group_sale_manager +- + Create a user as 'Stock Salesman' +- + !record {model: res.users, id: res_sale_stock_salesman}: + company_id: base.main_company + name: Stock Salesman + login: ssu + password: ssu + email: ss_salesman@yourcompany.com +- + I added groups for Stock Salesman. +- + !record {model: res.users, id: res_sale_stock_salesman}: + 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 + email: stock_user@yourcompany.com +- + I added groups for Stock User. +- + !record {model: res.users, id: res_stock_user}: + 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 + email: stock_manager@yourcompany.com +- + I added groups for Stock Manager. +- + !record {model: res.users, id: res_stock_manager}: + groups_id: + - stock.group_stock_manager diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index b3d7e30f1ce..dd2a996f6dd 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -59,7 +59,6 @@ Dashboard / Reports for Warehouse Management will include: 'sequence': 16, 'demo': [ 'stock_demo.xml', -# 'stock_demo.yml', ], 'data': [ 'security/stock_security.xml', @@ -91,9 +90,11 @@ Dashboard / Reports for Warehouse Management will include: 'res_config_view.xml', ], 'test': [ -# 'test/opening_stock.yml', -# 'test/shipment.yml', -# 'test/stock_report.yml', + 'test/stock_users.yml', + 'stock_demo.yml', + 'test/opening_stock.yml', + 'test/shipment.yml', + 'test/stock_report.yml', ], 'installable': True, 'application': True, diff --git a/addons/stock/security/stock_security.xml b/addons/stock/security/stock_security.xml index 10ae6a16d59..e51f20c67c9 100644 --- a/addons/stock/security/stock_security.xml +++ b/addons/stock/security/stock_security.xml @@ -10,7 +10,7 @@ Manager - + diff --git a/addons/stock/stock_demo.yml b/addons/stock/stock_demo.yml index 99565f0c08c..d925ba4dc8e 100644 --- a/addons/stock/stock_demo.yml +++ b/addons/stock/stock_demo.yml @@ -1,99 +1,107 @@ - - !record {model: stock.location, id: location_refrigerator}: - name: Refrigerator + Only stock manager can create location,warehouse and product, so let's check data with giving the access rights of manager +- + !context + uid: 'res_users_stock_manager' +- + !record {model: stock.location, id: location_monitor}: + name: chicago shop usage: internal - - !record {model: stock.location, id: location_delivery_counter}: - name: Delivery Counter + !record {model: stock.location, id: stock_location_output}: + name: Output usage: internal - - !record {model: stock.location, id: location_refrigerator_small}: - name: Small Refrigerator + !record {model: stock.location, id: location_monitor_small}: + name: Small chicago shop usage: internal - location_id: location_refrigerator + location_id: location_monitor - !record {model: stock.location, id: location_opening}: name: opening usage: inventory - - !record {model: stock.location, id: location_convenience_shop}: - name: Convenient Store + !record {model: stock.location, id: stock_location_3}: + name: IT Suppliers usage: supplier - - !record {model: stock.warehouse, id: warehouse_icecream}: - name: Ice Cream Shop - lot_input_id: location_refrigerator - lot_stock_id: location_refrigerator - lot_output_id: location_delivery_counter + !record {model: stock.warehouse, id: stock_warehouse_shop0}: + name: Chicago Warehouse + lot_input_id: location_monitor + lot_stock_id: location_monitor + lot_output_id: stock_location_output - - !record {model: product.product, id: product_icecream}: - default_code: 001 - name: Ice Cream - type: product - categ_id: product.product_category_1 - list_price: 100.0 - standard_price: 70.0 - uom_id: product.product_uom_kgm - uom_po_id: product.product_uom_kgm - procure_method: make_to_stock + !record {model: product.product, id: product_product_6}: + default_code: LCD15 + name: 15” LCD Monitor + type: consu + categ_id: product.product_category_8 + list_price: 1200.0 + standard_price: 800.0 + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit property_stock_inventory: location_opening valuation: real_time cost_method: average - property_stock_account_input: account.o_expense - property_stock_account_output: account.o_income - description: Ice cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events. - + property_stock_account_input: account.conf_o_income + property_stock_account_output: account.a_expense - - !record {model: stock.production.lot, id: lot_icecream_0}: - name: Lot0 for Ice cream - product_id: product_icecream + Stock user can handled production lot,inventory and picking, so let's check data with giving the access rights of user - - !record {model: stock.production.lot, id: lot_icecream_1}: - name: Lot1 for Ice cream - product_id: product_icecream + !context + uid: 'res_users_stock_user' - - !record {model: stock.inventory, id: stock_inventory_icecream}: - name: Inventory for icecream + !record {model: stock.production.lot, id: lot_monitor_0}: + name: Lot0 for LCD Monitor + product_id: product_product_6 - - !record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot0}: - product_id: product_icecream - product_uom: product.product_uom_kgm - inventory_id: stock_inventory_icecream + !record {model: stock.production.lot, id: lot_monitor_1}: + name: Lot1 for LCD Monitor + product_id: product_product_6 +- + !record {model: stock.inventory, id: stock_inventory_0}: + name: Starting Inventory + state: draft +- + !record {model: stock.inventory.line, id: stock_inventory_line_3}: + product_id: product_product_6 + product_uom: product.product_uom_unit + inventory_id: stock_inventory_0 product_qty: 50.0 - prod_lot_id: lot_icecream_0 - location_id: location_refrigerator + prod_lot_id: lot_monitor_0 + location_id: location_monitor - - !record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot1}: - product_id: product_icecream - product_uom: product.product_uom_kgm - inventory_id: stock_inventory_icecream + !record {model: stock.inventory.line, id: stock_inventory_line_monitor}: + product_id: product_product_6 + product_uom: product.product_uom_unit + inventory_id: stock_inventory_0 product_qty: 40.0 - prod_lot_id: lot_icecream_1 - location_id: location_refrigerator + prod_lot_id: lot_monitor_1 + location_id: location_monitor - !record {model: stock.picking, id: outgoing_shipment}: type: out - location_dest_id: location_delivery_counter + location_dest_id: stock_location_output - - !record {model: stock.move, id: outgoing_shipment_icecream}: + !record {model: stock.move, id: outgoing_shipment_monitor}: picking_id: outgoing_shipment - product_id: product_icecream - product_uom: product.product_uom_kgm + product_id: product_product_6 + product_uom: product.product_uom_unit product_qty: 130.0 - location_id: location_refrigerator - location_dest_id: location_delivery_counter + location_id: location_monitor + location_dest_id: stock_location_output - !record {model: stock.picking, id: incomming_shipment}: type: in invoice_state: 2binvoiced partner_id: base.res_partner_address_9 - location_dest_id: location_refrigerator + location_dest_id: location_monitor - - !record {model: stock.move, id: incomming_shipment_icecream}: + !record {model: stock.move, id: incomming_shipment_monitor}: picking_id: incomming_shipment - product_id: product_icecream - product_uom: product.product_uom_kgm + product_id: product_product_6 + product_uom: product.product_uom_unit product_qty: 50.0 - location_id: location_convenience_shop - location_dest_id: location_refrigerator + location_id: stock_location_3 + location_dest_id: location_monitor diff --git a/addons/stock/test/opening_stock.yml b/addons/stock/test/opening_stock.yml index 2e3eaeadc74..9efcfd3af99 100644 --- a/addons/stock/test/opening_stock.yml +++ b/addons/stock/test/opening_stock.yml @@ -1,67 +1,87 @@ - - I update the price of the Ice-cream. + Only stock manager can change the price and update stock of products, so let's check data with giving the access rights of manager +- + !context + uid: 'res_users_stock_manager' +- + I update the price of the 15” LCD Monitor. - !python {model: stock.change.standard.price}: | - context.update({'active_model':'product.product', 'active_id': ref('product_icecream'), 'active_ids':[ref('product_icecream')]}) + context.update({'active_model':'product.product', 'active_id': ref('product_product_6'), 'active_ids':[ref('product_product_6')]}) - !record {model: stock.change.standard.price, id: change_price}: - new_price: 120 + new_price: 1500 - !python {model: stock.change.standard.price}: | self.change_price(cr, uid, [ref('change_price')], context=context) - - I check price of Ice-cream after update price. + I check price of 15” LCD Monitor after update price. - !python {model: product.product}: | - product = self.browse(cr, uid, ref('product_icecream'), context=context) - assert product.standard_price == 120, "Price is not updated." + product = self.browse(cr, uid, ref('product_product_6'), context=context) + assert product.standard_price == 1500, "Price is not updated." - - I update the current stock of the Ice-cream with 10 kgm in Small Refrigerator in lot0. + I update the current stock of the 15” LCD Monitor with 10 unit in stock location shop1 in lot0. - !record {model: stock.change.product.qty, id: change_qty}: - location_id: location_refrigerator_small + location_id: location_monitor_small new_quantity: 10 - product_id: product_icecream - prodlot_id: lot_icecream_1 + product_id: product_product_6 + prodlot_id: lot_monitor_1 - !python {model: stock.change.product.qty}: | self.change_product_qty(cr, uid, [ref('change_qty')], context=context) - - I check available stock of Ice-cream after update stock. + I check available stock of 15” LCD Monitor after update stock. - !python {model: product.product}: | - product = self.browse(cr, uid, ref('product_icecream'), context=context) + product = self.browse(cr, uid, ref('product_product_6'), context=context) assert product.qty_available == 10, "Stock is not updated." +- + Stock user can merge inventory, so let's check data with giving the access rights of user. +- + !context + uid: 'res_users_stock_user' - I merge inventory. - !python {model: stock.inventory.merge }: | - context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_icecream'), 'active_ids': [ref('stock_inventory_icecream')]}) + context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_0'), 'active_ids': [ref('stock_inventory_0')]}) - !record {model: stock.inventory.merge, id: merge_inventory}: - !python {model: stock.inventory.merge }: | self.do_merge(cr, uid, [ref('merge_inventory')], context=context) +- + Only stock manager cancelled inventory, so let's check data with giving the access rights of manager +- + !context + uid: 'res_users_stock_manager' - I cancel inventory. - !python {model: stock.inventory}: | - self.action_cancel_inventory(cr, uid, [ref('stock_inventory_icecream')]) + self.action_cancel_inventory(cr, uid, [ref('stock_inventory_0')]) +- + stock user can reset inventory, so let's check data with giving the access rights of user +- + !context + uid: 'res_users_stock_user' - I reset to draft inventory. - !python {model: stock.inventory}: | - self.action_cancel_draft(cr, uid, [ref('stock_inventory_icecream')]) + self.action_cancel_draft(cr, uid, [ref('stock_inventory_0')]) - - I confirm physical inventory of Ice-cream which are came in different lots. + I confirm physical inventory of 15” LCD Monitor which are came in different lots. - !python {model: stock.inventory}: | - self.action_confirm(cr, uid, [ref('stock_inventory_icecream')], context=context) + self.action_confirm(cr, uid, [ref('stock_inventory_0')], context=context) - I check move details after confirmed physical inventory. - !python {model: stock.inventory}: | - inventory = self.browse(cr, uid, ref('stock_inventory_icecream'), context=context) + inventory = self.browse(cr, uid, ref('stock_inventory_0'), context=context) assert len(inventory.move_ids) == len(inventory.inventory_line_id), "moves are not correspond." for move_line in inventory.move_ids: for line in inventory.inventory_line_id: @@ -77,15 +97,15 @@ I split inventory line. - !python {model: stock.inventory.line.split}: | - context.update({'active_model': 'stock.inventory.line', 'active_id': ref('stock_inventory_line_icecream_lot0'), 'active_ids': [ref('stock_inventory_line_icecream_lot0')]}) + context.update({'active_model': 'stock.inventory.line', 'active_id': ref('stock_inventory_line_3'), 'active_ids': [ref('stock_inventory_line_3')]}) - !record {model: stock.inventory.line.split, id: split_inventory_lot0}: use_exist: True line_exist_ids: - quantity: 6 - prodlot_id: lot_icecream_0 + prodlot_id: lot_monitor_0 - quantity: 4 - prodlot_id: lot_icecream_0 + prodlot_id: lot_monitor_0 - !python {model: stock.inventory.line.split }: | self.split_lot(cr, uid, [ref('split_inventory_lot0')], context=context) @@ -93,39 +113,49 @@ I fill inventory line. - !python {model: stock.fill.inventory}: | - context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_icecream'), 'active_ids': [ref('stock_inventory_icecream')]}) + context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_0'), 'active_ids': [ref('stock_inventory_0')]}) - !record {model: stock.fill.inventory, id: fill_inventory}: - location_id: location_refrigerator + location_id: location_monitor recursive: True - !python {model: stock.fill.inventory }: | self.fill_inventory(cr, uid, [ref('fill_inventory')], context=context) - - Now I check vitual stock of Ice-cream after confirmed physical inventory. + Now I check vitual stock of 15” LCD Monitor after confirmed physical inventory. - !python {model: product.product}: | - product = self.browse(cr, uid, ref('product_icecream'), context=context) + product = self.browse(cr, uid, ref('product_product_6'), context=context) assert product.virtual_available == 100, "Vitual stock is not updated." - - I close physical inventory of Ice-cream. + Only stock manager can close physical inventory, so let's check data with giving the access rights of manager +- + !context + uid: 'res_users_stock_manager' +- + I close physical inventory of 15” LCD Monitor. - !python {model: stock.inventory}: | - self.action_done(cr, uid, [ref('stock_inventory_icecream')], context=context) + self.action_done(cr, uid, [ref('stock_inventory_0')], context=context) - - I check closed move and real stock of Ice-cream after closed physical inventory. + Stock user can check closed move and real stock, so let's check data with giving the access rights of user +- + !context + uid: 'res_users_stock_user' +- + I check closed move and real stock of 15” LCD Monitor after closed physical inventory. - !python {model: stock.inventory}: | - inventory = self.browse(cr, uid, ref('stock_inventory_icecream'), context=context) + inventory = self.browse(cr, uid, ref('stock_inventory_0'), context=context) assert inventory.state == 'done', "inventory is not closed." for move_line in inventory.move_ids: assert move_line.state == 'done', "Move is not closed." - product = self.pool.get('product.product').browse(cr, uid, ref('product_icecream'), context=context) + product = self.pool.get('product.product').browse(cr, uid, ref('product_product_6'), context=context) product.qty_available == 100, "Real stock is not updated." - I check stock in lot. - !python {model: stock.production.lot}: | - lot = self.browse(cr, uid, ref('lot_icecream_0'), context=context) + lot = self.browse(cr, uid, ref('lot_monitor_0'), context=context) assert lot.stock_available == 50, "Stock in lot is not correspond." diff --git a/addons/stock/test/shipment.yml b/addons/stock/test/shipment.yml index b30feccdacf..5f2f4686621 100644 --- a/addons/stock/test/shipment.yml +++ b/addons/stock/test/shipment.yml @@ -1,9 +1,14 @@ - - I confirm outgoing shipment of 130 kgm Ice-cream. + Stock manager can only test whole process related to Shipment, so let's check data with stock manager. +- + !context + uid: 'res_users_stock_manager' +- + I confirm outgoing shipment of 130 Unit 15” LCD Monitor. - !workflow {model: stock.picking, action: button_confirm, ref: outgoing_shipment} - - I check shipment details after confirmed. + I check shipment details after confirmation. - !python {model: stock.picking}: | shipment = self.browse(cr, uid, ref("outgoing_shipment")) @@ -12,121 +17,25 @@ assert move_line.state == "confirmed", "Move should be confirmed." - - Now I check vitual stock of Ice-cream after confirmed outgoing shipment. + Now, I check virtual stock of 15” LCD Monitor after confirming outgoing shipment. - !python {model: product.product}: | - product = self.browse(cr, uid, ref('product_icecream'), context=context) - product.virtual_available == -30, "Vitual stock is not updated." + product = self.browse(cr, uid, ref('product_product_6'), context=context) + assert product.virtual_available == -30, "Virtual stock is not updated." - - I confirm incomming shipment of 50 kgm Ice-cream. + I confirm incoming shipment of 50 Unit 15” LCD Monitor. - !workflow {model: stock.picking, action: button_confirm, ref: incomming_shipment} - - I receive 40kgm Ice-cream so I make backorder of incomming shipment for 40 kgm. -- - !python {model: stock.partial.picking}: | - context.update({'active_model': 'stock.picking', 'active_id': ref('incomming_shipment'), 'active_ids': [ref('incomming_shipment')]}) -- - !record {model: stock.partial.picking, id: partial_incomming}: - move_ids: - - quantity: 40 - product_id: product_icecream - product_uom: product.product_uom_kgm - move_id: incomming_shipment_icecream - location_id: location_convenience_shop - location_dest_id: location_refrigerator -- - !python {model: stock.partial.picking }: | - self.do_partial(cr, uid, [ref('partial_incomming')], context=context) -- - I check backorder shipment after received partial shipment. + I split incoming shipment into lots. each lot contain 10 Unit 15” LCD Monitor. - !python {model: stock.picking}: | shipment = self.browse(cr, uid, ref("incomming_shipment")) - backorder = shipment.backorder_id - assert backorder, "Backorder should be created after partial shipment." - assert backorder.state == 'done', "Backorder should be close after received." - for move_line in backorder.move_lines: - assert move_line.product_qty == 40, "Qty in backorder does not correspond." - assert move_line.state == 'done', "Move line of backorder should be closed." -- - I receive another 10kgm Ice-cream. -- - !record {model: stock.partial.picking, id: partial_incomming}: - move_ids: - - quantity: 10 - product_id: product_icecream - product_uom: product.product_uom_kgm - move_id: incomming_shipment_icecream - location_id: location_convenience_shop - location_dest_id: location_refrigerator -- - !python {model: stock.partial.picking }: | - self.do_partial(cr, uid, [ref('partial_incomming')], context=context) - -- - I check incomming shipment after received. -- - !python {model: stock.picking}: | - shipment = self.browse(cr, uid, ref("incomming_shipment")) - assert shipment.state == 'done', "shipment should be close after received." - for move_line in shipment.move_lines: - assert move_line.product_qty == 10, "Qty does not correspond." - assert move_line.product_id.virtual_available == 20, "Virtual stock does not correspond." - assert move_line.state == 'done', "Move line should be closed." - -- - I return last incomming shipment for 10 kgm Ice-cream. -- - !record {model: stock.return.picking, id: return_incomming}: - invoice_state: none -- - !python {model: stock.return.picking }: | - # this work without giving the id of the picking to return, magically, thanks to the context - self.create_returns(cr, uid, [ref('return_incomming')], context=context) -- - I cancel incomming shipment after return it. -- - !python {model: stock.picking}: | - # the cancel is not on the return, but on the incomming shipment (which now has a quantity of 10, thanks to the - # backorder). This situation is a little weird as we returned a move that we finally cancelled... As result, only - # 30Kg from the original 50Kg will be counted in the stock (50 - 10 (cancelled quantity) - 10 (returned quantity)) - self.action_cancel(cr, uid, [ref("incomming_shipment")], context=context) -- - I make invoice of backorder of incomming shipment. -- - !python {model: stock.invoice.onshipping}: | - shipment = self.pool.get('stock.picking').browse(cr, uid, ref("incomming_shipment")) - context.update({'active_model': 'stock.picking', 'active_id': shipment.backorder_id.id, 'active_ids': [shipment.backorder_id.id]}) -- - !record {model: stock.invoice.onshipping, id: invoice_incomming}: - group: False -- - !python {model: stock.invoice.onshipping }: | - self.create_invoice(cr, uid, [ref('invoice_incomming')], context=context) -- - I check invoice state of backorder of incomming shipment. -- - !python {model: stock.picking}: | - shipment = self.browse(cr, uid, ref("incomming_shipment")) - assert shipment.backorder_id.invoice_state == 'invoiced', 'Invoice state is not upadted.' -- - I check available stock after received incomming shipping. -- - !python {model: product.product}: | - product = self.browse(cr, uid, ref('product_icecream'), context=context) - assert product.qty_available == 140, "Stock does not correspond." - assert product.virtual_available == 0, "Vitual stock does not correspond." -- - I split incomming shipment into lots. each lot contain 10 kgm Ice-cream. -- - !python {model: stock.picking}: | - shipment = self.browse(cr, uid, ref("incomming_shipment")) - move_ids = [x.id for x in shipment.backorder_id.move_lines] + move_ids = [x.id for x in shipment.move_lines] context.update({'active_model': 'stock.move', 'active_id': move_ids[0], 'active_ids': move_ids}) - - !record {model: stock.move.split, id: split_lot_incomming}: + !record {model: stock.move.split, id: split_lot_incoming}: line_ids: - name: incoming_lot0 quantity: 10 @@ -136,23 +45,123 @@ quantity: 10 - name: incoming_lot3 quantity: 10 - - !python {model: stock.move.split }: | - self.split_lot(cr, uid, [ref('split_lot_incomming')], context=context) + self.split_lot(cr, uid, [ref('split_lot_incoming')], context=context) - - I check move lines after spliting + I check move lines after splitting. - !python {model: stock.move}: | - lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incomming'), context=context) + mm = self.browse(cr, uid, ref("incomming_shipment_monitor")) + lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incoming'), context=context) lot_ids = self.pool.get('stock.production.lot').search(cr, uid, [('name','in',[x.name for x in lot.line_ids])]) - assert len(lot_ids) == 4, 'lots of incomming shipment are not correspond.' - move_ids = self.search(cr, uid, [('location_dest_id','=',ref('location_refrigerator')),('prodlot_id','in',lot_ids)]) - assert len(move_ids) == 4, 'move lines are not correspond per prodcution lot after splited.' + assert len(lot_ids) == 4, 'lots of incoming shipment are not correspond.' + move_ids = self.search(cr, uid, [('location_dest_id','=',ref('location_monitor')),('prodlot_id','in',lot_ids)]) + assert len(move_ids) == 4, 'move lines are not correspond per production lot after splitting.' for move in self.browse(cr, uid, move_ids, context=context): assert move.prodlot_id.name in ['incoming_lot0', 'incoming_lot1', 'incoming_lot2', 'incoming_lot3'], "lot does not correspond." assert move.product_qty == 10, "qty does not correspond per production lot." - context.update({'active_model':'stock.move', 'active_id':move_ids[0],'active_ids': move_ids}) +- + I receive 40 units of 15” LCD Monitor. +- + !python {model: stock.partial.picking}: | + context.update({'active_model': 'stock.picking', 'active_id': ref('incomming_shipment'), 'active_ids': [ref('incomming_shipment')]}) +- + !python {model: stock.partial.picking}: | + partial = [] + for move in self.pool.get('stock.picking').browse(cr, uid, ref("incomming_shipment")).move_lines: + if move.prodlot_id: + partial.append((0, 0, { + 'quantity': move.product_qty, + 'product_id': move.product_id.id, + 'product_uom': move.product_uom.id, + 'move_id': move.id, + 'location_id': move.location_id.id, + 'location_dest_id': move.location_dest_id.id, + 'prodlot_id': move.prodlot_id.id, + 'cost': move.product_id.standard_price + })) + partial_id = self.create(cr, uid, {'move_ids': partial}, context=context) + self.do_partial(cr, uid, [partial_id], context=context) +- + I check backorder shipment after receiving partial shipment. +- + !python {model: stock.picking}: | + shipment = self.browse(cr, uid, ref("incomming_shipment")) + backorder = shipment.backorder_id + assert backorder, "Backorder should be created after partial shipment." + assert backorder.state == 'done', "Backorder should be closed after received." + qty = 0 + for move_line in backorder.move_lines: + assert move_line.state == 'done', "Move line of backorder should be closed." + qty += move_line.product_qty + assert qty == 40, "Qty in backorder does not correspond." +- + I receive another 10 units of 15” LCD Monitor. +- + !record {model: stock.partial.picking, id: partial_incoming}: + move_ids: + - quantity: 10 + product_id: product_product_6 + product_uom: product.product_uom_unit + move_id: incomming_shipment_monitor + location_id: stock_location_3 + location_dest_id: location_monitor +- + !python {model: stock.partial.picking }: | + self.do_partial(cr, uid, [ref('partial_incoming')], context=context) +- + I check incoming shipment after receiving it. +- + !python {model: stock.picking}: | + shipment = self.browse(cr, uid, ref("incomming_shipment")) + assert shipment.state == 'done', "shipment should be closed after receiving." + for move_line in shipment.move_lines: + assert move_line.product_qty == 10, "Qty does not correspond." + assert move_line.product_id.virtual_available == 20, "Virtual stock does not correspond." + assert move_line.state == 'done', "Move line should be closed." +- + I return last incoming shipment for 10 Unit 15” LCD Monitor. +- + !record {model: stock.return.picking, id: return_incoming}: + invoice_state: none +- + !python {model: stock.return.picking }: | + # this work without giving the id of the picking to return, magically, thanks to the context + self.create_returns(cr, uid, [ref('return_incoming')], context=context) +- + I cancel incoming shipment after returning it. +- + !python {model: stock.picking}: | + # the cancel is not on the return, but on the incoming shipment (which now has a quantity of 10, thanks to the + # backorder). This situation is a little weird as we returned a move that we finally cancelled... As result, only + # 30Unit from the original 50Unit will be counted in the stock (50 - 10 (cancelled quantity) - 10 (returned quantity)) + self.action_cancel(cr, uid, [ref("incomming_shipment")], context=context) +- + I make invoice of backorder of incoming shipment. +- + !python {model: stock.invoice.onshipping}: | + shipment = self.pool.get('stock.picking').browse(cr, uid, ref("incomming_shipment")) + context.update({'active_model': 'stock.picking', 'active_id': shipment.backorder_id.id, 'active_ids': [shipment.backorder_id.id]}) +- + !record {model: stock.invoice.onshipping, id: invoice_incoming}: + group: False +- + !python {model: stock.invoice.onshipping }: | + self.create_invoice(cr, uid, [ref('invoice_incoming')], context=context) +- + I check invoice status of backorder of incoming shipment. +- + !python {model: stock.picking}: | + shipment = self.browse(cr, uid, ref("incomming_shipment")) + assert shipment.backorder_id.invoice_state == 'invoiced', 'Invoice state is not updated.' +- + I check available stock after receiving incoming shipping. +- + !python {model: product.product}: | + product = self.browse(cr, uid, ref('product_product_6'), context=context) + assert product.qty_available == 140, "Stock does not correspond." + assert product.virtual_available == 0, "Virtual stock does not correspond." - I check the stock valuation account entries. - @@ -161,91 +170,90 @@ account_move_ids = self.search(cr, uid, [('ref','=',incomming_shipment.name)]) assert len(account_move_ids), "account move should be created." account_move = self.browse(cr, uid, account_move_ids[0], context=context) - assert len(account_move.line_id) == len(incomming_shipment.move_lines) + 1, 'accuont entries are not correspond.' + assert len(account_move.line_id) == len(incomming_shipment.move_lines) + 1, 'Accounting entries does not correspond.' for account_move_line in account_move.line_id: for stock_move in incomming_shipment.move_lines: if account_move_line.account_id.id == stock_move.product_id.property_stock_account_input.id: - assert account_move_line.credit == 800.0, "Credit amount does not correspond." + assert account_move_line.credit == 14000.0, "Credit amount does not correspond." assert account_move_line.debit == 0.0, "Debit amount does not correspond." else: assert account_move_line.credit == 0.0, "Credit amount does not correspond." - assert account_move_line.debit == 800.0, "Debit amount does not correspond." -- - I consume 1 kgm ice-cream from each incoming lots into internal production. -- - !record {model: stock.move.consume, id: consume_lot_incomming}: - product_qty: 1 - location_id: location_refrigerator -- - !python {model: stock.move.consume}: | - self.do_move_consume(cr, uid, [ref('consume_lot_incomming')], context=context) -- - I scrap 10 gm ice-cream from each incoming lots into scrap location. -- - !record {model: stock.move.scrap, id: scrap_lot_incomming}: - product_qty: 0.010 -- - !python {model: stock.move.scrap}: | - self.move_scrap(cr, uid, [ref('scrap_lot_incomming')], context=context) -- - I check stock in scrap location and refrigerator location. -- - !python {model: stock.location}: | - ctx = {'product_id': ref('product_icecream')} - refrigerator_location = self.pool.get('stock.location').browse(cr, uid, ref('location_refrigerator'), context=ctx) - assert refrigerator_location.stock_real == 135.96, 'stock does not correspond in refrigerator location.' - scrapped_location = self.browse(cr, uid, ref('stock_location_scrapped'), context=ctx) - assert scrapped_location.stock_real == 0.010*4, 'scraped stock does not correspond in scrap location.' - -- - I check availabile stock after consumed and scraped. -- - !python {model: product.product}: | - product = self.browse(cr, uid, ref('product_icecream'), context=context) - assert product.qty_available == 135.96, "Stock does not correspond." - assert round(product.virtual_available, 2) == -4.04, "Vitual stock does not correspond." + assert account_move_line.debit == 14000.0, "Debit amount does not correspond." - I trace all incoming lots. - !python {model: stock.production.lot }: | - lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incomming'), context=context) + lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incoming'), context=context) lot_ids = self.search(cr, uid, [('name', 'in', [x.name for x in lot.line_ids])]) self.action_traceability(cr, uid, lot_ids, context=context) - - I check outgoing shipment after stock availablity in refrigerator. + I check outgoing shipment after stock availability in Chicago shop. - !python {model: stock.picking}: | shipment = self.browse(cr, uid, ref("outgoing_shipment"), context=context) - self.pool.get('stock.move').action_assign(cr, uid, [x.id for x in shipment.move_lines]) #TOFIX: assignment of move lines should be call before testing assigment otherwise picking never gone in assign state - #TOFIX: shipment should be assigned if stock available - #assert shipment.state == "assigned", "Shipment should be assigned." - #for move_line in shipment.move_lines: - # assert move_line.state == "assigned", "Move should be assigned." + self.pool.get('stock.move').action_assign(cr, uid, [x.id for x in shipment.move_lines]) + assert shipment.state == "assigned", "Shipment should be assigned." + for move_line in shipment.move_lines: + assert move_line.state == "assigned", "Move should be assigned." self.force_assign(cr, uid, [shipment.id]) + context.update({'active_model':'stock.move', 'active_id':shipment.move_lines[0].id,'active_ids': [shipment.move_lines[0].id]}) - - I deliver 5kgm Ice-cream to customer so I make partial deliver + I scrap 4 units of 15” LCD Monitor into scrap location. +- + !record {model: stock.move.scrap, id: scrap_monitor1}: + product_qty: 4 +- + !python {model: stock.move.scrap}: | + self.move_scrap(cr, uid, [ref('scrap_monitor1')], context=context) +- + I consume 4 units of 15” LCD Monitor. +- + !record {model: stock.move.consume, id: consume_monitor1}: + product_qty: 4 + location_id: location_monitor +- + !python {model: stock.move.consume}: | + self.do_move_consume(cr, uid, [ref('consume_monitor1')], context=context) +- + I check stock in scrap location and stock location. +- + !python {model: stock.location}: | + ctx = {'product_id': ref('product_product_6')} + monitor_location = self.pool.get('stock.location').browse(cr, uid, ref('location_monitor'), context=ctx) + assert monitor_location.stock_real == 132.0, 'stock does not correspond in stock location shop0.' + scrapped_location = self.browse(cr, uid, ref('stock_location_scrapped'), context=ctx) + assert scrapped_location.stock_real == 4, 'scraped stock does not correspond in scrap location.' +- + I check available stock after consumed and scraped move. +- + !python {model: product.product}: | + product = self.browse(cr, uid, ref('product_product_6'), context=context) + assert product.qty_available == 132.0, "Stock does not correspond." + assert round(product.virtual_available, 2) == -4.00, "Virtual stock does not correspond." +- + I deliver 5 Unit 15” LCD Monitor to customer partially. - !python {model: stock.partial.move}: | - context.update({'active_model': 'stock.move', 'active_id': ref('outgoing_shipment_icecream'), 'active_ids': [ref('outgoing_shipment_icecream')]}) + context.update({'active_model': 'stock.move', 'active_id': ref('outgoing_shipment_monitor'), 'active_ids': [ref('outgoing_shipment_monitor')]}) - - !record {model: stock.partial.move, id: partial_outgoing_icecream}: + !record {model: stock.partial.move, id: partial_outgoing_monitor}: move_ids: - quantity: 5 - product_id: product_icecream - product_uom: product.product_uom_kgm - move_id: outgoing_shipment_icecream - location_id: location_refrigerator - location_dest_id: location_delivery_counter + product_id: product_product_6 + product_uom: product.product_uom_unit + move_id: outgoing_shipment_monitor + location_id: location_monitor + location_dest_id: stock_location_output - !python {model: stock.partial.move }: | - self.do_partial(cr, uid, [ref('partial_outgoing_icecream')], context=context) + self.do_partial(cr, uid, [ref('partial_outgoing_monitor')], context=context) - - I packing outgoing shipment into box per 10kgm with unique tracking lot. + I pack outgoing shipment into box of 10 Unit with unique tracking lot. - !python {model: stock.move}: | stock_split = self.pool.get('stock.split.into') - move = self.browse(cr, uid, ref('outgoing_shipment_icecream'), context=context) + move = self.browse(cr, uid, ref('outgoing_shipment_monitor'), context=context) context.update({'active_model': 'stock.move', 'active_id': move.id, 'active_ids': [move.id]}) total_qty = move.product_qty split_qty = 10 @@ -254,7 +262,7 @@ stock_split.split(cr, uid, [split_id], context=context) total_qty -= split_qty - - I deliver outgoing shipment. + I deliver the outgoing shipment. - !python {model: stock.partial.picking}: | context.update({'active_model': 'stock.picking', 'active_id': ref('outgoing_shipment'), 'active_ids': [ref('outgoing_shipment')]}) @@ -266,7 +274,7 @@ self.do_partial(cr, uid, [ref('partial_outgoing')], context=context) - - I check outgoing shipment after deliver. + I check outgoing shipment after delivery. - !python {model: stock.picking}: | shipment = self.browse(cr, uid, ref("outgoing_shipment"), context=context) @@ -274,9 +282,9 @@ for move_line in shipment.move_lines: assert move_line.state == "done", "Move should be closed." - - I check availaible stock after deliver. + I check available stock after delivery. - !python {model: product.product}: | - product = self.browse(cr, uid, ref('product_icecream'), context=context) - assert round(product.qty_available, 2) == 5.96, "Stock does not correspond." - assert round(product.virtual_available, 2) == -4.04, "Vitual stock does not correspond." + product = self.browse(cr, uid, ref('product_product_6'), context=context) + assert round(product.qty_available, 2) == 6, "Stock does not correspond." + assert round(product.virtual_available, 2) == -4.00, "Virtual stock does not correspond." diff --git a/addons/stock/test/stock_report.yml b/addons/stock/test/stock_report.yml index 2b062742294..21ed6046805 100644 --- a/addons/stock/test/stock_report.yml +++ b/addons/stock/test/stock_report.yml @@ -1,3 +1,8 @@ +- + Stock user can print all reports related to stock, so let's check data with giving the access rights of user. +- + !context + uid: 'res_users_stock_user' - I print a stock overview report of location. - @@ -5,7 +10,7 @@ import os import openerp.report from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref('location_refrigerator')], 'lot.stock.overview', {}, {}) + data, format = openerp.report.render_report(cr, uid, [ref('location_monitor')], 'lot.stock.overview', {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'stock-overview'+format), 'wb+').write(data) - @@ -15,7 +20,7 @@ import os import openerp.report from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref('location_refrigerator')], 'lot.stock.overview_all', {}, {}) + data, format = openerp.report.render_report(cr, uid, [ref('location_monitor')], 'lot.stock.overview_all', {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'stock-overviewall'+format), 'wb+').write(data) - @@ -25,7 +30,7 @@ import os import openerp.report from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref('stock_inventory_icecream')], 'stock.inventory.move', {}, {}) + data, format = openerp.report.render_report(cr, uid, [ref('stock_inventory_0')], 'stock.inventory.move', {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'stock-stock_inventory_move.'+format), 'wb+').write(data) - @@ -45,7 +50,7 @@ import os import openerp.report from openerp import tools - data, format = openerp.report.render_report(cr, uid, [ref('product_icecream')], 'stock.product.history', {}, {}) + data, format = openerp.report.render_report(cr, uid, [ref('product_product_6')], 'stock.product.history', {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'stock-product_stock_report.'+format), 'wb+').write(data) diff --git a/addons/stock/test/stock_users.yml b/addons/stock/test/stock_users.yml new file mode 100644 index 00000000000..d0c09dc745d --- /dev/null +++ b/addons/stock/test/stock_users.yml @@ -0,0 +1,30 @@ +- + Create a user as 'Stock Manager' +- + !record {model: res.users, id: res_users_stock_manager}: + company_id: base.main_company + name: Stock Manager + login: sam + password: sam + email: stockmanager@yourcompany.com +- + I added groups for Stock Manager. +- + !record {model: res.users, id: res_users_stock_manager}: + groups_id: + - stock.group_stock_manager +- + Create a user as 'Stock User' +- + !record {model: res.users, id: res_users_stock_user}: + company_id: base.main_company + name: Stock User + login: sau + password: sau + email: stockuser@yourcompany.com +- + I added groups for Stock User. +- + !record {model: res.users, id: res_users_stock_user}: + groups_id: + - stock.group_stock_user