Merge lp:~openerp-dev/openobject-addons/trunk-yaml-access-rights-sgo into lp:openobject-addons

Proposed by Sanjay Gohel (Open ERP)
Status: Superseded
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-yaml-access-rights-sgo
Merge into: lp:openobject-addons
Diff against target: 3040 lines (+1179/-416)
100 files modified
account/__openerp__.py (+1/-0)
account/security/ir.model.access.csv (+3/-0)
account/test/account_customer_invoice.yml (+5/-0)
account/test/account_invoice_state.yml (+5/-0)
account/test/account_supplier_invoice.yml (+5/-0)
account/test/account_test_users.yml (+24/-0)
account/test/account_validate_account_move.yml (+5/-0)
account_voucher/__openerp__.py (+1/-0)
account_voucher/test/account_voucher.yml (+6/-0)
account_voucher/test/account_voucher_users.yml (+24/-0)
account_voucher/test/case_eur_usd.yml (+5/-0)
account_voucher/test/sales_payment.yml (+5/-0)
account_voucher/test/sales_receipt.yml (+5/-0)
crm/__openerp__.py (+1/-0)
crm/security/crm_security.xml (+1/-0)
crm/security/ir.model.access.csv (+1/-0)
crm/test/crm_lead_cancel.yml (+11/-8)
crm/test/crm_lead_merge.yml (+5/-3)
crm/test/crm_lead_message.yml (+5/-0)
crm/test/crm_lead_onchange.yml (+9/-5)
crm/test/crm_lead_unlink.yml (+4/-1)
crm/test/lead2opportunity2win.yml (+5/-0)
crm/test/lead2opportunity_assign_salesmen.yml (+43/-38)
crm/test/phonecalls.yml (+5/-0)
crm/test/ui/crm_access_group_users.yml (+24/-0)
event/__openerp__.py (+1/-1)
event/security/event_security.xml (+1/-0)
event/test/process/event_draft2done.yml (+5/-0)
event/test/ui/event_users.yml (+24/-0)
hr/__openerp__.py (+1/-0)
hr/test/hr_demo.yml (+5/-0)
hr/test/hr_users.yml (+33/-0)
hr/test/open2recruit2close_job.yml (+5/-0)
hr_attendance/test/attendance_process.yml (+16/-0)
hr_recruitment/security/hr_recruitment_security.xml (+3/-0)
hr_recruitment/test/recruitment_process.yml (+16/-1)
hr_timesheet/__openerp__.py (+1/-0)
hr_timesheet/test/hr_timesheet_demo.yml (+5/-0)
hr_timesheet/test/hr_timesheet_users.yml (+33/-0)
hr_timesheet/test/test_hr_timesheet.yml (+10/-0)
mrp/__openerp__.py (+4/-3)
mrp/security/ir.model.access.csv (+1/-0)
mrp/security/mrp_security.xml (+1/-0)
mrp/test/cancel_order.yml (+5/-0)
mrp/test/mrp_users.yml (+24/-0)
mrp/test/order_demo.yml (+5/-0)
mrp/test/order_process.yml (+16/-11)
mrp_operations/__openerp__.py (+1/-1)
mrp_operations/test/workcenter_operations.yml (+18/-3)
mrp_repair/__openerp__.py (+2/-1)
mrp_repair/test/mrp_repair_users.yml (+24/-0)
mrp_repair/test/test_mrp_repair_afterinv.yml (+4/-1)
mrp_repair/test/test_mrp_repair_b4inv.yml (+4/-1)
mrp_repair/test/test_mrp_repair_cancel.yml (+4/-1)
mrp_repair/test/test_mrp_repair_noneinv.yml (+4/-1)
project/__openerp__.py (+1/-0)
project/security/ir.model.access.csv (+1/-0)
project/security/project_security.xml (+1/-0)
project/test/project_demo.yml (+17/-6)
project/test/project_process.yml (+5/-0)
project/test/project_users.yml (+24/-0)
project/test/task_process.yml (+20/-15)
project_issue/__openerp__.py (+1/-0)
project_issue/test/cancel_issue.yml (+5/-0)
project_issue/test/issue_demo.yml (+4/-3)
project_issue/test/issue_process.yml (+15/-0)
project_issue/test/issue_users.yml (+24/-0)
project_issue/test/subscribe_issue.yml (+1/-1)
purchase/__openerp__.py (+1/-0)
purchase/purchase_order_demo.yml (+5/-0)
purchase/test/process/cancel_order.yml (+5/-0)
purchase/test/process/generate_invoice_from_reception.yml (+5/-0)
purchase/test/process/invoice_on_poline.yml (+6/-7)
purchase/test/process/merge_order.yml (+5/-0)
purchase/test/ui/delete_order.yml (+5/-0)
purchase/test/ui/purchase_users.yml (+24/-0)
purchase_requisition/__openerp__.py (+1/-0)
purchase_requisition/security/purchase_tender.xml (+1/-0)
purchase_requisition/test/cancel_purchase_requisition.yml (+5/-0)
purchase_requisition/test/purchase_requisition.yml (+5/-0)
purchase_requisition/test/purchase_requisition_demo.yml (+5/-0)
purchase_requisition/test/purchase_requisition_users.yml (+24/-0)
sale/__openerp__.py (+1/-0)
sale/test/cancel_order.yml (+5/-0)
sale/test/create_sale_users.yml (+24/-0)
sale/test/delete_order.yml (+5/-0)
sale/test/sale_order_demo.yml (+0/-36)
sale_stock/__openerp__.py (+2/-1)
sale_stock/test/cancel_order_sale_stock.yml (+15/-2)
sale_stock/test/picking_order_policy.yml (+24/-1)
sale_stock/test/prepaid_order_policy.yml (+4/-1)
sale_stock/test/sale_order_onchange.yml (+10/-0)
sale_stock/test/sale_stock_users.yml (+50/-0)
stock/__openerp__.py (+5/-4)
stock/security/stock_security.xml (+1/-1)
stock/stock_demo.yml (+77/-69)
stock/test/opening_stock.yml (+66/-36)
stock/test/shipment.yml (+157/-149)
stock/test/stock_report.yml (+9/-4)
stock/test/stock_users.yml (+24/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-yaml-access-rights-sgo
Reviewer Review Type Date Requested Status
Martin Trigaux (OpenERP) (community) Needs Fixing
OpenERP Core Team Pending
Review via email: mp+151880@code.launchpad.net

This proposal has been superseded by a proposal from 2013-04-29.

Description of the change

Hello,

     I have improve ymls as per given access rights.
yml can test as per assigned uid.

Thank You.

To post a comment you must log in.
Revision history for this message
Martin Trigaux (OpenERP) (mat-openerp) wrote :

Yaml tests fail for the module 'account' "Access Denied by ACLs for operation: create, uid: 86, model: ir.property"
look at http://runbot.openerp.com/openerp-dev-trunk-yaml-access-rights-sgo-7935/logs/test-all.txt

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/__openerp__.py'
2--- account/__openerp__.py 2012-12-20 10:43:45 +0000
3+++ account/__openerp__.py 2013-04-29 11:35:33 +0000
4@@ -146,6 +146,7 @@
5 'account_unit_test.xml',
6 ],
7 'test': [
8+ 'test/account_test_users.yml',
9 'test/account_customer_invoice.yml',
10 'test/account_supplier_invoice.yml',
11 'test/account_change_currency.yml',
12
13=== modified file 'account/security/ir.model.access.csv'
14--- account/security/ir.model.access.csv 2012-12-12 12:59:12 +0000
15+++ account/security/ir.model.access.csv 2013-04-29 11:35:33 +0000
16@@ -37,6 +37,7 @@
17 access_account_payment_term_line_manager,account.payment.term.line,model_account_payment_term_line,account.group_account_manager,1,1,1,1
18 access_account_tax_manager,account.tax,model_account_tax,account.group_account_manager,1,1,1,1
19 access_account_journal_manager,account.journal,model_account_journal,account.group_account_manager,1,1,1,1
20+access_account_journal_user,account.journal,model_account_journal,account.group_account_user,1,1,1,0
21 access_account_journal_invoice,account.journal invoice,model_account_journal,account.group_account_invoice,1,0,0,0
22 access_account_period_manager,account.period,model_account_period,account.group_account_manager,1,1,1,1
23 access_account_period_invoice,account.period invoice,model_account_period,account.group_account_invoice,1,0,0,0
24@@ -71,6 +72,7 @@
25 access_report_account_sales,report.account.sales,model_report_account_sales,account.group_account_manager,1,1,1,1
26 access_account_invoice_report,account.invoice.report,model_account_invoice_report,account.group_account_manager,1,1,1,1
27 access_res_partner_group_account_manager,res_partner group_account_manager,model_res_partner,account.group_account_manager,1,0,0,0
28+access_res_partner_group_account_user,res_partner group_account_user,model_res_partner,account.group_account_user,1,1,1,0
29 access_account_invoice_accountant,account.invoice accountant,model_account_invoice,account.group_account_user,1,0,0,0
30 access_account_tax_code_accountant,account.tax.code accountant,model_account_tax_code,account.group_account_user,1,1,1,1
31 access_account_move_line_manager,account.move.line manager,model_account_move_line,account.group_account_manager,1,0,0,0
32@@ -98,3 +100,4 @@
33 access_account_treasury_report_manager,account.treasury.report.manager,model_account_treasury_report,account.group_account_manager,1,0,0,0
34 access_account_financial_report,account.financial.report,model_account_financial_report,account.group_account_user,1,1,1,1
35 access_account_financial_report_invoice,account.financial.report invoice,model_account_financial_report,account.group_account_invoice,1,0,0,0
36+access_res_partner_bank,res.partner.bank,model_res_partner_bank,account.group_account_user,1,1,1,0
37
38=== modified file 'account/test/account_customer_invoice.yml'
39--- account/test/account_customer_invoice.yml 2012-11-29 22:26:45 +0000
40+++ account/test/account_customer_invoice.yml 2013-04-29 11:35:33 +0000
41@@ -1,4 +1,9 @@
42 -
43+ Test with that user which have rights to make Invoicing and payment and who is accountant.
44+-
45+ !context
46+ uid: 'res_users_account_user'
47+-
48 In order to test account invoice I create a new customer invoice
49 -
50 I will create bank detail
51
52=== modified file 'account/test/account_invoice_state.yml'
53--- account/test/account_invoice_state.yml 2012-11-29 22:26:45 +0000
54+++ account/test/account_invoice_state.yml 2013-04-29 11:35:33 +0000
55@@ -1,4 +1,9 @@
56 -
57+ Test with that user which have rights to make Invoicing.
58+-
59+ !context
60+ uid: 'res_users_account_user'
61+-
62 In order to test Confirm Draft Invoice wizard I create an invoice and confirm it with this wizard
63 -
64 !record {model: account.invoice, id: account_invoice_state}:
65
66=== modified file 'account/test/account_supplier_invoice.yml'
67--- account/test/account_supplier_invoice.yml 2012-11-29 22:26:45 +0000
68+++ account/test/account_supplier_invoice.yml 2013-04-29 11:35:33 +0000
69@@ -1,4 +1,9 @@
70 -
71+ Test with that Finance manager who can only create supplier invoice.
72+-
73+ !context
74+ uid: 'res_users_account_manager'
75+-
76 In order to test account invoice I create a new supplier invoice
77 -
78 I create a Tax Codes
79
80=== added file 'account/test/account_test_users.yml'
81--- account/test/account_test_users.yml 1970-01-01 00:00:00 +0000
82+++ account/test/account_test_users.yml 2013-04-29 11:35:33 +0000
83@@ -0,0 +1,24 @@
84+-
85+ Create a user as 'Accountant'
86+-
87+ !context
88+ default_groups_ref: [base.group_partner_manager,account.group_account_user]
89+-
90+ !record {model: res.users, id: res_users_account_user}:
91+ company_id: base.main_company
92+ name: Accountant
93+ login: acc
94+ password: acc
95+ email: accountuser@yourcompany.com
96+-
97+ Create a user as 'Financial Manager'
98+-
99+ !context
100+ default_groups_ref: [account.group_account_manager]
101+-
102+ !record {model: res.users, id: res_users_account_manager}:
103+ company_id: base.main_company
104+ name: Financial Manager
105+ login: fm
106+ password: fm
107+ email: accountmanager@yourcompany.com
108
109=== modified file 'account/test/account_validate_account_move.yml'
110--- account/test/account_validate_account_move.yml 2012-11-29 22:26:45 +0000
111+++ account/test/account_validate_account_move.yml 2013-04-29 11:35:33 +0000
112@@ -1,4 +1,9 @@
113 -
114+ Test validate account move with user who is accountant which have its rights.'
115+-
116+ !context
117+ uid: 'res_users_account_user'
118+-
119 In order to test the account move lines in OpenERP, I create account move
120 -
121 I create a Account tax code
122
123=== modified file 'account_voucher/__openerp__.py'
124--- account_voucher/__openerp__.py 2013-01-31 18:41:41 +0000
125+++ account_voucher/__openerp__.py 2013-04-29 11:35:33 +0000
126@@ -61,6 +61,7 @@
127 'account_voucher_data.xml',
128 ],
129 'test' : [
130+ 'test/account_voucher_users.yml',
131 'test/case5_suppl_usd_usd.yml',
132 'test/account_voucher.yml',
133 'test/sales_receipt.yml',
134
135=== modified file 'account_voucher/test/account_voucher.yml'
136--- account_voucher/test/account_voucher.yml 2012-11-29 22:26:45 +0000
137+++ account_voucher/test/account_voucher.yml 2013-04-29 11:35:33 +0000
138@@ -1,4 +1,10 @@
139 -
140+ I check the voucher module with user who is accountant.
141+-
142+ !context
143+ uid: 'res_users_account_voucher_user'
144+
145+-
146 In order to check account voucher module in OpenERP I create a customer voucher
147 -
148 !record {model: account.voucher, id: account_voucher_voucherforaxelor0, view: view_sale_receipt_form}:
149
150=== added file 'account_voucher/test/account_voucher_users.yml'
151--- account_voucher/test/account_voucher_users.yml 1970-01-01 00:00:00 +0000
152+++ account_voucher/test/account_voucher_users.yml 2013-04-29 11:35:33 +0000
153@@ -0,0 +1,24 @@
154+-
155+ Create a user as 'Accountant for voucher'
156+-
157+ !context
158+ default_groups_ref: [base.group_partner_manager,account.group_account_user]
159+-
160+ !record {model: res.users, id: res_users_account_voucher_user}:
161+ company_id: base.main_company
162+ name: Voucher Accountant
163+ login: vacc
164+ password: acc
165+ email: accountant@yourcompany.com
166+-
167+ Create a user as 'Financial Manager for account voucher'
168+-
169+ !context
170+ default_groups_ref: [base.group_partner_manager,account.group_account_manager]
171+-
172+ !record {model: res.users, id: res_users_account_voucher_manager}:
173+ company_id: base.main_company
174+ name: Financial Manager for voucher
175+ login: fmv
176+ password: fmv
177+ email: finmanager@yourcompany.com
178
179=== modified file 'account_voucher/test/case_eur_usd.yml'
180--- account_voucher/test/case_eur_usd.yml 2012-11-29 22:26:45 +0000
181+++ account_voucher/test/case_eur_usd.yml 2013-04-29 11:35:33 +0000
182@@ -1,5 +1,10 @@
183 ##YAML test on the account_voucher as depicted in this bug report: https://bugs.launchpad.net/openobject-addons/+bug/954155
184 -
185+ Only manager can create and take decision about bank and currency there I checkd this test with user who is finance manager.
186+-
187+ !context
188+ uid: 'res_users_account_voucher_manager'
189+-
190 In order to check the payment with multi-currency in OpenERP,
191 I create an invoice in EUR and make payment in USD based on the currency rating.
192 -
193
194=== modified file 'account_voucher/test/sales_payment.yml'
195--- account_voucher/test/sales_payment.yml 2013-02-22 16:10:29 +0000
196+++ account_voucher/test/sales_payment.yml 2013-04-29 11:35:33 +0000
197@@ -1,3 +1,8 @@
198+-
199+ I test sales payment with user who is accountant.
200+-
201+ !context
202+ uid: 'res_users_account_voucher_user'
203 -
204 Create an invoice for the partner Seagate with amount 450.0
205 -
206
207=== modified file 'account_voucher/test/sales_receipt.yml'
208--- account_voucher/test/sales_receipt.yml 2013-02-22 16:10:29 +0000
209+++ account_voucher/test/sales_receipt.yml 2013-04-29 11:35:33 +0000
210@@ -1,3 +1,8 @@
211+-
212+ Accountant can also be created receipt and validate it there for I checked it with that user who is accountant.
213+-
214+ !context
215+ uid: 'res_users_account_voucher_user'
216 -
217 Creating a Voucher Receipt for partner Seagate with amount 30000.0
218 -
219
220=== modified file 'crm/__openerp__.py'
221--- crm/__openerp__.py 2013-04-05 11:10:48 +0000
222+++ crm/__openerp__.py 2013-04-29 11:35:33 +0000
223@@ -105,6 +105,7 @@
224 'crm_action_rule_demo.xml',
225 ],
226 'test': [
227+ 'test/ui/crm_access_group_users.yml',
228 'test/crm_lead_message.yml',
229 'test/lead2opportunity2win.yml',
230 'test/lead2opportunity_assign_salesmen.yml',
231
232=== modified file 'crm/security/crm_security.xml'
233--- crm/security/crm_security.xml 2013-03-28 16:07:04 +0000
234+++ crm/security/crm_security.xml 2013-04-29 11:35:33 +0000
235@@ -5,6 +5,7 @@
236 <record id="base.group_sale_salesman" model="res.groups">
237 <field name="name">User: Own Leads Only</field>
238 <field name="category_id" ref="base.module_category_sales_management"/>
239+ <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
240 <field name="comment">the user will have access to his own data in the sales application.</field>
241 </record>
242
243
244=== modified file 'crm/security/ir.model.access.csv'
245--- crm/security/ir.model.access.csv 2013-04-05 11:10:48 +0000
246+++ crm/security/ir.model.access.csv 2013-04-29 11:35:33 +0000
247@@ -35,3 +35,4 @@
248 access_crm_phonecall_partner_manager,crm.phonecall.partner.manager,model_crm_phonecall,base.group_partner_manager,1,1,1,1
249 access_crm_payment_mode_user,crm.payment.mode,model_crm_payment_mode,base.group_sale_salesman,1,0,0,0
250 access_crm_payment_mode,crm.payment.mode,model_crm_payment_mode,base.group_sale_manager,1,1,1,1
251+access_ir_property_salesman,ir_property_salesman,base.model_ir_property,base.group_sale_salesman,1,1,1,0
252
253=== modified file 'crm/test/crm_lead_cancel.yml'
254--- crm/test/crm_lead_cancel.yml 2013-03-21 11:26:47 +0000
255+++ crm/test/crm_lead_cancel.yml 2013-04-29 11:35:33 +0000
256@@ -1,10 +1,13 @@
257 -
258- I cancel unqualified lead.
259+ Salesman can also cancelled unqualified lead and re-open lead so giving access rights of salesman.
260+-
261+ !context
262+ uid: 'crm_res_users_salesman'
263 -
264 !python {model: crm.lead}: |
265 self.case_cancel(cr, uid, [ref("crm_case_1")])
266 -
267- I check cancelled lead.
268+ Salesman check cancelled lead.
269 -
270 !python {model: crm.lead}: |
271 lead = self.browse(cr, uid, ref('crm_case_1'))
272@@ -12,34 +15,34 @@
273 assert lead.state == 'cancel', "Opportunity is not in 'cancel' state."
274 assert lead.probability == 0.0, 'Opportunity is probably wrong and should be 0.0.'
275 -
276- I reset cancelled lead into unqualified lead.
277+ Salesman reset cancelled lead into unqualified lead.
278 -
279 !python {model: crm.lead}: |
280 self.case_reset(cr, uid, [ref("crm_case_1")])
281 -
282- I check unqualified lead after reset.
283+ Salesman check unqualified lead after reset.
284 -
285 !assert {model: crm.lead, id: crm.crm_case_1, string: Lead is in draft state}:
286 - state == "draft"
287 -
288- I re-open the lead
289+ Salesman re-open the lead
290 -
291 !python {model: crm.lead}: |
292 self.case_open(cr, uid, [ref("crm_case_1")])
293 -
294- I check stage and state of the re-opened lead
295+ Salesman check stage and state of the re-opened lead
296 -
297 !python {model: crm.lead}: |
298 lead = self.browse(cr, uid, ref('crm.crm_case_1'))
299 assert lead.stage_id.id == ref('crm.stage_lead2'), "Opportunity stage should be 'Qualification'."
300 assert lead.state == 'open', "Opportunity should be in 'open' state."
301 -
302- I escalate the lead to parent team.
303+ Salesman escalate the lead to parent team.
304 -
305 !python {model: crm.lead}: |
306 self.case_escalate(cr, uid, [ref("crm_case_1")])
307 -
308- I check the lead is correctly escalated to the parent team.
309+ Salesman check the lead is correctly escalated to the parent team.
310 -
311 !assert {model: crm.lead, id: crm.crm_case_1, string: Escalate lead to parent team}:
312 - section_id.name == "Support Department"
313
314=== modified file 'crm/test/crm_lead_merge.yml'
315--- crm/test/crm_lead_merge.yml 2013-03-29 13:06:15 +0000
316+++ crm/test/crm_lead_merge.yml 2013-04-29 11:35:33 +0000
317@@ -1,6 +1,8 @@
318-
319--
320- 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.
321+-
322+ 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.
323+-
324+ !context
325+ uid: 'crm_res_users_salesmanager'
326 -
327 !record {model: crm.lead, id: test_crm_lead_01}:
328 type: 'lead'
329
330=== modified file 'crm/test/crm_lead_message.yml'
331--- crm/test/crm_lead_message.yml 2013-04-16 15:18:44 +0000
332+++ crm/test/crm_lead_message.yml 2013-04-29 11:35:33 +0000
333@@ -1,4 +1,9 @@
334 -
335+ Give the access rights of Salesman to communicat with customer.
336+-
337+ !context
338+ uid: 'crm_res_users_salesman'
339+-
340 Customer interested in our product, so he sends request by email to get more details.
341 -
342 Mail script will fetch his request from mail server. Then I process that mail after read EML file.
343
344=== modified file 'crm/test/crm_lead_onchange.yml'
345--- crm/test/crm_lead_onchange.yml 2013-03-21 11:26:47 +0000
346+++ crm/test/crm_lead_onchange.yml 2013-04-29 11:35:33 +0000
347@@ -1,5 +1,9 @@
348--
349- I create a lead record to call a partner onchange, stage onchange and mailing opt-in onchange method.
350+
351+-
352+ Sales manager create a lead record to call a partner onchange, stage onchange and mailing opt-in onchange method.
353+-
354+ !context
355+ uid: 'crm_res_users_salesmanager'
356 -
357 !record {model: crm.lead, id: crm_case_25}:
358 name: 'Need more info about your pc2'
359@@ -8,7 +12,7 @@
360 stage_id: crm.stage_lead1
361 state: draft
362 -
363- I create a lead record to call a mailing opt-out onchange method.
364+ Sales manager create a lead record to call a mailing opt-out onchange method.
365 -
366 !record {model: crm.lead, id: crm_case_18}:
367 name: 'Need 20 Days of Consultancy'
368@@ -16,13 +20,13 @@
369 state: draft
370 opt_out: True
371 -
372- I create a phonecall record to call a partner onchange method.
373+ Sales manager create a phonecall record to call a partner onchange method.
374 -
375 !record {model: crm.phonecall, id: crm_phonecall_5}:
376 name: 'Bad time'
377 partner_id: base.res_partner_5
378 -
379- I set the next stage to "New" for the lead.
380+ Sales manager set the next stage to "New" for the lead.
381 -
382 !python {model: crm.lead}: |
383 self.stage_next(cr, uid, [ref("crm_case_4")], context={'stage_type': 'lead'})
384
385=== modified file 'crm/test/crm_lead_unlink.yml'
386--- crm/test/crm_lead_unlink.yml 2013-03-21 11:26:47 +0000
387+++ crm/test/crm_lead_unlink.yml 2013-04-29 11:35:33 +0000
388@@ -1,5 +1,8 @@
389 -
390- I Unlink the Lead.
391+ Only Sales manager Unlink the Lead so test with Manager's access rights'.
392+-
393+ !context
394+ uid: 'crm_res_users_salesmanager'
395 -
396 !python {model: crm.lead}: |
397 self.unlink(cr, uid, [ref("crm_case_4")])
398
399=== modified file 'crm/test/lead2opportunity2win.yml'
400--- crm/test/lead2opportunity2win.yml 2013-03-21 11:26:47 +0000
401+++ crm/test/lead2opportunity2win.yml 2013-04-29 11:35:33 +0000
402@@ -1,4 +1,9 @@
403 -
404+ Giving access rights of salesman to convert the lead into opportunity.
405+-
406+ !context
407+ uid: 'crm_res_users_salesman'
408+-
409 In order to test the conversion of a lead into a opportunity,
410 -
411 I open a lead.
412
413=== modified file 'crm/test/lead2opportunity_assign_salesmen.yml'
414--- crm/test/lead2opportunity_assign_salesmen.yml 2013-03-21 11:26:47 +0000
415+++ crm/test/lead2opportunity_assign_salesmen.yml 2013-04-29 11:35:33 +0000
416@@ -1,41 +1,5 @@
417 -
418- 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).
419--
420- !record {model: crm.lead, id: test_crm_lead_01}:
421- type: 'lead'
422- name: 'Test lead 1'
423- email_from: 'Raoul Grosbedon <raoul@grosbedon.fr>'
424- stage_id: stage_lead1
425--
426- !record {model: crm.lead, id: test_crm_lead_02}:
427- type: 'lead'
428- name: 'Test lead 2'
429- email_from: 'Raoul Grosbedon <raoul@grosbedon.fr>'
430- stage_id: stage_lead1
431--
432- !record {model: crm.lead, id: test_crm_lead_03}:
433- type: 'lead'
434- name: 'Test lead 3'
435- email_from: 'Raoul Grosbedon <raoul@grosbedon.fr>'
436- stage_id: stage_lead1
437--
438- !record {model: crm.lead, id: test_crm_lead_04}:
439- type: 'lead'
440- name: 'Test lead 4'
441- contact_name: 'Fabrice Lepoilu'
442- stage_id: stage_lead1
443--
444- !record {model: crm.lead, id: test_crm_lead_05}:
445- type: 'lead'
446- name: 'Test lead 5'
447- contact_name: 'Fabrice Lepoilu'
448- stage_id: stage_lead1
449--
450- !record {model: crm.lead, id: test_crm_lead_06}:
451- type: 'lead'
452- name: 'Test lead 6'
453- partner_name: 'Agrolait SuperSeed SA'
454- stage_id: stage_lead1
455+ 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).
456 -
457 !record {model: res.users, id: test_res_user_01}:
458 name: 'Test user A'
459@@ -57,7 +21,48 @@
460 login: 'tud'
461 new_password: 'tud'
462 -
463- I create a mass convert wizard and convert all the leads.
464+ Salesman also creates lead so giving access rights of salesman.
465+-
466+ !context
467+ uid: 'crm_res_users_salesman'
468+-
469+ !record {model: crm.lead, id: test_crm_lead_01}:
470+ type: 'lead'
471+ name: 'Test lead 1'
472+ email_from: 'Raoul Grosbedon <raoul@grosbedon.fr>'
473+ stage_id: stage_lead1
474+-
475+ !record {model: crm.lead, id: test_crm_lead_02}:
476+ type: 'lead'
477+ name: 'Test lead 2'
478+ email_from: 'Raoul Grosbedon <raoul@grosbedon.fr>'
479+ stage_id: stage_lead1
480+-
481+ !record {model: crm.lead, id: test_crm_lead_03}:
482+ type: 'lead'
483+ name: 'Test lead 3'
484+ email_from: 'Raoul Grosbedon <raoul@grosbedon.fr>'
485+ stage_id: stage_lead1
486+-
487+ !record {model: crm.lead, id: test_crm_lead_04}:
488+ type: 'lead'
489+ name: 'Test lead 4'
490+ contact_name: 'Fabrice Lepoilu'
491+ stage_id: stage_lead1
492+-
493+ !record {model: crm.lead, id: test_crm_lead_05}:
494+ type: 'lead'
495+ name: 'Test lead 5'
496+ contact_name: 'Fabrice Lepoilu'
497+ stage_id: stage_lead1
498+-
499+ !record {model: crm.lead, id: test_crm_lead_06}:
500+ type: 'lead'
501+ name: 'Test lead 6'
502+ partner_name: 'Agrolait SuperSeed SA'
503+ stage_id: stage_lead1
504+-
505+ Salesman create a mass convert wizard and convert all the leads.
506 -
507 !python {model: crm.lead2opportunity.partner.mass}: |
508 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")})
509
510=== modified file 'crm/test/phonecalls.yml'
511--- crm/test/phonecalls.yml 2013-03-21 11:26:47 +0000
512+++ crm/test/phonecalls.yml 2013-04-29 11:35:33 +0000
513@@ -1,4 +1,9 @@
514 -
515+ Salesman check the phone calls data so test with the access rights of salesman.
516+-
517+ !context
518+ uid: 'crm_res_users_salesman'
519+-
520 I schedule a phone call with a customer.
521 -
522 !python {model: crm.phonecall2phonecall}: |
523
524=== added directory 'crm/test/ui'
525=== added file 'crm/test/ui/crm_access_group_users.yml'
526--- crm/test/ui/crm_access_group_users.yml 1970-01-01 00:00:00 +0000
527+++ crm/test/ui/crm_access_group_users.yml 2013-04-29 11:35:33 +0000
528@@ -0,0 +1,24 @@
529+-
530+ Create a user as 'Salesmanager'
531+-
532+ !context
533+ default_groups_ref: ['base.group_sale_manager']
534+-
535+ !record {model: res.users, id: crm_res_users_salesmanager}:
536+ company_id: base.main_company
537+ name: Sales manager
538+ login: csm
539+ password: csm
540+ email: crmmanager@yourcompany.com
541+-
542+ Create a user as 'Salesman'
543+-
544+ !context
545+ default_groups_ref: ['base.group_sale_salesman_all_leads']
546+-
547+ !record {model: res.users, id: crm_res_users_salesman}:
548+ company_id: base.main_company
549+ name: Salesman
550+ login: csu
551+ password: csu
552+ email: crmuser@yourcompany.com
553
554=== modified file 'event/__openerp__.py'
555--- event/__openerp__.py 2013-01-31 18:41:41 +0000
556+++ event/__openerp__.py 2013-04-29 11:35:33 +0000
557@@ -52,7 +52,7 @@
558 'email_template.xml',
559 ],
560 'demo': ['event_demo.xml'],
561- 'test': ['test/process/event_draft2done.yml'],
562+ 'test': ['test/ui/event_users.yml','test/process/event_draft2done.yml'],
563 'css': ['static/src/css/event.css'],
564 'installable': True,
565 'application': True,
566
567=== modified file 'event/security/event_security.xml'
568--- event/security/event_security.xml 2012-12-18 23:20:01 +0000
569+++ event/security/event_security.xml 2013-04-29 11:35:33 +0000
570@@ -10,6 +10,7 @@
571
572 <record id="group_event_user" model="res.groups">
573 <field name="name">User</field>
574+ <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
575 <field name="category_id" ref="module_category_event_management"/>
576 </record>
577
578
579=== modified file 'event/test/process/event_draft2done.yml'
580--- event/test/process/event_draft2done.yml 2012-05-27 09:49:23 +0000
581+++ event/test/process/event_draft2done.yml 2013-04-29 11:35:33 +0000
582@@ -1,4 +1,9 @@
583 -
584+ Give the access rights of Event user to organize an event and also do registration.
585+-
586+ !context
587+ uid: 'res_users_eventuser'
588+-
589 I want to organize an event,
590 into this conference I should create two registration.
591 One confirmed and attended the event and the other cancelled.
592
593=== added file 'event/test/ui/event_users.yml'
594--- event/test/ui/event_users.yml 1970-01-01 00:00:00 +0000
595+++ event/test/ui/event_users.yml 2013-04-29 11:35:33 +0000
596@@ -0,0 +1,24 @@
597+-
598+ Create a user as 'Event manager'
599+-
600+ !context
601+ default_groups_ref: [event.group_event_manager]
602+-
603+ !record {model: res.users, id: res_users_eventmanager}:
604+ company_id: base.main_company
605+ name: Event manager
606+ login: em
607+ password: em
608+ email: eventmanager@yourcompany.com
609+-
610+ Create a user as 'Event user'
611+-
612+ !context
613+ default_groups_ref: [event.group_event_user]
614+-
615+ !record {model: res.users, id: res_users_eventuser}:
616+ company_id: base.main_company
617+ name: User
618+ login: eu
619+ password: eu
620+ email: eventuser@yourcompany.com
621
622=== modified file 'hr/__openerp__.py'
623--- hr/__openerp__.py 2012-11-29 22:26:45 +0000
624+++ hr/__openerp__.py 2013-04-29 11:35:33 +0000
625@@ -62,6 +62,7 @@
626 ],
627 'demo': ['hr_demo.xml'],
628 'test': [
629+ 'test/hr_users.yml',
630 'test/open2recruit2close_job.yml',
631 'test/hr_demo.yml',
632 ],
633
634=== modified file 'hr/test/hr_demo.yml'
635--- hr/test/hr_demo.yml 2012-03-19 12:28:22 +0000
636+++ hr/test/hr_demo.yml 2013-04-29 11:35:33 +0000
637@@ -1,4 +1,9 @@
638 -
639+ Give the access rights of Hr Officer to create employee.
640+-
641+ !context
642+ uid: 'res_users_hr_officer'
643+-
644 !record {model: hr.job, id: job_developer, view: False}:
645 no_of_employee: 0.0
646 no_of_recruitment: 5.0
647
648=== added file 'hr/test/hr_users.yml'
649--- hr/test/hr_users.yml 1970-01-01 00:00:00 +0000
650+++ hr/test/hr_users.yml 2013-04-29 11:35:33 +0000
651@@ -0,0 +1,33 @@
652+-
653+ Create a user as 'HR Manager'
654+-
655+ !context
656+ default_groups_ref: [base.group_hr_manager]
657+-
658+ !record {model: res.users, id: res_users_hr_manager}:
659+ company_id: base.main_company
660+ name: HR manager
661+ login: hrm
662+ password: hrm
663+-
664+ Create a user as 'HR Officer'
665+-
666+ !context
667+ default_groups_ref: [base.group_hr_user]
668+-
669+ !record {model: res.users, id: res_users_hr_officer}:
670+ company_id: base.main_company
671+ name: HR Officer
672+ login: hro
673+ password: hro
674+-
675+ Create a user as 'Employee'
676+-
677+ !context
678+ default_groups_ref: [base.group_user]
679+-
680+ !record {model: res.users, id: res_users_employee}:
681+ company_id: base.main_company
682+ name: Employee
683+ login: emp
684+ password: emp
685
686=== modified file 'hr/test/open2recruit2close_job.yml'
687--- hr/test/open2recruit2close_job.yml 2012-06-11 09:34:23 +0000
688+++ hr/test/open2recruit2close_job.yml 2013-04-29 11:35:33 +0000
689@@ -1,4 +1,9 @@
690 -
691+ Give the access rights of Hr Officer to the user to test the process of Human Resource Management.
692+-
693+ !context
694+ uid: 'res_users_hr_officer'
695+-
696 In order to test the process of Human Resource Management, I open Job Postion for "Developer".
697 -
698 !python {model: hr.job}: |
699
700=== modified file 'hr_attendance/test/attendance_process.yml'
701--- hr_attendance/test/attendance_process.yml 2012-11-29 22:26:45 +0000
702+++ hr_attendance/test/attendance_process.yml 2013-04-29 11:35:33 +0000
703@@ -1,4 +1,20 @@
704 -
705+ Create a user as 'HR Attendance Officer'
706+-
707+ !context
708+ default_groups_ref: [base.group_hr_user]
709+-
710+ !record {model: res.users, id: res_users_attendance_officer}:
711+ company_id: base.main_company
712+ name: HR Officer
713+ login: ao
714+ password: ao
715+-
716+ Give the access rights of Hr Officer to test attendance process.
717+-
718+ !context
719+ uid: 'res_users_attendance_officer'
720+-
721 In order to test attendance process in OpenERP, I entry of SignIn of employee.
722 -
723 !python {model: hr.employee}: |
724
725=== modified file 'hr_recruitment/security/hr_recruitment_security.xml'
726--- hr_recruitment/security/hr_recruitment_security.xml 2011-06-08 07:29:35 +0000
727+++ hr_recruitment/security/hr_recruitment_security.xml 2013-04-29 11:35:33 +0000
728@@ -9,6 +9,9 @@
729 <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
730 </record>
731
732+ <record id="base.group_hr_user" model="res.groups">
733+ <field name="implied_ids" eval="[(4, ref('base.group_survey_user'))]"/>
734+ </record>
735
736 </data>
737 </openerp>
738
739=== modified file 'hr_recruitment/test/recruitment_process.yml'
740--- hr_recruitment/test/recruitment_process.yml 2013-04-17 06:40:51 +0000
741+++ hr_recruitment/test/recruitment_process.yml 2013-04-29 11:35:33 +0000
742@@ -1,5 +1,20 @@
743 -
744- In Order to test process of Recruitment,
745+ Create a user as 'HR Recruitment Officer'
746+-
747+ !context
748+ default_groups_ref: [base.group_hr_user]
749+-
750+ !record {model: res.users, id: res_users_hr_officer}:
751+ company_id: base.main_company
752+ name: HR Officer
753+ login: hrro
754+ password: hrro
755+ email: hrofcr@yourcompany.com
756+-
757+ In Order to test process of Recruitment so giving HR officer's rights,
758+-
759+ !context
760+ uid: 'res_users_hr_officer'
761 -
762 An applicant is interested in the job position. So he sends a resume by email.
763 -
764
765=== modified file 'hr_timesheet/__openerp__.py'
766--- hr_timesheet/__openerp__.py 2012-11-29 22:26:45 +0000
767+++ hr_timesheet/__openerp__.py 2013-04-29 11:35:33 +0000
768@@ -57,6 +57,7 @@
769 ],
770 'demo': ['hr_timesheet_demo.xml'],
771 'test': [
772+ 'test/hr_timesheet_users.yml',
773 'test/test_hr_timesheet.yml',
774 'test/hr_timesheet_report.yml',
775 'test/hr_timesheet_demo.yml',
776
777=== modified file 'hr_timesheet/test/hr_timesheet_demo.yml'
778--- hr_timesheet/test/hr_timesheet_demo.yml 2011-12-21 10:52:14 +0000
779+++ hr_timesheet/test/hr_timesheet_demo.yml 2013-04-29 11:35:33 +0000
780@@ -1,4 +1,9 @@
781 -
782+ Give the access rights of Hr Officer to create employee.
783+-
784+ !context
785+ uid: 'res_hr_timesheet_officer'
786+-
787 !record {model: hr.analytic.timesheet, id: working_hours_coding, view: False}:
788 user_id: base.user_demo
789 date: !eval time.strftime('%Y-%m-%d')
790
791=== added file 'hr_timesheet/test/hr_timesheet_users.yml'
792--- hr_timesheet/test/hr_timesheet_users.yml 1970-01-01 00:00:00 +0000
793+++ hr_timesheet/test/hr_timesheet_users.yml 2013-04-29 11:35:33 +0000
794@@ -0,0 +1,33 @@
795+-
796+ Create a user as 'HR Manager'
797+-
798+ !context
799+ default_groups_ref: [base.group_hr_manager]
800+-
801+ !record {model: res.users, id: res_hr_timesheet_manager}:
802+ company_id: base.main_company
803+ name: HR manager
804+ login: hrtm
805+ password: hrtm
806+-
807+ Create a user as 'HR Officer'
808+-
809+ !context
810+ default_groups_ref: [base.group_hr_user]
811+-
812+ !record {model: res.users, id: res_hr_timesheet_officer}:
813+ company_id: base.main_company
814+ name: HR Officer
815+ login: hrto
816+ password: hrto
817+-
818+ Create a user as 'Employee'
819+-
820+ !context
821+ default_groups_ref: [base.group_user]
822+-
823+ !record {model: res.users, id: res_hr_timesheet_employee}:
824+ company_id: base.main_company
825+ name: Employee
826+ login: empt
827+ password: empt
828
829=== modified file 'hr_timesheet/test/test_hr_timesheet.yml'
830--- hr_timesheet/test/test_hr_timesheet.yml 2012-11-29 22:26:45 +0000
831+++ hr_timesheet/test/test_hr_timesheet.yml 2013-04-29 11:35:33 +0000
832@@ -2,6 +2,11 @@
833 In order to test hr_timesheet Module in OpenERP, I make "Sign In/Sign Out for Project" to encode and
834 track time spent on the different projects.
835 -
836+ Give the access rights of Hr Officer to create employee.
837+-
838+ !context
839+ uid: 'res_hr_timesheet_officer'
840+-
841 I create employee "Quentin Paolino" as "User".
842 -
843 !record {model: hr.employee, id: hr.employee_qdp}:
844@@ -10,6 +15,11 @@
845 parent_id: 'hr.employee_al'
846 user_id: 'base.user_demo'
847 -
848+ Give the access rights of Employee to Sign In/Sign Out in Project.
849+-
850+ !context
851+ uid: 'res_hr_timesheet_employee'
852+-
853 On "Sign In/Sign Out by Project" wizard i click on "Sign In/Sign Out" button of this wizard.
854 -
855 !python {model: hr.sign.in.project}: |
856
857=== modified file 'mrp/__openerp__.py'
858--- mrp/__openerp__.py 2013-01-31 18:41:41 +0000
859+++ mrp/__openerp__.py 2013-04-29 11:35:33 +0000
860@@ -77,9 +77,10 @@
861 #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
862 # so the ymls are too complex to change at this stage
863 'test': [
864-# 'test/order_demo.yml',
865-# 'test/order_process.yml',
866-# 'test/cancel_order.yml',
867+ 'test/mrp_users.yml',
868+ 'test/order_demo.yml',
869+ 'test/order_process.yml',
870+ 'test/cancel_order.yml',
871 ],
872 'installable': True,
873 'application': True,
874
875=== modified file 'mrp/security/ir.model.access.csv'
876--- mrp/security/ir.model.access.csv 2012-11-30 17:11:30 +0000
877+++ mrp/security/ir.model.access.csv 2013-04-29 11:35:33 +0000
878@@ -1,4 +1,5 @@
879 id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
880+access_account_analytic_line_user,account.analytic.line,account.model_account_analytic_line,group_mrp_user,1,1,1,0
881 access_mrp_workcenter,mrp.workcenter,model_mrp_workcenter,mrp.group_mrp_user,1,0,0,0
882 access_mrp_routing,mrp.routing,model_mrp_routing,mrp.group_mrp_user,1,0,0,0
883 access_mrp_routing_workcenter,mrp.routing.workcenter,model_mrp_routing_workcenter,mrp.group_mrp_user,1,0,0,0
884
885=== modified file 'mrp/security/mrp_security.xml'
886--- mrp/security/mrp_security.xml 2012-07-13 17:08:38 +0000
887+++ mrp/security/mrp_security.xml 2013-04-29 11:35:33 +0000
888@@ -4,6 +4,7 @@
889
890 <record id="group_mrp_user" model="res.groups">
891 <field name="name">User</field>
892+ <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
893 <field name="category_id" ref="base.module_category_manufacturing"/>
894 </record>
895 <record id="group_mrp_manager" model="res.groups">
896
897=== modified file 'mrp/test/cancel_order.yml'
898--- mrp/test/cancel_order.yml 2012-11-29 22:26:45 +0000
899+++ mrp/test/cancel_order.yml 2013-04-29 11:35:33 +0000
900@@ -1,4 +1,9 @@
901 -
902+ MRP user can cancelled Production Order, so let's check data with giving the access rights of user.
903+-
904+ !context
905+ uid: 'res_users_mrp_user'
906+-
907 I first confirm order for PC Assemble SC349.
908 -
909 !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_test1}
910
911=== added file 'mrp/test/mrp_users.yml'
912--- mrp/test/mrp_users.yml 1970-01-01 00:00:00 +0000
913+++ mrp/test/mrp_users.yml 2013-04-29 11:35:33 +0000
914@@ -0,0 +1,24 @@
915+-
916+ Create a user as 'MRP Manager'
917+-
918+ !context
919+ default_groups_ref: [mrp.group_mrp_manager]
920+-
921+ !record {model: res.users, id: res_users_mrp_manager}:
922+ company_id: base.main_company
923+ name: MRP Manager
924+ login: mam
925+ password: mam
926+ email: mrp_manager@yourcompany.com
927+-
928+ Create a user as 'MRP User'
929+-
930+ !context
931+ default_groups_ref: [mrp.group_mrp_user]
932+-
933+ !record {model: res.users, id: res_users_mrp_user}:
934+ company_id: base.main_company
935+ name: MRP User
936+ login: mau
937+ password: mau
938+ email: mrp_user@yourcompany.com
939
940=== modified file 'mrp/test/order_demo.yml'
941--- mrp/test/order_demo.yml 2012-11-29 22:26:45 +0000
942+++ mrp/test/order_demo.yml 2013-04-29 11:35:33 +0000
943@@ -1,4 +1,9 @@
944 -
945+ MRP user can create Production Order, so let's check data with giving the access rights of user.
946+-
947+ !context
948+ uid: 'res_users_mrp_user'
949+-
950 I create Production Order of PC Assemble SC349 to produce 5.0 Unit.
951 -
952 !record {model: mrp.production, id: mrp_production_test1}:
953
954=== modified file 'mrp/test/order_process.yml'
955--- mrp/test/order_process.yml 2013-02-22 13:35:11 +0000
956+++ mrp/test/order_process.yml 2013-04-29 11:35:33 +0000
957@@ -1,4 +1,9 @@
958 -
959+ MRP user can doing all process related to Production Order, so let's check data with giving the access rights of user.
960+-
961+ !context
962+ uid: 'res_users_mrp_user'
963+-
964 I compute the production order.
965 -
966 !python {model: mrp.production}: |
967@@ -23,6 +28,7 @@
968 I confirm the Production Order.
969 -
970 !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_test1}
971+
972 -
973 I check details of Produce Move of Production Order to trace Final Product.
974 -
975@@ -59,6 +65,16 @@
976 assert move_line.location_id.id == routing_loc or order.location_src_id.id, "Source location is not correspond in 'To consume line'."
977 assert move_line.location_dest_id.id == source_location_id, "Destination Location is not correspond in 'To consume line'."
978 -
979+ I consume raw materials and put one material in scrap location due to waste it.
980+-
981+ !python {model: mrp.production}: |
982+ scrap_location_ids = self.pool.get('stock.location').search(cr, uid, [('scrap_location','=',True)])
983+ scrap_location_id = scrap_location_ids[0]
984+ order = self.browse(cr, uid, ref("mrp_production_test1"))
985+ for move in order.move_lines:
986+ if move.product_id.id == ref("product.product_product_6"):
987+ move.action_scrap(5.0, scrap_location_id)
988+-
989 I check details of an Internal Shipment after confirmed production order to bring components in Raw Materials Location.
990 -
991 !python {model: mrp.production}: |
992@@ -150,17 +166,6 @@
993 order = self.browse(cr, uid, ref("mrp_production_test1"))
994 assert order.state == 'in_production', 'Production order should be in production State.'
995 -
996- I consume raw materials and put one material in scrap location due to waste it.
997--
998- !python {model: mrp.production}: |
999- scrap_location_ids = self.pool.get('stock.location').search(cr, uid, [('scrap_location','=',True)])
1000- scrap_location_id = scrap_location_ids[0]
1001- order = self.browse(cr, uid, ref("mrp_production_test1"))
1002- for move in order.move_lines:
1003- move.action_consume(move.product_qty)
1004- if move.product_id.id == ref("product.product_product_6"):
1005- move.action_scrap(5.0, scrap_location_id)
1006--
1007 I produce product.
1008 -
1009 !python {model: mrp.product.produce}: |
1010
1011=== modified file 'mrp_operations/__openerp__.py'
1012--- mrp_operations/__openerp__.py 2012-11-29 22:26:45 +0000
1013+++ mrp_operations/__openerp__.py 2013-04-29 11:35:33 +0000
1014@@ -70,7 +70,7 @@
1015 'mrp_operations_demo.yml'
1016 ],
1017 'test': [
1018-# 'test/workcenter_operations.yml',
1019+ 'test/workcenter_operations.yml',
1020 ],
1021 'installable': True,
1022 'auto_install': False,
1023
1024=== modified file 'mrp_operations/test/workcenter_operations.yml'
1025--- mrp_operations/test/workcenter_operations.yml 2013-02-13 08:35:19 +0000
1026+++ mrp_operations/test/workcenter_operations.yml 2013-04-29 11:35:33 +0000
1027@@ -1,6 +1,21 @@
1028 -
1029+ Create a user as 'MRP User'
1030+-
1031+ !context
1032+ default_groups_ref: [mrp.group_mrp_user]
1033+-
1034+ !record {model: res.users, id: res_mrp_operation_user}:
1035+ company_id: base.main_company
1036+ name: MRP User
1037+ login: maou
1038+ password: maou
1039+ email: mrp_operation_user@yourcompany.com
1040+-
1041 In order to test mrp_operations with OpenERP, I refer created production order of PC Assemble SC349
1042- with routing - Manual Component's Assembly to test complete production process with respect of workcenter.
1043+ with routing - Manual Component's Assembly to test complete production process with respect of workcenter with giving access rights of MRP User.
1044+-
1045+ !context
1046+ uid: 'res_mrp_operation_user'
1047 -
1048 I compute the production order.
1049 -
1050@@ -92,7 +107,7 @@
1051 I print a Barcode Report of Operation line.
1052 -
1053 !python {model: mrp_operations.operation.code}: |
1054- import netsvc, tools, os
1055+ from openerp import netsvc, tools
1056 (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')], {}, {})
1057 if tools.config['test_report_directory']:
1058 file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-barcode_report.'+format), 'wb+').write(data)
1059@@ -101,7 +116,7 @@
1060 I print Workcenter's Barcode Report.
1061 -
1062 !python {model: mrp.workcenter}: |
1063- import netsvc, tools, os
1064+ from openerp import netsvc, tools
1065 (data, format) = netsvc.LocalService('report.mrp.wc.barcode').create(cr, uid, [ref('mrp.mrp_workcenter_0'),ref('mrp.mrp_workcenter_1')], {}, {})
1066 if tools.config['test_report_directory']:
1067 file(os.path.join(tools.config['test_report_directory'], 'mrp_operations-workcenter_barcode_report.'+format), 'wb+').write(data)
1068
1069=== modified file 'mrp_repair/__openerp__.py'
1070--- mrp_repair/__openerp__.py 2012-11-29 22:26:45 +0000
1071+++ mrp_repair/__openerp__.py 2013-04-29 11:35:33 +0000
1072@@ -52,7 +52,8 @@
1073 'mrp_repair_report.xml',
1074 ],
1075 'demo': ['mrp_repair_demo.yml'],
1076- 'test': ['test/test_mrp_repair_noneinv.yml',
1077+ 'test': ['test/mrp_repair_users.yml',
1078+ 'test/test_mrp_repair_noneinv.yml',
1079 'test/test_mrp_repair_b4inv.yml',
1080 'test/test_mrp_repair_afterinv.yml',
1081 'test/test_mrp_repair_cancel.yml',
1082
1083=== added file 'mrp_repair/test/mrp_repair_users.yml'
1084--- mrp_repair/test/mrp_repair_users.yml 1970-01-01 00:00:00 +0000
1085+++ mrp_repair/test/mrp_repair_users.yml 2013-04-29 11:35:33 +0000
1086@@ -0,0 +1,24 @@
1087+-
1088+ Create a user as 'MRP Repair Manager'
1089+-
1090+ !context
1091+ default_groups_ref: [mrp.group_mrp_manager]
1092+-
1093+ !record {model: res.users, id: res_mrp_repair_manager}:
1094+ company_id: base.main_company
1095+ name: MRP Manager
1096+ login: marm
1097+ password: marm
1098+ email: mrp_repair_manager@yourcompany.com
1099+-
1100+ Create a user as 'MRP Repair User'
1101+-
1102+ !context
1103+ default_groups_ref: [mrp.group_mrp_user]
1104+-
1105+ !record {model: res.users, id: res_mrp_repair_user}:
1106+ company_id: base.main_company
1107+ name: MRP User
1108+ login: maru
1109+ password: maru
1110+ email: mrp_repair_user@yourcompany.com
1111
1112=== modified file 'mrp_repair/test/test_mrp_repair_afterinv.yml'
1113--- mrp_repair/test/test_mrp_repair_afterinv.yml 2013-03-21 13:18:24 +0000
1114+++ mrp_repair/test/test_mrp_repair_afterinv.yml 2013-04-29 11:35:33 +0000
1115@@ -1,5 +1,8 @@
1116 -
1117- In order to test Invoice Method 'After Repair'.
1118+ In order to test Invoice Method 'After Repair' with giving the access rights of mrp user.
1119+-
1120+ !context
1121+ uid: 'res_mrp_repair_user'
1122 -
1123 I confirm Repair order taking Invoice Method 'After Repair'.
1124 -
1125
1126=== modified file 'mrp_repair/test/test_mrp_repair_b4inv.yml'
1127--- mrp_repair/test/test_mrp_repair_b4inv.yml 2013-03-21 13:18:24 +0000
1128+++ mrp_repair/test/test_mrp_repair_b4inv.yml 2013-04-29 11:35:33 +0000
1129@@ -1,5 +1,8 @@
1130 -
1131- Now I test for Invoice Method 'Before Repair'.
1132+ Now I test for Invoice Method 'Before Repair' with giving the access rights of mrp user.
1133+-
1134+ !context
1135+ uid: 'res_mrp_repair_user'
1136 -
1137 I confirm Repair order for Invoice Method 'Before Repair'.
1138 -
1139
1140=== modified file 'mrp_repair/test/test_mrp_repair_cancel.yml'
1141--- mrp_repair/test/test_mrp_repair_cancel.yml 2012-11-29 22:26:45 +0000
1142+++ mrp_repair/test/test_mrp_repair_cancel.yml 2013-04-29 11:35:33 +0000
1143@@ -1,6 +1,9 @@
1144 -
1145 In order to test the cancel flow of mrp_repair module,
1146- I start by creating new copy Repair order for "PC Assemble SC234" product.
1147+ I start by creating new copy Repair order for "PC Assemble SC234" product with giving access rights of mrp user.
1148+-
1149+ !context
1150+ uid: 'res_mrp_repair_user'
1151 -
1152 !python {model: mrp.repair}: |
1153 copy_id = self.copy(cr, uid, ref("mrp_repair_rmrp1"))
1154
1155=== modified file 'mrp_repair/test/test_mrp_repair_noneinv.yml'
1156--- mrp_repair/test/test_mrp_repair_noneinv.yml 2013-03-21 13:18:24 +0000
1157+++ mrp_repair/test/test_mrp_repair_noneinv.yml 2013-04-29 11:35:33 +0000
1158@@ -1,5 +1,8 @@
1159 -
1160- In order to test "mrp_repair" module, I start with confirm state, and start repair.
1161+ In order to test "mrp_repair" module, I start with confirm state, and start repair with giving the access rights of mrp user.
1162+-
1163+ !context
1164+ uid: 'res_mrp_repair_user'
1165 -
1166 I confirm Repair order for Invoice Method 'No Invoice'.
1167 -
1168
1169=== modified file 'project/__openerp__.py'
1170--- project/__openerp__.py 2013-01-31 18:41:41 +0000
1171+++ project/__openerp__.py 2013-04-29 11:35:33 +0000
1172@@ -79,6 +79,7 @@
1173 ],
1174 'demo': ['project_demo.xml'],
1175 'test': [
1176+ 'test/project_users.yml',
1177 'test/project_demo.yml',
1178 'test/project_process.yml',
1179 'test/task_process.yml',
1180
1181=== modified file 'project/security/ir.model.access.csv'
1182--- project/security/ir.model.access.csv 2013-02-05 07:00:36 +0000
1183+++ project/security/ir.model.access.csv 2013-04-29 11:35:33 +0000
1184@@ -19,6 +19,7 @@
1185 access_project_task_history_cumulative,project.task.history project,project.model_project_task_history_cumulative,project.group_project_manager,1,0,0,0
1186 access_project_task_history_cumulative,project.task.history project,project.model_project_task_history_cumulative,project.group_project_user,1,0,0,0
1187 access_resource_calendar,project.resource_calendar manager,resource.model_resource_calendar,project.group_project_manager,1,0,0,0
1188+access_resource_calendar_leaves,project.resource_calendar_leaves manager,resource.model_resource_calendar_leaves,project.group_project_manager,1,0,0,0
1189 access_project_category,project.project_category,model_project_category,,1,0,0,0
1190 access_project_category_manager,project.project_category,model_project_category,project.group_project_manager,1,1,1,1
1191 access_mail_alias,mail.alias,mail.model_mail_alias,project.group_project_manager,1,1,1,1
1192
1193=== modified file 'project/security/project_security.xml'
1194--- project/security/project_security.xml 2013-04-12 14:37:19 +0000
1195+++ project/security/project_security.xml 2013-04-29 11:35:33 +0000
1196@@ -4,6 +4,7 @@
1197
1198 <record id="group_project_user" model="res.groups">
1199 <field name="name">User</field>
1200+ <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
1201 <field name="category_id" ref="base.module_category_project_management"/>
1202 </record>
1203
1204
1205=== modified file 'project/test/project_demo.yml'
1206--- project/test/project_demo.yml 2012-11-29 22:26:45 +0000
1207+++ project/test/project_demo.yml 2013-04-29 11:35:33 +0000
1208@@ -1,12 +1,23 @@
1209 -
1210+ I Update project and create the new task with project manager
1211+-
1212+ !context
1213+ uid: 'res_users_project_manager'
1214+-
1215+ Change partner for The Jackson Group's Project
1216+-
1217 !record {model: project.project, id: project_project_1, view: False}:
1218 partner_id: base.res_partner_2
1219 -
1220- !record {model: project.task, id: project_task_1, view: False}:
1221+ I create task for The Jackson Group's Project project user can create task.
1222+-
1223+ !context
1224+ uid: 'res_users_project_user'
1225+-
1226+ !record {model: project.task, id: project_task_for_project1}:
1227+ name: Worked on new specification
1228+ user_id: res_users_project_user
1229 remaining_hours: 10.00
1230--
1231- !record {model: project.task, id: project_task_1, view: False}:
1232 planned_hours: 10.00
1233--
1234- !record {model: project.task, id: project_task_1, view: False}:
1235- project_id: project_project_1
1236\ No newline at end of file
1237+ project_id: project_project_1
1238+ stage_id: project_tt_specification
1239\ No newline at end of file
1240
1241=== modified file 'project/test/project_process.yml'
1242--- project/test/project_process.yml 2012-11-29 22:26:45 +0000
1243+++ project/test/project_process.yml 2013-04-29 11:35:33 +0000
1244@@ -1,4 +1,9 @@
1245 -
1246+ Test the whole project process with project manager.
1247+-
1248+ !context
1249+ uid: 'res_users_project_manager'
1250+-
1251 In order to Test Process of Project Management,
1252 -
1253 I create duplicate template.
1254
1255=== added file 'project/test/project_users.yml'
1256--- project/test/project_users.yml 1970-01-01 00:00:00 +0000
1257+++ project/test/project_users.yml 2013-04-29 11:35:33 +0000
1258@@ -0,0 +1,24 @@
1259+-
1260+ Create a user as 'Project manager'
1261+-
1262+ !context
1263+ default_groups_ref: ['project.group_project_manager']
1264+-
1265+ !record {model: res.users, id: res_users_project_manager}:
1266+ company_id: base.main_company
1267+ name: Project Manager
1268+ login: prm
1269+ password: prm
1270+ email: projectmanager@yourcompany.com
1271+-
1272+ Create a user as 'Project user'
1273+-
1274+ !context
1275+ default_groups_ref: ['project.group_project_user']
1276+-
1277+ !record {model: res.users, id: res_users_project_user}:
1278+ company_id: base.main_company
1279+ name: Project User
1280+ login: pru
1281+ password: pru
1282+ email: projectuser@yourcompany.com
1283
1284=== modified file 'project/test/task_process.yml'
1285--- project/test/task_process.yml 2012-11-29 22:26:45 +0000
1286+++ project/test/task_process.yml 2013-04-29 11:35:33 +0000
1287@@ -1,46 +1,51 @@
1288 -
1289+ Test the whole task process with project user.
1290+-
1291+ !context
1292+ uid: 'res_users_project_user'
1293+-
1294 I put task in pending due to specification is not clear.
1295 -
1296 !python {model: project.task}: |
1297- self.do_pending(cr, uid, [ref("project_task_1")])
1298- context.update({"active_id": ref("project_task_1")})
1299+ self.do_pending(cr, uid, [ref("project_task_for_project1")])
1300+ context.update({"active_id": ref("project_task_for_project1")})
1301 -
1302 I check state of task after put in pending.
1303 -
1304- !assert {model: project.task, id: project_task_1, severity: error, string: task should be in pending state}:
1305+ !assert {model: project.task, id: project_task_for_project1, severity: error, string: task should be in pending state}:
1306 - state == "pending"
1307 -
1308 !record {model: project.task.delegate, id: delegate_id}:
1309- user_id: base.user_demo
1310+ user_id: res_users_project_user
1311 planned_hours: 12.0
1312 planned_hours_me: 2.0
1313 -
1314 Now I delegate task to team member.
1315 -
1316 !python {model: project.task.delegate}: |
1317- self.delegate(cr, uid, [ref("delegate_id")], {"active_id": ref("project_task_1")})
1318+ self.delegate(cr, uid, [ref("delegate_id")], {"active_id": ref("project_task_for_project1")})
1319 -
1320 I check delegated task details.
1321 -
1322 !python {model: project.task}: |
1323- task = self.browse(cr, uid, ref("project_task_1"), context=context)
1324+ task = self.browse(cr, uid, ref("project_task_for_project1"), context=context)
1325 assert task.planned_hours == 2.0, "Planning hours is not correct after delegated."
1326 assert task.state == "pending", "Task should be in Pending after delegated."
1327 -
1328 I re-open the task.
1329 -
1330 !python {model: project.task}: |
1331- self.do_reopen(cr, uid, [ref("project_task_1")])
1332+ self.do_reopen(cr, uid, [ref("project_task_for_project1")])
1333 -
1334 I check reopened task details.
1335 -
1336- !assert {model: project.task, id: project_task_1, severity: error, string: task should be open.}:
1337+ !assert {model: project.task, id: project_task_for_project1, severity: error, string: task should be open.}:
1338 - state == "open"
1339 -
1340 I change the stage of task to next stage.
1341 -
1342 !python {model: project.task}: |
1343- self.stage_next(cr, uid, [ref("project_task_1")])
1344+ self.stage_next(cr, uid, [ref("project_task_for_project1")])
1345 -
1346 !record {model: project.task.reevaluate, id: reevaluate_id}:
1347 remaining_hours : 120
1348@@ -48,29 +53,29 @@
1349 I reevaluate task with remaining hours.
1350 -
1351 !python {model: project.task.reevaluate}: |
1352- self.compute_hours(cr, uid, [ref("reevaluate_id")], {"active_id": ref("project_task_1")})
1353+ self.compute_hours(cr, uid, [ref("reevaluate_id")], {"active_id": ref("project_task_for_project1")})
1354 -
1355 I check remaining hours after reevaluated task.
1356 -
1357- !assert {model: project.task, id: project_task_1, severity: error, string: task should be reevaluated}:
1358+ !assert {model: project.task, id: project_task_for_project1, severity: error, string: task should be reevaluated}:
1359 - remaining_hours == 120.0
1360 -
1361 I close the task.
1362 -
1363 !python {model: project.task}: |
1364- self.action_close(cr, uid, [ref("project_task_1")])
1365+ self.action_close(cr, uid, [ref("project_task_for_project1")])
1366 -
1367 I check state after closed.
1368 -
1369- !assert {model: project.task, id: project_task_1, severity: error, string: task is in open state}:
1370+ !assert {model: project.task, id: project_task_for_project1, severity: error, string: task is in open state}:
1371 - state == "done"
1372 -
1373 I change the stage of task to previous stage.
1374 -
1375 !python {model: project.task}: |
1376- self.stage_previous(cr, uid, [ref("project_task_1")])
1377+ self.stage_previous(cr, uid, [ref("project_task_for_project1")])
1378 -
1379 I cancel Task.
1380 -
1381 !python {model: project.task}: |
1382- self.do_cancel(cr, uid, [ref("project_task_2")])
1383+ self.do_cancel(cr, uid, [ref("project_task_for_project1")])
1384
1385=== modified file 'project_issue/__openerp__.py'
1386--- project_issue/__openerp__.py 2012-11-29 22:26:45 +0000
1387+++ project_issue/__openerp__.py 2013-04-29 11:35:33 +0000
1388@@ -53,6 +53,7 @@
1389 ],
1390 'demo': ['project_issue_demo.xml'],
1391 'test': [
1392+ 'test/issue_users.yml',
1393 'test/subscribe_issue.yml',
1394 'test/issue_process.yml',
1395 'test/cancel_issue.yml',
1396
1397=== modified file 'project_issue/test/cancel_issue.yml'
1398--- project_issue/test/cancel_issue.yml 2012-12-21 12:17:53 +0000
1399+++ project_issue/test/cancel_issue.yml 2013-04-29 11:35:33 +0000
1400@@ -1,4 +1,9 @@
1401 -
1402+ Project user can cancelled issue, so let's check data with giving the access rights of user.
1403+-
1404+ !context
1405+ uid: 'res_users_project_issue_user'
1406+-
1407 In order to test process of issue tracking in OpenERP, I cancel the unqualified Issue.
1408 -
1409 !python {model: project.issue}: |
1410
1411=== modified file 'project_issue/test/issue_demo.yml'
1412--- project_issue/test/issue_demo.yml 2012-11-29 22:26:45 +0000
1413+++ project_issue/test/issue_demo.yml 2013-04-29 11:35:33 +0000
1414@@ -1,7 +1,8 @@
1415 -
1416- !record {model: project.issue, id: project_task_1, view: False}:
1417- task_id: 'project.project_task_17'
1418- name: 'Error in account module'
1419+ Test the whole create project issue with project user.
1420+-
1421+ !context
1422+ uid: 'res_users_project_issue_user'
1423 -
1424 !record {model: project.issue, id: project01, view: False}:
1425 project_id: 'project.project_project_2'
1426
1427=== modified file 'project_issue/test/issue_process.yml'
1428--- project_issue/test/issue_process.yml 2012-11-29 22:26:45 +0000
1429+++ project_issue/test/issue_process.yml 2013-04-29 11:35:33 +0000
1430@@ -1,4 +1,9 @@
1431 -
1432+ Project user can subscribe issue, so let's check data with giving the access rights of user.
1433+-
1434+ !context
1435+ uid: 'res_users_project_issue_user'
1436+-
1437 In order to test process of issue tracking in OpenERP, I Open the Issue.
1438 -
1439 !python {model: project.issue}: |
1440@@ -41,11 +46,21 @@
1441 !assert {model: project.issue, id: crm_case_buginaccountsmodule0, severity: error, string: Issue should be in open state}:
1442 - state == 'open'
1443 -
1444+ Only project manager can create Task for Issue, so let's check data with giving the access rights of manager.
1445+-
1446+ !context
1447+ uid: 'res_users_project_issue_manager'
1448+-
1449 I create Task for Issue.
1450 -
1451 !python {model: project.issue}: |
1452 self.convert_issue_task(cr, uid, [ref("crm_case_buginaccountsmodule0")])
1453 -
1454+ After resolving Issue Project user can close issue, so let's check data with giving the access rights of user.
1455+-
1456+ !context
1457+ uid: 'res_users_project_issue_user'
1458+-
1459 I close Issue after resolving it
1460 -
1461 !python {model: project.issue}: |
1462
1463=== added file 'project_issue/test/issue_users.yml'
1464--- project_issue/test/issue_users.yml 1970-01-01 00:00:00 +0000
1465+++ project_issue/test/issue_users.yml 2013-04-29 11:35:33 +0000
1466@@ -0,0 +1,24 @@
1467+-
1468+ Create a user as 'Project manager'
1469+-
1470+ !context
1471+ default_groups_ref: ['project.group_project_manager']
1472+-
1473+ !record {model: res.users, id: res_users_project_issue_manager}:
1474+ company_id: base.main_company
1475+ name: Project Manager
1476+ login: prim
1477+ password: prim
1478+ email: issuemanager@yourcompany.com
1479+-
1480+ Create a user as 'Project user'
1481+-
1482+ !context
1483+ default_groups_ref: ['project.group_project_user']
1484+-
1485+ !record {model: res.users, id: res_users_project_issue_user}:
1486+ company_id: base.main_company
1487+ name: Project User
1488+ login: priu
1489+ password: priu
1490+ email: issueuser@yourcompany.com
1491
1492=== modified file 'project_issue/test/subscribe_issue.yml'
1493--- project_issue/test/subscribe_issue.yml 2013-04-17 06:40:51 +0000
1494+++ project_issue/test/subscribe_issue.yml 2013-04-29 11:35:33 +0000
1495@@ -1,5 +1,5 @@
1496 -
1497- In Order to test process of Issue in OpenERP, Custmer send the issue by email.
1498+ In Order to test process of Issue in OpenERP, Customer send the issue by email.
1499 -
1500 !python {model: mail.thread}: |
1501 request_file = open(openerp.modules.module.get_module_resource('project_issue','test', 'issue.eml'),'rb')
1502
1503=== modified file 'purchase/__openerp__.py'
1504--- purchase/__openerp__.py 2012-11-29 22:26:45 +0000
1505+++ purchase/__openerp__.py 2013-04-29 11:35:33 +0000
1506@@ -79,6 +79,7 @@
1507 'test/ui/delete_order.yml',
1508 ],
1509 'demo': [
1510+ 'test/ui/purchase_users.yml',
1511 'purchase_order_demo.yml',
1512 'purchase_demo.xml',
1513 ],
1514
1515=== modified file 'purchase/purchase_order_demo.yml'
1516--- purchase/purchase_order_demo.yml 2012-11-29 22:26:45 +0000
1517+++ purchase/purchase_order_demo.yml 2013-04-29 11:35:33 +0000
1518@@ -1,4 +1,9 @@
1519 -
1520+ Give access rights of Purchase user to create purchase order
1521+-
1522+ !context
1523+ uid: 'res_users_purchase_user'
1524+-
1525 !record {model: purchase.order, id: purchase_order_1}:
1526 partner_id: base.res_partner_1
1527 invoice_method: order
1528
1529=== modified file 'purchase/test/process/cancel_order.yml'
1530--- purchase/test/process/cancel_order.yml 2012-12-06 10:06:12 +0000
1531+++ purchase/test/process/cancel_order.yml 2013-04-29 11:35:33 +0000
1532@@ -1,4 +1,9 @@
1533 -
1534+ Purchase user can also cancel order therfore test with that user which have Purchase user rights.
1535+-
1536+ !context
1537+ uid: 'res_users_purchase_user'
1538+-
1539 In order to test the cancel flow, I start it from canceling confirmed purchase order.
1540 -
1541 I confirm the purchase order.
1542
1543=== modified file 'purchase/test/process/generate_invoice_from_reception.yml'
1544--- purchase/test/process/generate_invoice_from_reception.yml 2012-11-29 22:26:45 +0000
1545+++ purchase/test/process/generate_invoice_from_reception.yml 2013-04-29 11:35:33 +0000
1546@@ -1,4 +1,9 @@
1547 -
1548+ Purchase user can create an invoice for order on receptions therfore test with that user which have Purchase user rights.
1549+-
1550+ !context
1551+ uid: 'res_users_purchase_user'
1552+-
1553 I confirm another order where invoice control is 'Bases on incoming shipments'.
1554 -
1555 !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_2}
1556
1557=== modified file 'purchase/test/process/invoice_on_poline.yml'
1558--- purchase/test/process/invoice_on_poline.yml 2012-11-29 22:26:45 +0000
1559+++ purchase/test/process/invoice_on_poline.yml 2013-04-29 11:35:33 +0000
1560@@ -1,4 +1,9 @@
1561 -
1562+ Purchase User confirm the order and create invoice based on purchase order line.
1563+-
1564+ !context
1565+ uid: 'res_users_purchase_user'
1566+-
1567 I confirm purchase order which has invoicing control method "Based on Purchase Order Lines".
1568 -
1569 !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_6}
1570@@ -17,10 +22,4 @@
1571 !python {model: purchase.order}: |
1572 purchase_order = self.browse(cr, uid, ref("purchase_order_6"))
1573 for purchase_line in purchase_order.order_line:
1574- assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated."
1575--
1576- I set the default invoicing control method "Based on Purchase Order Lines".
1577--
1578- !python {model: purchase.config.settings}: |
1579- new_id = self.create(cr, uid, {'default_invoice_method': 'manual'})
1580- self.execute(cr, uid, [new_id])
1581+ assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated."
1582\ No newline at end of file
1583
1584=== modified file 'purchase/test/process/merge_order.yml'
1585--- purchase/test/process/merge_order.yml 2013-02-18 08:01:09 +0000
1586+++ purchase/test/process/merge_order.yml 2013-04-29 11:35:33 +0000
1587@@ -1,4 +1,9 @@
1588 -
1589+ Give access rights of Purchase user to merge two RFQ.
1590+-
1591+ !context
1592+ uid: 'res_users_purchase_user'
1593+-
1594 In order to merge RFQ, I merge two RFQ which has same supplier and check new merged order.
1595 -
1596 !python {model: purchase.order}: |
1597
1598=== modified file 'purchase/test/ui/delete_order.yml'
1599--- purchase/test/ui/delete_order.yml 2012-11-29 22:26:45 +0000
1600+++ purchase/test/ui/delete_order.yml 2013-04-29 11:35:33 +0000
1601@@ -1,4 +1,9 @@
1602 -
1603+ Give access rights of Purchase user to delete purchase order
1604+-
1605+ !context
1606+ uid: 'res_users_purchase_user'
1607+-
1608 In order to test to delete process on purchase order.
1609 -
1610 I try to delete confirmed order and check Error Message.
1611
1612=== added file 'purchase/test/ui/purchase_users.yml'
1613--- purchase/test/ui/purchase_users.yml 1970-01-01 00:00:00 +0000
1614+++ purchase/test/ui/purchase_users.yml 2013-04-29 11:35:33 +0000
1615@@ -0,0 +1,24 @@
1616+-
1617+ Create a user as 'Purchase manager'
1618+-
1619+ !context
1620+ default_groups_ref: ['purchase.group_purchase_manager']
1621+-
1622+ !record {model: res.users, id: res_users_purchase_manager}:
1623+ company_id: base.main_company
1624+ name: Purchase Manager
1625+ login: pm
1626+ password: pm
1627+ email: purchasemanager@yourcompany.com
1628+-
1629+ Create a user as 'Purchase user'
1630+-
1631+ !context
1632+ default_groups_ref: ['purchase.group_purchase_user']
1633+-
1634+ !record {model: res.users, id: res_users_purchase_user}:
1635+ company_id: base.main_company
1636+ name: Purchase User
1637+ login: pu
1638+ password: pu
1639+ email: purchaseuser@yourcompany.com
1640
1641=== modified file 'purchase_requisition/__openerp__.py'
1642--- purchase_requisition/__openerp__.py 2012-11-29 22:26:45 +0000
1643+++ purchase_requisition/__openerp__.py 2013-04-29 11:35:33 +0000
1644@@ -43,6 +43,7 @@
1645 ],
1646 'auto_install': False,
1647 'test': [
1648+ 'test/purchase_requisition_users.yml',
1649 'test/purchase_requisition_demo.yml',
1650 'test/purchase_requisition.yml',
1651 'test/cancel_purchase_requisition.yml',
1652
1653=== modified file 'purchase_requisition/security/purchase_tender.xml'
1654--- purchase_requisition/security/purchase_tender.xml 2012-07-13 17:08:38 +0000
1655+++ purchase_requisition/security/purchase_tender.xml 2013-04-29 11:35:33 +0000
1656@@ -10,6 +10,7 @@
1657
1658 <record id="group_purchase_requisition_user" model="res.groups">
1659 <field name="name">User</field>
1660+ <field name="implied_ids" eval="[(4, ref('purchase.group_purchase_user'))]"/>
1661 <field name="category_id" ref="module_category_purchase_requisition"/>
1662 </record>
1663
1664
1665=== modified file 'purchase_requisition/test/cancel_purchase_requisition.yml'
1666--- purchase_requisition/test/cancel_purchase_requisition.yml 2011-12-02 05:15:06 +0000
1667+++ purchase_requisition/test/cancel_purchase_requisition.yml 2013-04-29 11:35:33 +0000
1668@@ -1,4 +1,9 @@
1669 -
1670+ Give access rights of Purchase Requisition User to cancelled requisition
1671+-
1672+ !context
1673+ uid: 'res_users_purchase_requisition_user'
1674+-
1675 I cancel requisition.
1676 -
1677 !python {model: purchase.requisition}: |
1678
1679=== modified file 'purchase_requisition/test/purchase_requisition.yml'
1680--- purchase_requisition/test/purchase_requisition.yml 2013-03-22 13:49:58 +0000
1681+++ purchase_requisition/test/purchase_requisition.yml 2013-04-29 11:35:33 +0000
1682@@ -31,6 +31,11 @@
1683 assert line.product_uom_id.id == procurement.product_uom.id, "UOM is not correspond."
1684 assert line.product_qty == procurement.product_qty, "Quantity is not correspond."
1685 -
1686+ Give access rights of Purchase Requisition User to open requisition
1687+-
1688+ !context
1689+ uid: 'res_users_purchase_requisition_user'
1690+-
1691 I open another requisition.
1692 -
1693 !python {model: purchase.requisition}: |
1694
1695=== modified file 'purchase_requisition/test/purchase_requisition_demo.yml'
1696--- purchase_requisition/test/purchase_requisition_demo.yml 2012-11-29 22:26:45 +0000
1697+++ purchase_requisition/test/purchase_requisition_demo.yml 2013-04-29 11:35:33 +0000
1698@@ -1,4 +1,9 @@
1699 -
1700+ Give access rights of Purchase Requisition User to create requisition
1701+-
1702+ !context
1703+ uid: 'res_users_purchase_requisition_user'
1704+-
1705 In order to test process of the purchase requisition ,I create requisition
1706 -
1707 !record {model: purchase.requisition, id: requisition1}:
1708
1709=== added file 'purchase_requisition/test/purchase_requisition_users.yml'
1710--- purchase_requisition/test/purchase_requisition_users.yml 1970-01-01 00:00:00 +0000
1711+++ purchase_requisition/test/purchase_requisition_users.yml 2013-04-29 11:35:33 +0000
1712@@ -0,0 +1,24 @@
1713+-
1714+ Create a user as 'Purchase Reqisition Manager'
1715+-
1716+ !context
1717+ default_groups_ref: ['purchase_requisition.group_purchase_requisition_manager']
1718+-
1719+ !record {model: res.users, id: res_users_purchase_requisition_manager}:
1720+ company_id: base.main_company
1721+ name: Purchase requisition Manager
1722+ login: prm
1723+ password: prm
1724+ email: requisition_manager@yourcompany.com
1725+-
1726+ Create a user as 'Purchase Reqisition User'
1727+-
1728+ !context
1729+ default_groups_ref: ['purchase_requisition.group_purchase_requisition_user']
1730+-
1731+ !record {model: res.users, id: res_users_purchase_requisition_user}:
1732+ company_id: base.main_company
1733+ name: Purchase requisition User
1734+ login: pru
1735+ password: pru
1736+ email: requisition_user@yourcompany.com
1737
1738=== modified file 'sale/__openerp__.py'
1739--- sale/__openerp__.py 2012-12-19 09:49:42 +0000
1740+++ sale/__openerp__.py 2013-04-29 11:35:33 +0000
1741@@ -80,6 +80,7 @@
1742 ],
1743 'demo': ['sale_demo.xml'],
1744 'test': [
1745+ 'test/create_sale_users.yml',
1746 'test/sale_order_demo.yml',
1747 'test/manual_order_policy.yml',
1748 'test/cancel_order.yml',
1749
1750=== modified file 'sale/test/cancel_order.yml'
1751--- sale/test/cancel_order.yml 2013-02-13 08:35:19 +0000
1752+++ sale/test/cancel_order.yml 2013-04-29 11:35:33 +0000
1753@@ -1,4 +1,9 @@
1754 -
1755+ Salesman can also cancel order therefore test with that user which have salesman rights,
1756+-
1757+ !context
1758+ uid: 'res_users_salesman'
1759+-
1760 In order to test the cancel sale order.
1761 I confirm order (with at least 2 lines)
1762 -
1763
1764=== added file 'sale/test/create_sale_users.yml'
1765--- sale/test/create_sale_users.yml 1970-01-01 00:00:00 +0000
1766+++ sale/test/create_sale_users.yml 2013-04-29 11:35:33 +0000
1767@@ -0,0 +1,24 @@
1768+-
1769+ Create a user as 'Salesmanager'
1770+-
1771+ !context
1772+ default_groups_ref: ['base.group_sale_manager']
1773+-
1774+ !record {model: res.users, id: res_users_salesmanager}:
1775+ company_id: base.main_company
1776+ name: Sales manager
1777+ login: sm
1778+ password: sm
1779+ email: salesmanager@yourcompany.com
1780+-
1781+ Create a user as 'Salesman'
1782+-
1783+ !context
1784+ default_groups_ref: ['base.group_sale_salesman_all_leads']
1785+-
1786+ !record {model: res.users, id: res_users_salesman}:
1787+ company_id: base.main_company
1788+ name: Salesman
1789+ login: su
1790+ password: su
1791+ email: salesman@yourcompany.com
1792
1793=== modified file 'sale/test/delete_order.yml'
1794--- sale/test/delete_order.yml 2012-11-29 22:26:45 +0000
1795+++ sale/test/delete_order.yml 2013-04-29 11:35:33 +0000
1796@@ -1,4 +1,9 @@
1797 -
1798+ Sales manager can only delete order therefore test with that user which have sales manager rights,
1799+-
1800+ !context
1801+ uid: 'res_users_salesmanager'
1802+-
1803 I try to delete In progress order and check Error Message.
1804 -
1805 !python {model: sale.order}: |
1806
1807=== added file 'sale/test/sale_order_demo.yml'
1808--- sale/test/sale_order_demo.yml 1970-01-01 00:00:00 +0000
1809+++ sale/test/sale_order_demo.yml 2013-04-29 11:35:33 +0000
1810@@ -0,0 +1,41 @@
1811+-
1812+ Test the data with salesman,
1813+-
1814+ !context
1815+ uid: 'res_users_salesman'
1816+-
1817+ In order to test process of the Sale Order, I create sale order
1818+-
1819+ !record {model: sale.order, id: sale_order_test1}:
1820+ partner_id: base.res_partner_2
1821+ note: Invoice after delivery
1822+ payment_term: account.account_payment_term
1823+ order_line:
1824+ - product_id: product.product_product_7
1825+ product_uom_qty: 8
1826+-
1827+ I verify that the onchange was correctly triggered
1828+-
1829+ !assert {model: sale.order, id: sale.sale_order_test1, string: The onchange function of product was not correctly triggered}:
1830+ - order_line[0].name == u'[LCD17] 17\u201d LCD Monitor'
1831+ - order_line[0].price_unit == 1350.0
1832+ - order_line[0].product_uom_qty == 8
1833+ - order_line[0].product_uom.id == ref('product.product_uom_unit')
1834+
1835+-
1836+ I create another sale order
1837+-
1838+ !record {model: sale.order, id: sale_order_test2}:
1839+ partner_id: base.res_partner_2
1840+ order_line:
1841+ - product_id: product.product_product_7
1842+ product_uom_qty: 16
1843+ product_uom: product.product_uom_dozen
1844+-
1845+ I verify that the onchange was correctly triggered
1846+-
1847+ !assert {model: sale.order, id: sale.sale_order_test2, string: The onchange function of product was not correctly triggered}:
1848+ - order_line[0].name == u'[LCD17] 17\u201d LCD Monitor'
1849+ - order_line[0].price_unit == 1350.0 * 12
1850+ - order_line[0].product_uom.id == ref('product.product_uom_dozen')
1851+ - order_line[0].product_uom_qty == 16
1852\ No newline at end of file
1853
1854=== removed file 'sale/test/sale_order_demo.yml'
1855--- sale/test/sale_order_demo.yml 2013-01-31 18:43:56 +0000
1856+++ sale/test/sale_order_demo.yml 1970-01-01 00:00:00 +0000
1857@@ -1,36 +0,0 @@
1858--
1859- In order to test process of the Sale Order, I create sale order
1860--
1861- !record {model: sale.order, id: sale_order_test1}:
1862- partner_id: base.res_partner_2
1863- note: Invoice after delivery
1864- payment_term: account.account_payment_term
1865- order_line:
1866- - product_id: product.product_product_7
1867- product_uom_qty: 8
1868--
1869- I verify that the onchange was correctly triggered
1870--
1871- !assert {model: sale.order, id: sale.sale_order_test1, string: The onchange function of product was not correctly triggered}:
1872- - order_line[0].name == u'[LCD17] 17\u201d LCD Monitor'
1873- - order_line[0].price_unit == 1350.0
1874- - order_line[0].product_uom_qty == 8
1875- - order_line[0].product_uom.id == ref('product.product_uom_unit')
1876-
1877--
1878- I create another sale order
1879--
1880- !record {model: sale.order, id: sale_order_test2}:
1881- partner_id: base.res_partner_2
1882- order_line:
1883- - product_id: product.product_product_7
1884- product_uom_qty: 16
1885- product_uom: product.product_uom_dozen
1886--
1887- I verify that the onchange was correctly triggered
1888--
1889- !assert {model: sale.order, id: sale.sale_order_test2, string: The onchange function of product was not correctly triggered}:
1890- - order_line[0].name == u'[LCD17] 17\u201d LCD Monitor'
1891- - order_line[0].price_unit == 1350.0 * 12
1892- - order_line[0].product_uom.id == ref('product.product_uom_dozen')
1893- - order_line[0].product_uom_qty == 16
1894\ No newline at end of file
1895
1896=== modified file 'sale_stock/__openerp__.py'
1897--- sale_stock/__openerp__.py 2012-11-22 09:22:14 +0000
1898+++ sale_stock/__openerp__.py 2013-04-29 11:35:33 +0000
1899@@ -59,7 +59,8 @@
1900 ],
1901 'data': ['sale_stock_data.xml'],
1902 'demo_xml': ['sale_stock_demo.xml'],
1903- 'test': ['test/cancel_order_sale_stock.yml',
1904+ 'test': ['test/sale_stock_users.yml',
1905+ 'test/cancel_order_sale_stock.yml',
1906 'test/picking_order_policy.yml',
1907 'test/prepaid_order_policy.yml',
1908 'test/sale_order_onchange.yml',
1909
1910=== modified file 'sale_stock/test/cancel_order_sale_stock.yml'
1911--- sale_stock/test/cancel_order_sale_stock.yml 2013-02-13 08:35:19 +0000
1912+++ sale_stock/test/cancel_order_sale_stock.yml 2013-04-29 11:35:33 +0000
1913@@ -1,14 +1,17 @@
1914 -
1915- In order to test the cancel sale order.
1916+ In order to test the cancel sale order with that user which have salesman rights.
1917 First I confirm order.
1918 -
1919+ !context
1920+ uid: 'res_sale_stock_salesman'
1921+-
1922 !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_8}
1923 -
1924 I send delivery in two shipments, so I am doing a partial delivery order.
1925 -
1926 !python {model: stock.picking}: |
1927 delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))])
1928- first_picking = self.browse(cr, uid, delivery_orders[0], context=context)
1929+ first_picking = self.browse(cr, uid, delivery_orders[0])
1930 if first_picking.force_assign(cr, uid, first_picking):
1931 first_move = first_picking.move_lines[0]
1932 values = {'move%s'%(first_move.id): {'product_qty': 2, 'product_uom':ref('product.product_uom_unit')}}
1933@@ -21,12 +24,22 @@
1934 last_delivery_order_id = delivery_orders[0]
1935 self.pool.get('stock.picking').signal_button_cancel(cr, uid, [last_delivery_order_id])
1936 -
1937+ Only Stock User can change data related warehouse therefore test with that user which have stcok user rights,
1938+-
1939+ !context
1940+ uid: 'res_stock_user'
1941+-
1942 I run the scheduler.
1943 -
1944 !python {model: procurement.order}: |
1945
1946 self.run_scheduler(cr, uid)
1947 -
1948+ Salesman can also check order therefore test with that user which have salesman rights,
1949+-
1950+ !context
1951+ uid: 'res_sale_stock_salesman'
1952+-
1953 I check order status in "Ship Exception".
1954 -
1955 !assert {model: sale.order, id: sale.sale_order_8, string: Sale order should be in shipping exception}:
1956
1957=== modified file 'sale_stock/test/picking_order_policy.yml'
1958--- sale_stock/test/picking_order_policy.yml 2013-04-22 15:34:49 +0000
1959+++ sale_stock/test/picking_order_policy.yml 2013-04-29 11:35:33 +0000
1960@@ -1,5 +1,8 @@
1961 -
1962- In order to test process of the Sale Order,
1963+ In order to test process of the Sale Order with access rights of saleman,
1964+-
1965+ !context
1966+ uid: 'res_sale_stock_salesman'
1967 -
1968 First I check the total amount of the Quotation before Approved.
1969 -
1970@@ -41,11 +44,21 @@
1971 assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
1972 assert procurement.procure_method == order_line.type, "Procurement method is not correspond."
1973 -
1974+ Only stock user can change data related warehouse therefore test with that user which have stock user rights,
1975+-
1976+ !context
1977+ uid: 'res_stock_user'
1978+-
1979 I run the scheduler.
1980 -
1981 !python {model: procurement.order}: |
1982 self.run_scheduler(cr, uid)
1983 -
1984+ Salesman can also check order therefore test with that user which have salesman rights,
1985+-
1986+ !context
1987+ uid: 'res_sale_stock_salesman'
1988+-
1989 I check the details of delivery order after confirmed quotation.
1990 -
1991 !python {model: sale.order}: |
1992@@ -137,6 +150,11 @@
1993 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."
1994 assert inv_line.price_subtotal == so_line.price_subtotal, "Price sub total is not correspond."
1995 -
1996+ Only Stock manager can open the Invoice therefore test with that user which have stock manager rights,
1997+-
1998+ !context
1999+ uid: 'res_stock_manager'
2000+-
2001 I open the Invoice.
2002 -
2003 !python {model: sale.order}: |
2004@@ -158,6 +176,11 @@
2005 ref('account.period_8'), journal_ids[0],
2006 name='test')
2007 -
2008+ To test process of the Sale Order with access rights of saleman,
2009+-
2010+ !context
2011+ uid: 'res_sale_stock_salesman'
2012+-
2013 I check the order after paid invoice.
2014 -
2015 !python {model: sale.order}: |
2016
2017=== modified file 'sale_stock/test/prepaid_order_policy.yml'
2018--- sale_stock/test/prepaid_order_policy.yml 2012-11-29 22:26:45 +0000
2019+++ sale_stock/test/prepaid_order_policy.yml 2013-04-29 11:35:33 +0000
2020@@ -1,5 +1,8 @@
2021 -
2022- Now I confirm the Quotation with "Pay before delivery" policy.
2023+ Now I confirm the Quotation with "Pay before delivery" policy with access rights of salesman.
2024+-
2025+ !context
2026+ uid: 'res_sale_stock_salesman'
2027 -
2028 !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_4}
2029 -
2030
2031=== modified file 'sale_stock/test/sale_order_onchange.yml'
2032--- sale_stock/test/sale_order_onchange.yml 2012-10-01 16:19:54 +0000
2033+++ sale_stock/test/sale_order_onchange.yml 2013-04-29 11:35:33 +0000
2034@@ -1,4 +1,9 @@
2035 -
2036+ Only sales manager Creates product so let's check with access rights of salemanager.
2037+-
2038+ !context
2039+ uid: 'res_sale_stock_salesmanager'
2040+-
2041 In order to test the onchange of the Sale Order, I create a product
2042 -
2043 !record {model: product.product, id: product_onchange1}:
2044@@ -6,6 +11,11 @@
2045 list_price: 66.6
2046 procure_method: 'make_to_order'
2047 -
2048+ In sale order to test process of onchange of Sale Order with access rights of saleman.
2049+-
2050+ !context
2051+ uid: 'res_sale_stock_salesman'
2052+-
2053 Now i create a sale order that uses my new product
2054 -
2055 !record {model: sale.order, id: sale_order_onchange1}:
2056
2057=== added file 'sale_stock/test/sale_stock_users.yml'
2058--- sale_stock/test/sale_stock_users.yml 1970-01-01 00:00:00 +0000
2059+++ sale_stock/test/sale_stock_users.yml 2013-04-29 11:35:33 +0000
2060@@ -0,0 +1,50 @@
2061+-
2062+ Create a user as 'Salesmanager'
2063+-
2064+ !context
2065+ default_groups_ref: ['base.group_sale_manager']
2066+-
2067+ !record {model: res.users, id: res_sale_stock_salesmanager}:
2068+ company_id: base.main_company
2069+ name: Sales manager
2070+ login: ssm
2071+ password: ssm
2072+ email: ss_salesmanager@yourcompany.com
2073+-
2074+ Create a user as 'Salesman'
2075+-
2076+ !context
2077+ default_groups_ref: ['base.group_sale_salesman_all_leads']
2078+-
2079+ !record {model: res.users, id: res_sale_stock_salesman}:
2080+ company_id: base.main_company
2081+ name: Salesman
2082+ login: ssu
2083+ password: ssu
2084+ email: ss_salesman@yourcompany.com
2085+-
2086+ Create a user as 'Stock User'
2087+-
2088+ !context
2089+ default_groups_ref: ['stock.group_stock_user']
2090+-
2091+ !record {model: res.users, id: res_stock_user}:
2092+ company_id: base.main_company
2093+ name: Stock User
2094+ login: sau
2095+ password: sau
2096+ email: stock_user@yourcompany.com
2097+
2098+-
2099+ Create a user as 'Stock Manager'
2100+-
2101+ !context
2102+ default_groups_ref: ['stock.group_stock_manager']
2103+-
2104+ !record {model: res.users, id: res_stock_manager}:
2105+ company_id: base.main_company
2106+ name: Stock Manager
2107+ login: sam
2108+ password: sam
2109+ email: admin@portal.example.com
2110+ email: stock_manager@yourcompany.com
2111
2112=== modified file 'stock/__openerp__.py'
2113--- stock/__openerp__.py 2012-12-09 10:55:27 +0000
2114+++ stock/__openerp__.py 2013-04-29 11:35:33 +0000
2115@@ -59,7 +59,6 @@
2116 'sequence': 16,
2117 'demo': [
2118 'stock_demo.xml',
2119-# 'stock_demo.yml',
2120 ],
2121 'data': [
2122 'security/stock_security.xml',
2123@@ -91,9 +90,11 @@
2124 'res_config_view.xml',
2125 ],
2126 'test': [
2127-# 'test/opening_stock.yml',
2128-# 'test/shipment.yml',
2129-# 'test/stock_report.yml',
2130+ 'test/stock_users.yml',
2131+ 'stock_demo.yml',
2132+ 'test/opening_stock.yml',
2133+ 'test/shipment.yml',
2134+ 'test/stock_report.yml',
2135 ],
2136 'installable': True,
2137 'application': True,
2138
2139=== modified file 'stock/security/stock_security.xml'
2140--- stock/security/stock_security.xml 2013-04-05 11:16:49 +0000
2141+++ stock/security/stock_security.xml 2013-04-29 11:35:33 +0000
2142@@ -10,7 +10,7 @@
2143 <record id="group_stock_manager" model="res.groups">
2144 <field name="name">Manager</field>
2145 <field name="category_id" ref="base.module_category_warehouse_management"/>
2146- <field name="implied_ids" eval="[(4, ref('group_stock_user'))]"/>
2147+ <field name="implied_ids" eval="[(4, ref('group_stock_user')), (4, ref('account.group_account_user'))]"/>
2148 <field name="users" eval="[(4, ref('base.user_root'))]"/>
2149 </record>
2150
2151
2152=== modified file 'stock/stock_demo.yml'
2153--- stock/stock_demo.yml 2012-11-29 22:26:45 +0000
2154+++ stock/stock_demo.yml 2013-04-29 11:35:33 +0000
2155@@ -1,99 +1,107 @@
2156 -
2157- !record {model: stock.location, id: location_refrigerator}:
2158- name: Refrigerator
2159- usage: internal
2160--
2161- !record {model: stock.location, id: location_delivery_counter}:
2162- name: Delivery Counter
2163- usage: internal
2164--
2165- !record {model: stock.location, id: location_refrigerator_small}:
2166- name: Small Refrigerator
2167- usage: internal
2168- location_id: location_refrigerator
2169+ Only stock manager can create location,warehouse and product, so let's check data with giving the access rights of manager
2170+-
2171+ !context
2172+ uid: 'res_users_stock_manager'
2173+-
2174+ !record {model: stock.location, id: location_monitor}:
2175+ name: chicago shop
2176+ usage: internal
2177+-
2178+ !record {model: stock.location, id: stock_location_output}:
2179+ name: Output
2180+ usage: internal
2181+-
2182+ !record {model: stock.location, id: location_monitor_small}:
2183+ name: Small chicago shop
2184+ usage: internal
2185+ location_id: location_monitor
2186 -
2187 !record {model: stock.location, id: location_opening}:
2188 name: opening
2189 usage: inventory
2190 -
2191- !record {model: stock.location, id: location_convenience_shop}:
2192- name: Convenient Store
2193+ !record {model: stock.location, id: stock_location_3}:
2194+ name: IT Suppliers
2195 usage: supplier
2196 -
2197- !record {model: stock.warehouse, id: warehouse_icecream}:
2198- name: Ice Cream Shop
2199- lot_input_id: location_refrigerator
2200- lot_stock_id: location_refrigerator
2201- lot_output_id: location_delivery_counter
2202+ !record {model: stock.warehouse, id: stock_warehouse_shop0}:
2203+ name: Chicago Warehouse
2204+ lot_input_id: location_monitor
2205+ lot_stock_id: location_monitor
2206+ lot_output_id: stock_location_output
2207 -
2208- !record {model: product.product, id: product_icecream}:
2209- default_code: 001
2210- name: Ice Cream
2211- type: product
2212- categ_id: product.product_category_1
2213- list_price: 100.0
2214- standard_price: 70.0
2215- uom_id: product.product_uom_kgm
2216- uom_po_id: product.product_uom_kgm
2217- procure_method: make_to_stock
2218+ !record {model: product.product, id: product_product_6}:
2219+ default_code: LCD15
2220+ name: 15” LCD Monitor
2221+ type: consu
2222+ categ_id: product.product_category_8
2223+ list_price: 1200.0
2224+ standard_price: 800.0
2225+ uom_id: product.product_uom_unit
2226+ uom_po_id: product.product_uom_unit
2227 property_stock_inventory: location_opening
2228 valuation: real_time
2229 cost_method: average
2230- property_stock_account_input: account.o_expense
2231- property_stock_account_output: account.o_income
2232- 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.
2233-
2234--
2235- !record {model: stock.production.lot, id: lot_icecream_0}:
2236- name: Lot0 for Ice cream
2237- product_id: product_icecream
2238--
2239- !record {model: stock.production.lot, id: lot_icecream_1}:
2240- name: Lot1 for Ice cream
2241- product_id: product_icecream
2242--
2243- !record {model: stock.inventory, id: stock_inventory_icecream}:
2244- name: Inventory for icecream
2245--
2246- !record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot0}:
2247- product_id: product_icecream
2248- product_uom: product.product_uom_kgm
2249- inventory_id: stock_inventory_icecream
2250+ property_stock_account_input: account.conf_o_income
2251+ property_stock_account_output: account.a_expense
2252+-
2253+ Stock user can handled production lot,inventory and picking, so let's check data with giving the access rights of user
2254+-
2255+ !context
2256+ uid: 'res_users_stock_user'
2257+-
2258+ !record {model: stock.production.lot, id: lot_monitor_0}:
2259+ name: Lot0 for LCD Monitor
2260+ product_id: product_product_6
2261+-
2262+ !record {model: stock.production.lot, id: lot_monitor_1}:
2263+ name: Lot1 for LCD Monitor
2264+ product_id: product_product_6
2265+-
2266+ !record {model: stock.inventory, id: stock_inventory_0}:
2267+ name: Starting Inventory
2268+ state: draft
2269+-
2270+ !record {model: stock.inventory.line, id: stock_inventory_line_3}:
2271+ product_id: product_product_6
2272+ product_uom: product.product_uom_unit
2273+ inventory_id: stock_inventory_0
2274 product_qty: 50.0
2275- prod_lot_id: lot_icecream_0
2276- location_id: location_refrigerator
2277+ prod_lot_id: lot_monitor_0
2278+ location_id: location_monitor
2279 -
2280- !record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot1}:
2281- product_id: product_icecream
2282- product_uom: product.product_uom_kgm
2283- inventory_id: stock_inventory_icecream
2284+ !record {model: stock.inventory.line, id: stock_inventory_line_monitor}:
2285+ product_id: product_product_6
2286+ product_uom: product.product_uom_unit
2287+ inventory_id: stock_inventory_0
2288 product_qty: 40.0
2289- prod_lot_id: lot_icecream_1
2290- location_id: location_refrigerator
2291+ prod_lot_id: lot_monitor_1
2292+ location_id: location_monitor
2293
2294 -
2295 !record {model: stock.picking, id: outgoing_shipment}:
2296 type: out
2297- location_dest_id: location_delivery_counter
2298+ location_dest_id: stock_location_output
2299 -
2300- !record {model: stock.move, id: outgoing_shipment_icecream}:
2301+ !record {model: stock.move, id: outgoing_shipment_monitor}:
2302 picking_id: outgoing_shipment
2303- product_id: product_icecream
2304- product_uom: product.product_uom_kgm
2305+ product_id: product_product_6
2306+ product_uom: product.product_uom_unit
2307 product_qty: 130.0
2308- location_id: location_refrigerator
2309- location_dest_id: location_delivery_counter
2310+ location_id: location_monitor
2311+ location_dest_id: stock_location_output
2312 -
2313 !record {model: stock.picking, id: incomming_shipment}:
2314 type: in
2315 invoice_state: 2binvoiced
2316 partner_id: base.res_partner_address_9
2317- location_dest_id: location_refrigerator
2318+ location_dest_id: location_monitor
2319 -
2320- !record {model: stock.move, id: incomming_shipment_icecream}:
2321+ !record {model: stock.move, id: incomming_shipment_monitor}:
2322 picking_id: incomming_shipment
2323- product_id: product_icecream
2324- product_uom: product.product_uom_kgm
2325+ product_id: product_product_6
2326+ product_uom: product.product_uom_unit
2327 product_qty: 50.0
2328- location_id: location_convenience_shop
2329- location_dest_id: location_refrigerator
2330+ location_id: stock_location_3
2331+ location_dest_id: location_monitor
2332
2333=== modified file 'stock/test/opening_stock.yml'
2334--- stock/test/opening_stock.yml 2012-07-27 01:52:02 +0000
2335+++ stock/test/opening_stock.yml 2013-04-29 11:35:33 +0000
2336@@ -1,67 +1,87 @@
2337 -
2338- I update the price of the Ice-cream.
2339+ Only stock manager can change the price and update stock of products, so let's check data with giving the access rights of manager
2340+-
2341+ !context
2342+ uid: 'res_users_stock_manager'
2343+-
2344+ I update the price of the 15” LCD Monitor.
2345 -
2346 !python {model: stock.change.standard.price}: |
2347- context.update({'active_model':'product.product', 'active_id': ref('product_icecream'), 'active_ids':[ref('product_icecream')]})
2348+ context.update({'active_model':'product.product', 'active_id': ref('product_product_6'), 'active_ids':[ref('product_product_6')]})
2349 -
2350 !record {model: stock.change.standard.price, id: change_price}:
2351- new_price: 120
2352+ new_price: 1500
2353 -
2354 !python {model: stock.change.standard.price}: |
2355 self.change_price(cr, uid, [ref('change_price')], context=context)
2356 -
2357- I check price of Ice-cream after update price.
2358+ I check price of 15” LCD Monitor after update price.
2359 -
2360 !python {model: product.product}: |
2361- product = self.browse(cr, uid, ref('product_icecream'), context=context)
2362- assert product.standard_price == 120, "Price is not updated."
2363+ product = self.browse(cr, uid, ref('product_product_6'), context=context)
2364+ assert product.standard_price == 1500, "Price is not updated."
2365 -
2366- I update the current stock of the Ice-cream with 10 kgm in Small Refrigerator in lot0.
2367+ I update the current stock of the 15” LCD Monitor with 10 unit in stock location shop1 in lot0.
2368 -
2369 !record {model: stock.change.product.qty, id: change_qty}:
2370- location_id: location_refrigerator_small
2371+ location_id: location_monitor_small
2372 new_quantity: 10
2373- product_id: product_icecream
2374- prodlot_id: lot_icecream_1
2375+ product_id: product_product_6
2376+ prodlot_id: lot_monitor_1
2377 -
2378 !python {model: stock.change.product.qty}: |
2379 self.change_product_qty(cr, uid, [ref('change_qty')], context=context)
2380 -
2381- I check available stock of Ice-cream after update stock.
2382+ I check available stock of 15” LCD Monitor after update stock.
2383 -
2384 !python {model: product.product}: |
2385- product = self.browse(cr, uid, ref('product_icecream'), context=context)
2386+ product = self.browse(cr, uid, ref('product_product_6'), context=context)
2387 assert product.qty_available == 10, "Stock is not updated."
2388 -
2389+ Stock user can merge inventory, so let's check data with giving the access rights of user.
2390+-
2391+ !context
2392+ uid: 'res_users_stock_user'
2393+-
2394 I merge inventory.
2395 -
2396 !python {model: stock.inventory.merge }: |
2397- context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_icecream'), 'active_ids': [ref('stock_inventory_icecream')]})
2398+ context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_0'), 'active_ids': [ref('stock_inventory_0')]})
2399 -
2400 !record {model: stock.inventory.merge, id: merge_inventory}:
2401 -
2402 !python {model: stock.inventory.merge }: |
2403 self.do_merge(cr, uid, [ref('merge_inventory')], context=context)
2404 -
2405+ Only stock manager cancelled inventory, so let's check data with giving the access rights of manager
2406+-
2407+ !context
2408+ uid: 'res_users_stock_manager'
2409+-
2410 I cancel inventory.
2411 -
2412 !python {model: stock.inventory}: |
2413- self.action_cancel_inventory(cr, uid, [ref('stock_inventory_icecream')])
2414+ self.action_cancel_inventory(cr, uid, [ref('stock_inventory_0')])
2415+-
2416+ stock user can reset inventory, so let's check data with giving the access rights of user
2417+-
2418+ !context
2419+ uid: 'res_users_stock_user'
2420 -
2421 I reset to draft inventory.
2422 -
2423 !python {model: stock.inventory}: |
2424- self.action_cancel_draft(cr, uid, [ref('stock_inventory_icecream')])
2425+ self.action_cancel_draft(cr, uid, [ref('stock_inventory_0')])
2426 -
2427- I confirm physical inventory of Ice-cream which are came in different lots.
2428+ I confirm physical inventory of 15” LCD Monitor which are came in different lots.
2429 -
2430 !python {model: stock.inventory}: |
2431- self.action_confirm(cr, uid, [ref('stock_inventory_icecream')], context=context)
2432+ self.action_confirm(cr, uid, [ref('stock_inventory_0')], context=context)
2433 -
2434 I check move details after confirmed physical inventory.
2435 -
2436 !python {model: stock.inventory}: |
2437- inventory = self.browse(cr, uid, ref('stock_inventory_icecream'), context=context)
2438+ inventory = self.browse(cr, uid, ref('stock_inventory_0'), context=context)
2439 assert len(inventory.move_ids) == len(inventory.inventory_line_id), "moves are not correspond."
2440 for move_line in inventory.move_ids:
2441 for line in inventory.inventory_line_id:
2442@@ -77,15 +97,15 @@
2443 I split inventory line.
2444 -
2445 !python {model: stock.inventory.line.split}: |
2446- context.update({'active_model': 'stock.inventory.line', 'active_id': ref('stock_inventory_line_icecream_lot0'), 'active_ids': [ref('stock_inventory_line_icecream_lot0')]})
2447+ context.update({'active_model': 'stock.inventory.line', 'active_id': ref('stock_inventory_line_3'), 'active_ids': [ref('stock_inventory_line_3')]})
2448 -
2449 !record {model: stock.inventory.line.split, id: split_inventory_lot0}:
2450 use_exist: True
2451 line_exist_ids:
2452 - quantity: 6
2453- prodlot_id: lot_icecream_0
2454+ prodlot_id: lot_monitor_0
2455 - quantity: 4
2456- prodlot_id: lot_icecream_0
2457+ prodlot_id: lot_monitor_0
2458 -
2459 !python {model: stock.inventory.line.split }: |
2460 self.split_lot(cr, uid, [ref('split_inventory_lot0')], context=context)
2461@@ -93,39 +113,49 @@
2462 I fill inventory line.
2463 -
2464 !python {model: stock.fill.inventory}: |
2465- context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_icecream'), 'active_ids': [ref('stock_inventory_icecream')]})
2466+ context.update({'active_model': 'stock.inventory', 'active_id': ref('stock_inventory_0'), 'active_ids': [ref('stock_inventory_0')]})
2467 -
2468 !record {model: stock.fill.inventory, id: fill_inventory}:
2469- location_id: location_refrigerator
2470+ location_id: location_monitor
2471 recursive: True
2472 -
2473 !python {model: stock.fill.inventory }: |
2474 self.fill_inventory(cr, uid, [ref('fill_inventory')], context=context)
2475
2476 -
2477- Now I check vitual stock of Ice-cream after confirmed physical inventory.
2478+ Now I check vitual stock of 15” LCD Monitor after confirmed physical inventory.
2479 -
2480 !python {model: product.product}: |
2481- product = self.browse(cr, uid, ref('product_icecream'), context=context)
2482+ product = self.browse(cr, uid, ref('product_product_6'), context=context)
2483 assert product.virtual_available == 100, "Vitual stock is not updated."
2484 -
2485- I close physical inventory of Ice-cream.
2486--
2487- !python {model: stock.inventory}: |
2488- self.action_done(cr, uid, [ref('stock_inventory_icecream')], context=context)
2489--
2490- I check closed move and real stock of Ice-cream after closed physical inventory.
2491--
2492- !python {model: stock.inventory}: |
2493- inventory = self.browse(cr, uid, ref('stock_inventory_icecream'), context=context)
2494+ Only stock manager can close physical inventory, so let's check data with giving the access rights of manager
2495+-
2496+ !context
2497+ uid: 'res_users_stock_manager'
2498+-
2499+ I close physical inventory of 15” LCD Monitor.
2500+-
2501+ !python {model: stock.inventory}: |
2502+ self.action_done(cr, uid, [ref('stock_inventory_0')], context=context)
2503+-
2504+ Stock user can check closed move and real stock, so let's check data with giving the access rights of user
2505+-
2506+ !context
2507+ uid: 'res_users_stock_user'
2508+-
2509+ I check closed move and real stock of 15” LCD Monitor after closed physical inventory.
2510+-
2511+ !python {model: stock.inventory}: |
2512+ inventory = self.browse(cr, uid, ref('stock_inventory_0'), context=context)
2513 assert inventory.state == 'done', "inventory is not closed."
2514 for move_line in inventory.move_ids:
2515 assert move_line.state == 'done', "Move is not closed."
2516- product = self.pool.get('product.product').browse(cr, uid, ref('product_icecream'), context=context)
2517+ product = self.pool.get('product.product').browse(cr, uid, ref('product_product_6'), context=context)
2518 product.qty_available == 100, "Real stock is not updated."
2519 -
2520 I check stock in lot.
2521 -
2522 !python {model: stock.production.lot}: |
2523- lot = self.browse(cr, uid, ref('lot_icecream_0'), context=context)
2524+ lot = self.browse(cr, uid, ref('lot_monitor_0'), context=context)
2525 assert lot.stock_available == 50, "Stock in lot is not correspond."
2526
2527=== modified file 'stock/test/shipment.yml'
2528--- stock/test/shipment.yml 2012-05-08 21:22:45 +0000
2529+++ stock/test/shipment.yml 2013-04-29 11:35:33 +0000
2530@@ -1,9 +1,14 @@
2531 -
2532- I confirm outgoing shipment of 130 kgm Ice-cream.
2533+ Stock manager can only test whole process related to Shipment, so let's check data with stock manager.
2534+-
2535+ !context
2536+ uid: 'res_users_stock_manager'
2537+-
2538+ I confirm outgoing shipment of 130 Unit 15” LCD Monitor.
2539 -
2540 !workflow {model: stock.picking, action: button_confirm, ref: outgoing_shipment}
2541 -
2542- I check shipment details after confirmed.
2543+ I check shipment details after confirmation.
2544 -
2545 !python {model: stock.picking}: |
2546 shipment = self.browse(cr, uid, ref("outgoing_shipment"))
2547@@ -12,147 +17,151 @@
2548 assert move_line.state == "confirmed", "Move should be confirmed."
2549
2550 -
2551- Now I check vitual stock of Ice-cream after confirmed outgoing shipment.
2552+ Now, I check virtual stock of 15” LCD Monitor after confirming outgoing shipment.
2553 -
2554 !python {model: product.product}: |
2555- product = self.browse(cr, uid, ref('product_icecream'), context=context)
2556- product.virtual_available == -30, "Vitual stock is not updated."
2557+ product = self.browse(cr, uid, ref('product_product_6'), context=context)
2558+ assert product.virtual_available == -30, "Virtual stock is not updated."
2559
2560 -
2561- I confirm incomming shipment of 50 kgm Ice-cream.
2562+ I confirm incoming shipment of 50 Unit 15” LCD Monitor.
2563 -
2564 !workflow {model: stock.picking, action: button_confirm, ref: incomming_shipment}
2565 -
2566- I receive 40kgm Ice-cream so I make backorder of incomming shipment for 40 kgm.
2567+ I split incoming shipment into lots. each lot contain 10 Unit 15” LCD Monitor.
2568+-
2569+ !python {model: stock.picking}: |
2570+ shipment = self.browse(cr, uid, ref("incomming_shipment"))
2571+ move_ids = [x.id for x in shipment.move_lines]
2572+ context.update({'active_model': 'stock.move', 'active_id': move_ids[0], 'active_ids': move_ids})
2573+-
2574+ !record {model: stock.move.split, id: split_lot_incoming}:
2575+ line_ids:
2576+ - name: incoming_lot0
2577+ quantity: 10
2578+ - name: incoming_lot1
2579+ quantity: 10
2580+ - name: incoming_lot2
2581+ quantity: 10
2582+ - name: incoming_lot3
2583+ quantity: 10
2584+-
2585+ !python {model: stock.move.split }: |
2586+ self.split_lot(cr, uid, [ref('split_lot_incoming')], context=context)
2587+-
2588+ I check move lines after splitting.
2589+-
2590+ !python {model: stock.move}: |
2591+ mm = self.browse(cr, uid, ref("incomming_shipment_monitor"))
2592+ lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incoming'), context=context)
2593+ lot_ids = self.pool.get('stock.production.lot').search(cr, uid, [('name','in',[x.name for x in lot.line_ids])])
2594+ assert len(lot_ids) == 4, 'lots of incoming shipment are not correspond.'
2595+ move_ids = self.search(cr, uid, [('location_dest_id','=',ref('location_monitor')),('prodlot_id','in',lot_ids)])
2596+ assert len(move_ids) == 4, 'move lines are not correspond per production lot after splitting.'
2597+ for move in self.browse(cr, uid, move_ids, context=context):
2598+ assert move.prodlot_id.name in ['incoming_lot0', 'incoming_lot1', 'incoming_lot2', 'incoming_lot3'], "lot does not correspond."
2599+ assert move.product_qty == 10, "qty does not correspond per production lot."
2600+-
2601+ I receive 40 units of 15” LCD Monitor.
2602 -
2603 !python {model: stock.partial.picking}: |
2604 context.update({'active_model': 'stock.picking', 'active_id': ref('incomming_shipment'), 'active_ids': [ref('incomming_shipment')]})
2605 -
2606- !record {model: stock.partial.picking, id: partial_incomming}:
2607- move_ids:
2608- - quantity: 40
2609- product_id: product_icecream
2610- product_uom: product.product_uom_kgm
2611- move_id: incomming_shipment_icecream
2612- location_id: location_convenience_shop
2613- location_dest_id: location_refrigerator
2614--
2615- !python {model: stock.partial.picking }: |
2616- self.do_partial(cr, uid, [ref('partial_incomming')], context=context)
2617--
2618- I check backorder shipment after received partial shipment.
2619+ !python {model: stock.partial.picking}: |
2620+ partial = []
2621+ for move in self.pool.get('stock.picking').browse(cr, uid, ref("incomming_shipment")).move_lines:
2622+ if move.prodlot_id:
2623+ partial.append((0, 0, {
2624+ 'quantity': move.product_qty,
2625+ 'product_id': move.product_id.id,
2626+ 'product_uom': move.product_uom.id,
2627+ 'move_id': move.id,
2628+ 'location_id': move.location_id.id,
2629+ 'location_dest_id': move.location_dest_id.id,
2630+ 'prodlot_id': move.prodlot_id.id,
2631+ 'cost': move.product_id.standard_price
2632+ }))
2633+ partial_id = self.create(cr, uid, {'move_ids': partial}, context=context)
2634+ self.do_partial(cr, uid, [partial_id], context=context)
2635+-
2636+ I check backorder shipment after receiving partial shipment.
2637 -
2638 !python {model: stock.picking}: |
2639 shipment = self.browse(cr, uid, ref("incomming_shipment"))
2640 backorder = shipment.backorder_id
2641 assert backorder, "Backorder should be created after partial shipment."
2642- assert backorder.state == 'done', "Backorder should be close after received."
2643+ assert backorder.state == 'done', "Backorder should be closed after received."
2644+ qty = 0
2645 for move_line in backorder.move_lines:
2646- assert move_line.product_qty == 40, "Qty in backorder does not correspond."
2647 assert move_line.state == 'done', "Move line of backorder should be closed."
2648--
2649- I receive another 10kgm Ice-cream.
2650--
2651- !record {model: stock.partial.picking, id: partial_incomming}:
2652+ qty += move_line.product_qty
2653+ assert qty == 40, "Qty in backorder does not correspond."
2654+-
2655+ I receive another 10 units of 15” LCD Monitor.
2656+-
2657+ !record {model: stock.partial.picking, id: partial_incoming}:
2658 move_ids:
2659 - quantity: 10
2660- product_id: product_icecream
2661- product_uom: product.product_uom_kgm
2662- move_id: incomming_shipment_icecream
2663- location_id: location_convenience_shop
2664- location_dest_id: location_refrigerator
2665+ product_id: product_product_6
2666+ product_uom: product.product_uom_unit
2667+ move_id: incomming_shipment_monitor
2668+ location_id: stock_location_3
2669+ location_dest_id: location_monitor
2670 -
2671 !python {model: stock.partial.picking }: |
2672- self.do_partial(cr, uid, [ref('partial_incomming')], context=context)
2673-
2674+ self.do_partial(cr, uid, [ref('partial_incoming')], context=context)
2675 -
2676- I check incomming shipment after received.
2677+ I check incoming shipment after receiving it.
2678 -
2679 !python {model: stock.picking}: |
2680 shipment = self.browse(cr, uid, ref("incomming_shipment"))
2681- assert shipment.state == 'done', "shipment should be close after received."
2682+ assert shipment.state == 'done', "shipment should be closed after receiving."
2683 for move_line in shipment.move_lines:
2684 assert move_line.product_qty == 10, "Qty does not correspond."
2685 assert move_line.product_id.virtual_available == 20, "Virtual stock does not correspond."
2686 assert move_line.state == 'done', "Move line should be closed."
2687-
2688--
2689- I return last incomming shipment for 10 kgm Ice-cream.
2690--
2691- !record {model: stock.return.picking, id: return_incomming}:
2692+-
2693+ I return last incoming shipment for 10 Unit 15” LCD Monitor.
2694+-
2695+ !record {model: stock.return.picking, id: return_incoming}:
2696 invoice_state: none
2697 -
2698 !python {model: stock.return.picking }: |
2699 # this work without giving the id of the picking to return, magically, thanks to the context
2700- self.create_returns(cr, uid, [ref('return_incomming')], context=context)
2701+ self.create_returns(cr, uid, [ref('return_incoming')], context=context)
2702 -
2703- I cancel incomming shipment after return it.
2704+ I cancel incoming shipment after returning it.
2705 -
2706 !python {model: stock.picking}: |
2707- # the cancel is not on the return, but on the incomming shipment (which now has a quantity of 10, thanks to the
2708+ # the cancel is not on the return, but on the incoming shipment (which now has a quantity of 10, thanks to the
2709 # backorder). This situation is a little weird as we returned a move that we finally cancelled... As result, only
2710- # 30Kg from the original 50Kg will be counted in the stock (50 - 10 (cancelled quantity) - 10 (returned quantity))
2711+ # 30Unit from the original 50Unit will be counted in the stock (50 - 10 (cancelled quantity) - 10 (returned quantity))
2712 self.action_cancel(cr, uid, [ref("incomming_shipment")], context=context)
2713 -
2714- I make invoice of backorder of incomming shipment.
2715+ I make invoice of backorder of incoming shipment.
2716 -
2717 !python {model: stock.invoice.onshipping}: |
2718 shipment = self.pool.get('stock.picking').browse(cr, uid, ref("incomming_shipment"))
2719 context.update({'active_model': 'stock.picking', 'active_id': shipment.backorder_id.id, 'active_ids': [shipment.backorder_id.id]})
2720 -
2721- !record {model: stock.invoice.onshipping, id: invoice_incomming}:
2722+ !record {model: stock.invoice.onshipping, id: invoice_incoming}:
2723 group: False
2724 -
2725 !python {model: stock.invoice.onshipping }: |
2726- self.create_invoice(cr, uid, [ref('invoice_incomming')], context=context)
2727+ self.create_invoice(cr, uid, [ref('invoice_incoming')], context=context)
2728 -
2729- I check invoice state of backorder of incomming shipment.
2730+ I check invoice status of backorder of incoming shipment.
2731 -
2732 !python {model: stock.picking}: |
2733 shipment = self.browse(cr, uid, ref("incomming_shipment"))
2734- assert shipment.backorder_id.invoice_state == 'invoiced', 'Invoice state is not upadted.'
2735+ assert shipment.backorder_id.invoice_state == 'invoiced', 'Invoice state is not updated.'
2736 -
2737- I check available stock after received incomming shipping.
2738+ I check available stock after receiving incoming shipping.
2739 -
2740 !python {model: product.product}: |
2741- product = self.browse(cr, uid, ref('product_icecream'), context=context)
2742+ product = self.browse(cr, uid, ref('product_product_6'), context=context)
2743 assert product.qty_available == 140, "Stock does not correspond."
2744- assert product.virtual_available == 0, "Vitual stock does not correspond."
2745--
2746- I split incomming shipment into lots. each lot contain 10 kgm Ice-cream.
2747--
2748- !python {model: stock.picking}: |
2749- shipment = self.browse(cr, uid, ref("incomming_shipment"))
2750- move_ids = [x.id for x in shipment.backorder_id.move_lines]
2751- context.update({'active_model': 'stock.move', 'active_id': move_ids[0], 'active_ids': move_ids})
2752--
2753- !record {model: stock.move.split, id: split_lot_incomming}:
2754- line_ids:
2755- - name: incoming_lot0
2756- quantity: 10
2757- - name: incoming_lot1
2758- quantity: 10
2759- - name: incoming_lot2
2760- quantity: 10
2761- - name: incoming_lot3
2762- quantity: 10
2763-
2764--
2765- !python {model: stock.move.split }: |
2766- self.split_lot(cr, uid, [ref('split_lot_incomming')], context=context)
2767--
2768- I check move lines after spliting
2769--
2770- !python {model: stock.move}: |
2771- lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incomming'), context=context)
2772- lot_ids = self.pool.get('stock.production.lot').search(cr, uid, [('name','in',[x.name for x in lot.line_ids])])
2773- assert len(lot_ids) == 4, 'lots of incomming shipment are not correspond.'
2774- move_ids = self.search(cr, uid, [('location_dest_id','=',ref('location_refrigerator')),('prodlot_id','in',lot_ids)])
2775- assert len(move_ids) == 4, 'move lines are not correspond per prodcution lot after splited.'
2776- for move in self.browse(cr, uid, move_ids, context=context):
2777- assert move.prodlot_id.name in ['incoming_lot0', 'incoming_lot1', 'incoming_lot2', 'incoming_lot3'], "lot does not correspond."
2778- assert move.product_qty == 10, "qty does not correspond per production lot."
2779- context.update({'active_model':'stock.move', 'active_id':move_ids[0],'active_ids': move_ids})
2780+ assert product.virtual_available == 0, "Virtual stock does not correspond."
2781 -
2782 I check the stock valuation account entries.
2783 -
2784@@ -161,91 +170,90 @@
2785 account_move_ids = self.search(cr, uid, [('ref','=',incomming_shipment.name)])
2786 assert len(account_move_ids), "account move should be created."
2787 account_move = self.browse(cr, uid, account_move_ids[0], context=context)
2788- assert len(account_move.line_id) == len(incomming_shipment.move_lines) + 1, 'accuont entries are not correspond.'
2789+ assert len(account_move.line_id) == len(incomming_shipment.move_lines) + 1, 'Accounting entries does not correspond.'
2790 for account_move_line in account_move.line_id:
2791 for stock_move in incomming_shipment.move_lines:
2792 if account_move_line.account_id.id == stock_move.product_id.property_stock_account_input.id:
2793- assert account_move_line.credit == 800.0, "Credit amount does not correspond."
2794+ assert account_move_line.credit == 14000.0, "Credit amount does not correspond."
2795 assert account_move_line.debit == 0.0, "Debit amount does not correspond."
2796 else:
2797 assert account_move_line.credit == 0.0, "Credit amount does not correspond."
2798- assert account_move_line.debit == 800.0, "Debit amount does not correspond."
2799--
2800- I consume 1 kgm ice-cream from each incoming lots into internal production.
2801--
2802- !record {model: stock.move.consume, id: consume_lot_incomming}:
2803- product_qty: 1
2804- location_id: location_refrigerator
2805--
2806- !python {model: stock.move.consume}: |
2807- self.do_move_consume(cr, uid, [ref('consume_lot_incomming')], context=context)
2808--
2809- I scrap 10 gm ice-cream from each incoming lots into scrap location.
2810--
2811- !record {model: stock.move.scrap, id: scrap_lot_incomming}:
2812- product_qty: 0.010
2813--
2814- !python {model: stock.move.scrap}: |
2815- self.move_scrap(cr, uid, [ref('scrap_lot_incomming')], context=context)
2816--
2817- I check stock in scrap location and refrigerator location.
2818--
2819- !python {model: stock.location}: |
2820- ctx = {'product_id': ref('product_icecream')}
2821- refrigerator_location = self.pool.get('stock.location').browse(cr, uid, ref('location_refrigerator'), context=ctx)
2822- assert refrigerator_location.stock_real == 135.96, 'stock does not correspond in refrigerator location.'
2823- scrapped_location = self.browse(cr, uid, ref('stock_location_scrapped'), context=ctx)
2824- assert scrapped_location.stock_real == 0.010*4, 'scraped stock does not correspond in scrap location.'
2825-
2826--
2827- I check availabile stock after consumed and scraped.
2828--
2829- !python {model: product.product}: |
2830- product = self.browse(cr, uid, ref('product_icecream'), context=context)
2831- assert product.qty_available == 135.96, "Stock does not correspond."
2832- assert round(product.virtual_available, 2) == -4.04, "Vitual stock does not correspond."
2833+ assert account_move_line.debit == 14000.0, "Debit amount does not correspond."
2834 -
2835 I trace all incoming lots.
2836 -
2837 !python {model: stock.production.lot }: |
2838- lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incomming'), context=context)
2839+ lot = self.pool.get('stock.move.split').browse(cr, uid, ref('split_lot_incoming'), context=context)
2840 lot_ids = self.search(cr, uid, [('name', 'in', [x.name for x in lot.line_ids])])
2841 self.action_traceability(cr, uid, lot_ids, context=context)
2842 -
2843- I check outgoing shipment after stock availablity in refrigerator.
2844+ I check outgoing shipment after stock availability in Chicago shop.
2845 -
2846 !python {model: stock.picking}: |
2847 shipment = self.browse(cr, uid, ref("outgoing_shipment"), context=context)
2848- 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
2849- #TOFIX: shipment should be assigned if stock available
2850- #assert shipment.state == "assigned", "Shipment should be assigned."
2851- #for move_line in shipment.move_lines:
2852- # assert move_line.state == "assigned", "Move should be assigned."
2853+ self.pool.get('stock.move').action_assign(cr, uid, [x.id for x in shipment.move_lines])
2854+ assert shipment.state == "assigned", "Shipment should be assigned."
2855+ for move_line in shipment.move_lines:
2856+ assert move_line.state == "assigned", "Move should be assigned."
2857 self.force_assign(cr, uid, [shipment.id])
2858--
2859- I deliver 5kgm Ice-cream to customer so I make partial deliver
2860+ context.update({'active_model':'stock.move', 'active_id':shipment.move_lines[0].id,'active_ids': [shipment.move_lines[0].id]})
2861+-
2862+ I scrap 4 units of 15” LCD Monitor into scrap location.
2863+-
2864+ !record {model: stock.move.scrap, id: scrap_monitor1}:
2865+ product_qty: 4
2866+-
2867+ !python {model: stock.move.scrap}: |
2868+ self.move_scrap(cr, uid, [ref('scrap_monitor1')], context=context)
2869+-
2870+ I consume 4 units of 15” LCD Monitor.
2871+-
2872+ !record {model: stock.move.consume, id: consume_monitor1}:
2873+ product_qty: 4
2874+ location_id: location_monitor
2875+-
2876+ !python {model: stock.move.consume}: |
2877+ self.do_move_consume(cr, uid, [ref('consume_monitor1')], context=context)
2878+-
2879+ I check stock in scrap location and stock location.
2880+-
2881+ !python {model: stock.location}: |
2882+ ctx = {'product_id': ref('product_product_6')}
2883+ monitor_location = self.pool.get('stock.location').browse(cr, uid, ref('location_monitor'), context=ctx)
2884+ assert monitor_location.stock_real == 132.0, 'stock does not correspond in stock location shop0.'
2885+ scrapped_location = self.browse(cr, uid, ref('stock_location_scrapped'), context=ctx)
2886+ assert scrapped_location.stock_real == 4, 'scraped stock does not correspond in scrap location.'
2887+-
2888+ I check available stock after consumed and scraped move.
2889+-
2890+ !python {model: product.product}: |
2891+ product = self.browse(cr, uid, ref('product_product_6'), context=context)
2892+ assert product.qty_available == 132.0, "Stock does not correspond."
2893+ assert round(product.virtual_available, 2) == -4.00, "Virtual stock does not correspond."
2894+-
2895+ I deliver 5 Unit 15” LCD Monitor to customer partially.
2896 -
2897 !python {model: stock.partial.move}: |
2898- context.update({'active_model': 'stock.move', 'active_id': ref('outgoing_shipment_icecream'), 'active_ids': [ref('outgoing_shipment_icecream')]})
2899+ context.update({'active_model': 'stock.move', 'active_id': ref('outgoing_shipment_monitor'), 'active_ids': [ref('outgoing_shipment_monitor')]})
2900 -
2901- !record {model: stock.partial.move, id: partial_outgoing_icecream}:
2902+ !record {model: stock.partial.move, id: partial_outgoing_monitor}:
2903 move_ids:
2904 - quantity: 5
2905- product_id: product_icecream
2906- product_uom: product.product_uom_kgm
2907- move_id: outgoing_shipment_icecream
2908- location_id: location_refrigerator
2909- location_dest_id: location_delivery_counter
2910+ product_id: product_product_6
2911+ product_uom: product.product_uom_unit
2912+ move_id: outgoing_shipment_monitor
2913+ location_id: location_monitor
2914+ location_dest_id: stock_location_output
2915 -
2916 !python {model: stock.partial.move }: |
2917- self.do_partial(cr, uid, [ref('partial_outgoing_icecream')], context=context)
2918+ self.do_partial(cr, uid, [ref('partial_outgoing_monitor')], context=context)
2919
2920 -
2921- I packing outgoing shipment into box per 10kgm with unique tracking lot.
2922+ I pack outgoing shipment into box of 10 Unit with unique tracking lot.
2923 -
2924 !python {model: stock.move}: |
2925 stock_split = self.pool.get('stock.split.into')
2926- move = self.browse(cr, uid, ref('outgoing_shipment_icecream'), context=context)
2927+ move = self.browse(cr, uid, ref('outgoing_shipment_monitor'), context=context)
2928 context.update({'active_model': 'stock.move', 'active_id': move.id, 'active_ids': [move.id]})
2929 total_qty = move.product_qty
2930 split_qty = 10
2931@@ -254,7 +262,7 @@
2932 stock_split.split(cr, uid, [split_id], context=context)
2933 total_qty -= split_qty
2934 -
2935- I deliver outgoing shipment.
2936+ I deliver the outgoing shipment.
2937 -
2938 !python {model: stock.partial.picking}: |
2939 context.update({'active_model': 'stock.picking', 'active_id': ref('outgoing_shipment'), 'active_ids': [ref('outgoing_shipment')]})
2940@@ -266,7 +274,7 @@
2941 self.do_partial(cr, uid, [ref('partial_outgoing')], context=context)
2942
2943 -
2944- I check outgoing shipment after deliver.
2945+ I check outgoing shipment after delivery.
2946 -
2947 !python {model: stock.picking}: |
2948 shipment = self.browse(cr, uid, ref("outgoing_shipment"), context=context)
2949@@ -274,9 +282,9 @@
2950 for move_line in shipment.move_lines:
2951 assert move_line.state == "done", "Move should be closed."
2952 -
2953- I check availaible stock after deliver.
2954+ I check available stock after delivery.
2955 -
2956 !python {model: product.product}: |
2957- product = self.browse(cr, uid, ref('product_icecream'), context=context)
2958- assert round(product.qty_available, 2) == 5.96, "Stock does not correspond."
2959- assert round(product.virtual_available, 2) == -4.04, "Vitual stock does not correspond."
2960+ product = self.browse(cr, uid, ref('product_product_6'), context=context)
2961+ assert round(product.qty_available, 2) == 6, "Stock does not correspond."
2962+ assert round(product.virtual_available, 2) == -4.00, "Virtual stock does not correspond."
2963
2964=== modified file 'stock/test/stock_report.yml'
2965--- stock/test/stock_report.yml 2013-02-22 13:35:11 +0000
2966+++ stock/test/stock_report.yml 2013-04-29 11:35:33 +0000
2967@@ -1,11 +1,16 @@
2968 -
2969+ Stock user can print all reports related to stock, so let's check data with giving the access rights of user.
2970+-
2971+ !context
2972+ uid: 'res_users_stock_user'
2973+-
2974 I print a stock overview report of location.
2975 -
2976 !python {model: stock.location}: |
2977 import os
2978 import openerp.report
2979 from openerp import tools
2980- data, format = openerp.report.render_report(cr, uid, [ref('location_refrigerator')], 'lot.stock.overview', {}, {})
2981+ data, format = openerp.report.render_report(cr, uid, [ref('location_monitor')], 'lot.stock.overview', {}, {})
2982 if tools.config['test_report_directory']:
2983 file(os.path.join(tools.config['test_report_directory'], 'stock-overview'+format), 'wb+').write(data)
2984 -
2985@@ -15,7 +20,7 @@
2986 import os
2987 import openerp.report
2988 from openerp import tools
2989- data, format = openerp.report.render_report(cr, uid, [ref('location_refrigerator')], 'lot.stock.overview_all', {}, {})
2990+ data, format = openerp.report.render_report(cr, uid, [ref('location_monitor')], 'lot.stock.overview_all', {}, {})
2991 if tools.config['test_report_directory']:
2992 file(os.path.join(tools.config['test_report_directory'], 'stock-overviewall'+format), 'wb+').write(data)
2993 -
2994@@ -25,7 +30,7 @@
2995 import os
2996 import openerp.report
2997 from openerp import tools
2998- data, format = openerp.report.render_report(cr, uid, [ref('stock_inventory_icecream')], 'stock.inventory.move', {}, {})
2999+ data, format = openerp.report.render_report(cr, uid, [ref('stock_inventory_0')], 'stock.inventory.move', {}, {})
3000 if tools.config['test_report_directory']:
3001 file(os.path.join(tools.config['test_report_directory'], 'stock-stock_inventory_move.'+format), 'wb+').write(data)
3002 -
3003@@ -45,7 +50,7 @@
3004 import os
3005 import openerp.report
3006 from openerp import tools
3007- data, format = openerp.report.render_report(cr, uid, [ref('product_icecream')], 'stock.product.history', {}, {})
3008+ data, format = openerp.report.render_report(cr, uid, [ref('product_product_6')], 'stock.product.history', {}, {})
3009 if tools.config['test_report_directory']:
3010 file(os.path.join(tools.config['test_report_directory'], 'stock-product_stock_report.'+format), 'wb+').write(data)
3011
3012
3013=== added file 'stock/test/stock_users.yml'
3014--- stock/test/stock_users.yml 1970-01-01 00:00:00 +0000
3015+++ stock/test/stock_users.yml 2013-04-29 11:35:33 +0000
3016@@ -0,0 +1,24 @@
3017+-
3018+ Create a user as 'Stock Manager'
3019+-
3020+ !context
3021+ default_groups_ref: ['stock.group_stock_manager']
3022+-
3023+ !record {model: res.users, id: res_users_stock_manager}:
3024+ company_id: base.main_company
3025+ name: Stock Manager
3026+ login: sam
3027+ password: sam
3028+ email: stockmanager@yourcompany.com
3029+-
3030+ Create a user as 'Stock User'
3031+-
3032+ !context
3033+ default_groups_ref: ['stock.group_stock_user']
3034+-
3035+ !record {model: res.users, id: res_users_stock_user}:
3036+ company_id: base.main_company
3037+ name: Stock User
3038+ login: sau
3039+ password: sau
3040+ email: stockuser@yourcompany.com

Subscribers

People subscribed via source and target branches

to all changes: