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