Merge lp:~numerigraphe/openobject-addons/5.0-unittest into lp:openobject-addons/5.0
- 5.0-unittest
- Merge into 5.0
Proposed by
Numérigraphe
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp:~numerigraphe/openobject-addons/5.0-unittest | ||||
Merge into: | lp:openobject-addons/5.0 | ||||
Diff against target: |
682 lines (+442/-40) 11 files modified
account/__terp__.py (+2/-1) account/demo/account_minimal.xml (+30/-0) account/test/invoice_basic_test.xml (+2/-2) account/test/invoice_bug452854_test.xml (+34/-0) product/product_demo.xml (+55/-0) sale/__terp__.py (+7/-1) sale/sale_demo.xml (+0/-13) sale/test/bug399817.xml (+60/-0) sale/test/bug461801.xml (+87/-0) sale/test/invoice_packing.xml (+134/-0) sale/test/sale_test.xml (+31/-23) |
||||
To merge this branch: | bzr merge lp:~numerigraphe/openobject-addons/5.0-unittest | ||||
Related bugs: |
|
||||
Related blueprints: |
Generic improvement for accuracy trouble
(Essential)
Unit Testing
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Antony Lesuisse (OpenERP) | Pending | ||
Christophe Simonis (OpenERP) | Pending | ||
OpenERP Core Team | Pending | ||
Review via email: mp+19411@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Numérigraphe (numerigraphe) wrote : | # |
Revision history for this message
Christophe Simonis (OpenERP) (kangol) wrote : | # |
This branch will be merged when bug #399817 will be fixed.
Revision history for this message
Numérigraphe (numerigraphe) wrote : | # |
> This branch will be merged when bug #399817 will be fixed.
Thanks for your interrest.
In that case you should wait for bug Bug #452854 too - the test case causes the server to fail on init with price_accuracy>3.
Lionel.
- 2428. By Numerigraphe - Lionel Sausin <email address hidden>
-
[MERGE] merged updates from v5.0.7
- 2429. By Numerigraphe - Lionel Sausin <email address hidden>
-
[MERGE] fix tests for purchase, submitted by Don Kirkby
- 2430. By Numerigraphe - Lionel Sausin <email address hidden>
-
[REF] sale: manually merge changes made to tests from 5.0.7
- 2431. By Numerigraphe - Lionel Sausin <email address hidden>
-
[MERGE] resolved conflicts
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'account/__terp__.py' |
2 | --- account/__terp__.py 2010-03-22 05:43:46 +0000 |
3 | +++ account/__terp__.py 2010-04-07 13:28:34 +0000 |
4 | @@ -65,7 +65,8 @@ |
5 | 'project/project_demo.xml', |
6 | 'project/analytic_account_demo.xml', |
7 | 'demo/account_minimal.xml', |
8 | - 'account_unit_test.xml' |
9 | + 'test/invoice_basic_test.xml', |
10 | + 'test/invoice_bug452854_test.xml', |
11 | ], |
12 | 'installable': True, |
13 | 'active': False, |
14 | |
15 | === modified file 'account/demo/account_minimal.xml' |
16 | --- account/demo/account_minimal.xml 2010-02-02 07:37:02 +0000 |
17 | +++ account/demo/account_minimal.xml 2010-04-07 13:28:34 +0000 |
18 | @@ -41,6 +41,11 @@ |
19 | <field name="code">cash</field> |
20 | <field name="close_method">balance</field> |
21 | </record> |
22 | + <record id="account_type_tax" model="account.account.type"> |
23 | + <field name="name">Tax</field> |
24 | + <field name="code">Tax</field> |
25 | + <field name="close_method">unreconciled</field> |
26 | + </record> |
27 | |
28 | <!-- |
29 | Chart of Account |
30 | @@ -130,6 +135,31 @@ |
31 | your own chart of account. |
32 | </field> |
33 | </record> |
34 | + <record id="a_taxes" model="account.account"> |
35 | + <field name="name">Taxes</field> |
36 | + <field name="code">x 445000</field> |
37 | + <field name="type">other</field> |
38 | + <field eval="ref('minimal_0')" name="parent_id"/> |
39 | + <field name="user_type" ref="account_type_tax"/> |
40 | + <field name="company_id" ref="base.main_company"/> |
41 | + <field name="note"> |
42 | +This chart of account is used for automated testing purpose. It is installed |
43 | +only if you selected demo data during your database creation. Modules can |
44 | +do black box testing on entries on this chart of account, without modifying |
45 | +your own chart of account. |
46 | +</field> |
47 | + </record> |
48 | + <!-- |
49 | + Tax |
50 | + --> |
51 | + <record model="account.tax" id="t_vat"> |
52 | + <field name="name">x VAT</field> |
53 | + <field name="amount" eval="0.196"/> |
54 | + <field name="type">percent</field> |
55 | + <field name="account_paid_id" ref="a_taxes"/> |
56 | + <field name="account_collected_id" ref="a_taxes"/> |
57 | + <field name="ref_tax_sign" eval="-1"/> |
58 | + </record> |
59 | |
60 | <!-- Properties --> |
61 | <record forcecreate="True" id="property_account_receivable" model="ir.property"> |
62 | |
63 | === renamed file 'account/account_unit_test.xml' => 'account/test/invoice_basic_test.xml' |
64 | --- account/account_unit_test.xml 2009-01-21 12:25:28 +0000 |
65 | +++ account/test/invoice_basic_test.xml 2010-04-07 13:28:34 +0000 |
66 | @@ -29,20 +29,20 @@ |
67 | <field name="account_id" ref="account.a_sale"/> |
68 | </record> |
69 | |
70 | + <!-- XXX pointless test, it's in the record tag --> |
71 | <assert id="test_invoice_1" model="account.invoice" string="The currency unit of Test invoice 1 is EUR"> |
72 | <test expr="currency_id.code">EUR</test> |
73 | </assert> |
74 | - |
75 | <assert id="test_invoice_1" model="account.invoice" severity="error" string="The amount of Test invoice 1 is correct"> |
76 | <test expr="sum([l.price_subtotal for l in invoice_line]) == 1850"/> |
77 | <test expr="sum([l.price_subtotal for l in invoice_line]) == amount_untaxed"/> |
78 | </assert> |
79 | |
80 | <workflow action="invoice_open" model="account.invoice" ref="test_invoice_1"/> |
81 | - |
82 | <assert id="test_invoice_1" model="account.invoice" string="Test invoice 1 is now open"> |
83 | <test expr="state">open</test> |
84 | </assert> |
85 | + |
86 | <function model="account.invoice" name="pay_and_reconcile"> |
87 | <!-- ids = --> <value eval="[ref('test_invoice_1')]"/> |
88 | <!-- pay_amount = --> <value eval="1850"/> |
89 | |
90 | === added file 'account/test/invoice_bug452854_test.xml' |
91 | --- account/test/invoice_bug452854_test.xml 1970-01-01 00:00:00 +0000 |
92 | +++ account/test/invoice_bug452854_test.xml 2010-04-07 13:28:34 +0000 |
93 | @@ -0,0 +1,34 @@ |
94 | +<?xml version="1.0" encoding="utf-8"?> |
95 | +<openerp> |
96 | + <data noupdate="1"> |
97 | + <!-- |
98 | + Illustrate one aspect of bug #452854: |
99 | + Cannot validate invoices with foreign currency or price_accuracy=3 |
100 | + --> |
101 | + <!-- This file must be loaded _after_ account_demo.xml ! --> |
102 | + <record id="invoice_bug452854" model="account.invoice"> |
103 | + <field name="currency_id" ref="base.EUR" /> |
104 | + <field name="company_id" ref="base.main_company" /> |
105 | + <field name="address_invoice_id" ref="base.res_partner_address_tang" /> |
106 | + <field name="partner_id" ref="base.res_partner_asus" /> |
107 | + <field name="journal_id" ref="account.sales_journal" /> |
108 | + <field name="state">draft</field> |
109 | + <field name="type">out_invoice</field> |
110 | + <field name="account_id" ref="account.a_recv" /> |
111 | + <field name="name">lp:452854</field> |
112 | + <field name="address_contact_id" ref="base.res_partner_address_tang" /> |
113 | + </record> |
114 | + <record id="invoice_bug452854_line_1" model="account.invoice.line"> |
115 | + <field name="name">Dummy product</field> |
116 | + <field name="invoice_id" ref="invoice_bug452854" /> |
117 | + <field name="price_unit" eval="1000.0/3" /> |
118 | + <field name="quantity">1</field> |
119 | + <field name="account_id" ref="account.a_sale" /> |
120 | + <field eval="[(6,0,[ref('account.t_vat')])]" name="invoice_line_tax_id" /> |
121 | + </record> |
122 | + <workflow action="invoice_open" model="account.invoice" ref="invoice_bug452854" /> |
123 | + <assert id="invoice_bug452854" model="account.invoice" severity="error" string="Invoice lp:452854 validated correctly"> |
124 | + <test expr="state">open</test> |
125 | + </assert> |
126 | + </data> |
127 | +</openerp> |
128 | |
129 | === modified file 'product/product_demo.xml' |
130 | --- product/product_demo.xml 2010-03-17 12:04:13 +0000 |
131 | +++ product/product_demo.xml 2010-04-07 13:28:34 +0000 |
132 | @@ -54,6 +54,40 @@ |
133 | <field name="name">IT components kits</field> |
134 | </record> |
135 | |
136 | + <!-- |
137 | + Resource: product.uom.categ |
138 | + --> |
139 | + |
140 | + <record id="product_uom_categ_m" model="product.uom.categ"> |
141 | + <field name="name">Length</field> |
142 | + </record> |
143 | + |
144 | + <!-- |
145 | + Resource: product.uom |
146 | + --> |
147 | + <record id="product_uom_m" model="product.uom"> |
148 | + <field name="category_id" ref="product_uom_categ_m"/> |
149 | + <field name="name">m</field> |
150 | + <field name="factor_inv">1</field> |
151 | + <field name="factor">1</field> |
152 | + </record> |
153 | + <record id="product_uom_km" model="product.uom"> |
154 | + <field name="category_id" ref="product_uom_categ_m"/> |
155 | + <field name="name">Km</field> |
156 | + <field name="factor_inv">1000</field> |
157 | + <field name="factor">0.001</field> |
158 | + </record> |
159 | + <record id="product_uom_cm" model="product.uom"> |
160 | + <field name="category_id" ref="product_uom_categ_m"/> |
161 | + <field name="factor_inv">0.01</field> |
162 | + <field name="factor">100</field> |
163 | + <field name="name">cm</field> |
164 | + </record> |
165 | + |
166 | + <!-- |
167 | + Resource: product.ul |
168 | + --> |
169 | + |
170 | <record id="product_ul_box" model="product.ul"> |
171 | <field name="name">Box 20x20x40</field> |
172 | <field name="type">box</field> |
173 | @@ -351,6 +385,27 @@ |
174 | <field name="name">Kit Keyboard + Mouse</field> |
175 | <field name="categ_id" ref="product_category_11"/> |
176 | </record> |
177 | + <record id="product_product_27" model="product.product"> |
178 | + <field name="default_code">UTP5</field> |
179 | + <field name="list_price">3</field> |
180 | + <field name="standard_price">2</field> |
181 | + <field name="uom_id" ref="product_uom_m"/> |
182 | + <field name="uom_po_id" ref="product_uom_km"/> |
183 | + <field name="name">CAT5e Grey UTP cable</field> |
184 | + <field name="categ_id" ref="product_category_accessories"/> |
185 | + </record> |
186 | + |
187 | + <!-- sale advance demo.. --> |
188 | + <!-- Demo Data for Product --> |
189 | + <record id="advance_product_0" model="product.product"> |
190 | + <field name="name">Advance Product</field> |
191 | + <field name="categ_id" ref="cat1"/> |
192 | + <field name="type">service</field> |
193 | + <field name="list_price">150.0</field> |
194 | + <field name="standard_price">100.0</field> |
195 | + <field name="uom_id" ref="product_uom_unit"/> |
196 | + <field name="uom_po_id" ref="product_uom_unit"/> |
197 | + </record> |
198 | |
199 | <record id="supplierinfo1" model="product.supplierinfo"> |
200 | <field name="name" ref="base.res_partner_asus"/> |
201 | |
202 | === modified file 'sale/__terp__.py' |
203 | --- sale/__terp__.py 2010-03-08 17:57:25 +0000 |
204 | +++ sale/__terp__.py 2010-04-07 13:28:34 +0000 |
205 | @@ -57,7 +57,13 @@ |
206 | 'stock_view.xml', |
207 | 'process/sale_process.xml', |
208 | ], |
209 | - 'demo_xml': ['sale_demo.xml', 'test/sale_test.xml'], |
210 | + 'demo_xml': [ |
211 | + 'sale_demo.xml', |
212 | + 'test/sale_test.xml', |
213 | + 'test/invoice_packing.xml', |
214 | + 'test/bug461801.xml', |
215 | + 'test/bug399817.xml', |
216 | + ], |
217 | 'installable': True, |
218 | 'active': False, |
219 | 'certificate': '0058103601429', |
220 | |
221 | === modified file 'sale/sale_demo.xml' |
222 | --- sale/sale_demo.xml 2008-09-18 14:14:19 +0000 |
223 | +++ sale/sale_demo.xml 2010-04-07 13:28:34 +0000 |
224 | @@ -198,18 +198,5 @@ |
225 | <!-- Run all schedulers --> |
226 | <function model="mrp.procurement" name="run_scheduler"/> |
227 | |
228 | - |
229 | - <!-- sale advance demo.. --> |
230 | - <!-- Demo Data for Product --> |
231 | - <record id="advance_product_0" model="product.product"> |
232 | - <field name="name">Advance Product</field> |
233 | - <field name="categ_id" ref="product.cat1"/> |
234 | - <field name="type">service</field> |
235 | - <field name="list_price">150.0</field> |
236 | - <field name="standard_price">100.0</field> |
237 | - <field name="uom_id" ref="product.product_uom_unit"/> |
238 | - <field name="uom_po_id" ref="product.product_uom_unit"/> |
239 | - </record> |
240 | - |
241 | </data> |
242 | </openerp> |
243 | |
244 | === added file 'sale/test/bug399817.xml' |
245 | --- sale/test/bug399817.xml 1970-01-01 00:00:00 +0000 |
246 | +++ sale/test/bug399817.xml 2010-04-07 13:28:34 +0000 |
247 | @@ -0,0 +1,60 @@ |
248 | +<?xml version="1.0" encoding="utf-8"?> |
249 | +<openerp> |
250 | + <data> |
251 | + <!-- |
252 | + Illustrate bug #399817 |
253 | + SO not marked picked when 2nd delivery canceled |
254 | + |
255 | + --> |
256 | + |
257 | + <!-- Resource: sale.order --> |
258 | + <record id="bug399817" model="sale.order"> |
259 | + <field name="shop_id" ref="shop" /> |
260 | + <field name="name">lp:399817</field> |
261 | + <field name="note">This Order was created to assert that the following bug is fixed: |
262 | + https://bugs.launchpad.net/openobject-addons/+bug/399817 |
263 | + </field> |
264 | + <field model="product.pricelist" name="pricelist_id" search="[]" /> |
265 | + <field name="user_id" ref="base.user_demo" /> |
266 | + <field name="partner_id" ref="base.res_partner_3" /> |
267 | + <field name="partner_invoice_id" ref="base.res_partner_address_zen" /> |
268 | + <field name="partner_shipping_id" ref="base.res_partner_address_zen" /> |
269 | + <field name="partner_order_id" ref="base.res_partner_address_zen" /> |
270 | + </record> |
271 | + <record id="bug399817_line1" model="sale.order.line"> |
272 | + <field name="order_id" ref="bug399817" /> |
273 | + <field name="name">[PC2] Basic+ PC (assembly on order)</field> |
274 | + <field name="product_id" ref="product.product_product_pc2" /> |
275 | + <field name="product_uom" ref="product.product_uom_unit" /> |
276 | + <field name="product_uom_qty">4</field> |
277 | + <field name="price_unit">750</field> |
278 | + <field name="type">make_to_order</field> |
279 | + <field name="delay">15</field> |
280 | + </record> |
281 | + <workflow action="order_confirm" model="sale.order" ref="bug399817" /> |
282 | + |
283 | + <!-- copy packing and do the first one --> |
284 | + <!-- this is similar to what the partial packing wizard does (except for quantities) --> |
285 | + <function model="stock.picking" name="copy"> |
286 | + <value eval="obj(ref('bug399817')).picking_ids[0].id" model="sale.order" /> |
287 | + </function> |
288 | + <function model="stock.picking" name="draft_validate"> |
289 | + <value eval="[obj(ref('bug399817')).picking_ids[0].id]" model="sale.order" /> |
290 | + </function> |
291 | + <assert id="bug399817" model="sale.order" severity="warning" string="the sale order's first picking is done"> |
292 | + <test expr="len(picking_ids) == 2" /> |
293 | + <test expr="picking_ids[0].state">done</test> |
294 | + </assert> |
295 | + |
296 | + <!-- cancel the second packing --> |
297 | + <function model="stock.picking" name="action_cancel"> |
298 | + <value eval="[obj(ref('bug399817')).picking_ids[1].id]" model="sale.order" /> |
299 | + </function> |
300 | + <assert id="bug399817" model="sale.order" severity="warn" string="the sale order's second picking is cancelled"> |
301 | + <test expr="picking_ids[1].state">cancel</test> |
302 | + </assert> |
303 | + <assert id="bug399817" model="sale.order" severity="error" string="the sale order's is picked"> |
304 | + <test expr="shipped == True" /> <!-- at this stage, the order should be marked picked --> |
305 | + </assert> |
306 | + </data> |
307 | +</openerp> |
308 | |
309 | === added file 'sale/test/bug461801.xml' |
310 | --- sale/test/bug461801.xml 1970-01-01 00:00:00 +0000 |
311 | +++ sale/test/bug461801.xml 2010-04-07 13:28:34 +0000 |
312 | @@ -0,0 +1,87 @@ |
313 | +<?xml version="1.0" encoding="utf-8"?> |
314 | +<openerp> |
315 | + <data> |
316 | + <!-- |
317 | + Illustrate bug #461801 |
318 | + Sale order line in state 'done' but order in state 'draft' |
319 | + --> |
320 | + |
321 | + <!-- Resource: sale.order --> |
322 | + <record id="bug461801" model="sale.order"> |
323 | + <field name="shop_id" ref="shop" /> |
324 | + <field name="name">lp:461801</field> |
325 | + <field name="note">This Order was created to assert that the following bug is fixed: |
326 | + https://bugs.launchpad.net/openobject-addons/+bug/461801 |
327 | + </field> |
328 | + <field model="product.pricelist" name="pricelist_id" search="[]" /> |
329 | + <field name="user_id" ref="base.user_demo" /> |
330 | + <field name="partner_id" ref="base.res_partner_3" /> |
331 | + <field name="partner_invoice_id" ref="base.res_partner_address_zen" /> |
332 | + <field name="partner_shipping_id" ref="base.res_partner_address_zen" /> |
333 | + <field name="partner_order_id" ref="base.res_partner_address_zen" /> |
334 | + </record> |
335 | + <record id="bug461801_line1" model="sale.order.line"> |
336 | + <field name="order_id" ref="bug461801" /> |
337 | + <field name="name">[PC2] Basic+ PC (assembly on order)</field> |
338 | + <field name="product_id" ref="product.product_product_pc2" /> |
339 | + <field name="product_uom" ref="product.product_uom_unit" /> |
340 | + <field name="product_uom_qty">4</field> |
341 | + <field name="price_unit">750</field> |
342 | + <field name="type">make_to_order</field> |
343 | + <field name="delay">15</field> |
344 | + </record> |
345 | + <!-- confirm order --> |
346 | + <workflow action="order_confirm" model="sale.order" ref="bug461801" /> |
347 | + <assert id="bug461801" model="sale.order" severity="warning" string="the sale order is confirmed and has a packing"> |
348 | + <test expr="picking_ids[0].state">confirmed</test> |
349 | + <test expr="len(picking_ids) == 1" /> |
350 | + </assert> |
351 | + |
352 | + <!-- cancel packing --> |
353 | + <function model="stock.picking" name="action_cancel"> |
354 | + <value eval="[obj(ref('bug461801')).picking_ids[0].id]" model="sale.order" /> |
355 | + </function> |
356 | + <assert id="bug461801" model="sale.order" severity="warning" string="the sale order's first picking is cancelled"> |
357 | + <test expr="picking_ids[0].state">cancel</test> |
358 | + </assert> |
359 | + |
360 | + <!-- cancel the order --> |
361 | + <function model="sale.order" name="action_cancel"> |
362 | + <value eval="[ref('bug461801')]" model="sale.order" /> |
363 | + </function> |
364 | + <assert id="bug461801" model="sale.order" severity="warning" string="the sale order is cancelled"> |
365 | + <test expr="state">cancel</test> |
366 | + </assert> |
367 | + |
368 | + <!-- set the order to draft --> |
369 | + <function model="sale.order" name="action_cancel_draft"> |
370 | + <value eval="[ref('bug461801')]" model="sale.order" /> |
371 | + </function> |
372 | + <assert id="bug461801" model="sale.order" severity="warning" string="the sale order is cancelled"> |
373 | + <test expr="state">draft</test> |
374 | + </assert> |
375 | + |
376 | + <!-- add a 2nd line --> |
377 | + <record id="bug461801_line2" model="sale.order.line"> |
378 | + <field name="order_id" ref="bug461801" /> |
379 | + <field name="name">[PC1] Basic PC</field> |
380 | + <field name="product_id" ref="product.product_product_pc1" /> |
381 | + <field name="product_uom" ref="product.product_uom_unit" /> |
382 | + <field name="product_uom_qty">1</field> |
383 | + <field name="price_unit">450</field> |
384 | + <field name="type">make_to_stock</field> |
385 | + <field name="delay">2</field> |
386 | + </record> |
387 | + <assert id="bug461801_line2" model="sale.order.line" severity="warning" string="the new line in the sale order is draft"> |
388 | + <test expr="state">draft</test> |
389 | + </assert> |
390 | + |
391 | + <!-- force new computation of totals (change something on the order) --> |
392 | + <record id="bug461801" model="sale.order"> |
393 | + <field name="client_order_ref">Test</field> |
394 | + </record> |
395 | + <assert id="bug461801_line2" model="sale.order.line" severity="error" string="the new line in the sale order remains draft when totals are computed"> |
396 | + <test expr="state">draft</test> |
397 | + </assert> |
398 | + </data> |
399 | +</openerp> |
400 | |
401 | === added file 'sale/test/invoice_packing.xml' |
402 | --- sale/test/invoice_packing.xml 1970-01-01 00:00:00 +0000 |
403 | +++ sale/test/invoice_packing.xml 2010-04-07 13:28:34 +0000 |
404 | @@ -0,0 +1,134 @@ |
405 | +<?xml version="1.0" encoding="utf-8"?> |
406 | +<openerp> |
407 | + <data> |
408 | + <!-- |
409 | + Tests for an order with invoice from the packings |
410 | + --> |
411 | + |
412 | + <!-- Resource: sale.order --> |
413 | + <record id="test_order_2" model="sale.order"> |
414 | + <field name="name">test_order_2</field> |
415 | + <field name="note">This Sale Order was used to test the following use case during the installation: Order - Picking - Invoice - Payment</field> |
416 | + <field name="shop_id" ref="shop" /> |
417 | + <field model="product.pricelist" name="pricelist_id" search="[]" /> |
418 | + <field name="user_id" ref="base.user_root" /> |
419 | + <field name="partner_id" ref="base.res_partner_agrolait" /> |
420 | + <field name="partner_invoice_id" ref="base.res_partner_address_8invoice" /> <!-- you should patch your server to get res_partner_address_8invoice, or revert to res_partner_address_8 --> |
421 | + <field name="partner_shipping_id" ref="base.res_partner_address_8delivery" /> <!-- you should patch your server to get res_partner_address_8delivery, or revert to res_partner_address_8 --> |
422 | + <field name="partner_order_id" ref="base.res_partner_address_8" /> |
423 | + <field name="order_policy">picking</field> |
424 | + </record> |
425 | + <!-- Resource: sale.order.line --> |
426 | + <record id="test_order_2_line_1" model="sale.order.line"> |
427 | + <field name="order_id" ref="test_order_2" /> |
428 | + <field name="name">[PC1] Basic PC</field> |
429 | + <field name="product_id" ref="product.product_product_pc1" /> |
430 | + <field name="product_uom" ref="product.product_uom_unit" /> |
431 | + <field name="price_unit">450</field> |
432 | + <field name="product_uom_qty">2</field> |
433 | + <field name="product_uos_qty">2</field> |
434 | + <field name="type">make_to_stock</field> |
435 | + </record> |
436 | + <record id="test_order_2_line_3" model="sale.order.line"> |
437 | + <field name="order_id" ref="test_order_2" /> |
438 | + <field name="name">[RAM512] DDR 512MB PC400</field> |
439 | + <field name="product_id" ref="product.product_product_ram512" /> |
440 | + <field name="product_uom" ref="product.product_uom_unit" /> |
441 | + <field name="price_unit">90</field> |
442 | + <field name="product_uom_qty">3</field> |
443 | + <field name="product_uos_qty">3</field> |
444 | + <field name="type">make_to_stock</field> |
445 | + </record> |
446 | + <assert id="test_order_2" model="sale.order" severity="error" string="The amount of the sale order is correctly computed"> |
447 | + <test expr="amount_untaxed == 450*2 + 90*3" /> |
448 | + <test expr="state">draft</test> |
449 | + </assert> |
450 | + |
451 | + <workflow action="order_confirm" model="sale.order" ref="test_order_2" /> |
452 | + <assert id="test_order_2" model="sale.order" string="the sale order is now in progress"> |
453 | + <test expr="state">progress</test> |
454 | + </assert> |
455 | + |
456 | + <!-- Treat generated picking --> |
457 | + <assert id="test_order_2" model="sale.order" severity="error" string="the sale order has now a correspending packing"> |
458 | + <test expr="len(picking_ids) == 1" /> |
459 | + <test expr="picking_ids[0].invoice_state">2binvoiced</test> |
460 | + <test expr="picking_ids[0].address_id == partner_shipping_id" /> |
461 | + </assert> |
462 | + |
463 | + <!-- Here we need to use the function tag because action_assign is a method of stock_picking and not part of the workflow --> |
464 | + <function model="stock.picking" name="action_assign"> |
465 | + <value eval="[obj(ref('test_order_2')).picking_ids[0].id]" model="sale.order" /> |
466 | + </function> |
467 | + <assert id="test_order_2" model="sale.order" severity="error" string="the sale order's picking is now assigned"> |
468 | + <test expr="picking_ids[0].state">assigned</test> |
469 | + </assert> |
470 | + |
471 | + <!-- Do the same as in wizard_partial_picking lines 143-144 --> |
472 | + <function model="stock.picking" name="action_move"> |
473 | + <value eval="[obj(ref('test_order_2')).picking_ids[0].id]" model="sale.order" /> |
474 | + </function> |
475 | + <workflow action="button_done" model="stock.picking"> |
476 | + <value eval="obj(ref('test_order_2')).picking_ids[0].id" model="sale.order" /> |
477 | + </workflow> |
478 | + <assert id="test_order_2" model="sale.order" string="the sale order's picking is now done"> |
479 | + <test expr="picking_ids[0].state">done</test> |
480 | + </assert> |
481 | + |
482 | + <!-- Run all schedulers --> |
483 | + <function model="mrp.procurement" name="run_scheduler" /> |
484 | + <assert id="test_order_2" model="sale.order" string="the sale order is now done"> |
485 | + <test expr="state">done</test> |
486 | + <test expr="shipped == True" /> |
487 | + <test expr="invoiced == False" /> |
488 | + </assert> |
489 | + |
490 | + <!-- Invoice from the packing --> |
491 | + <function model="stock.picking" name="action_invoice_create"> |
492 | + <value eval="[obj(ref('test_order_2')).picking_ids[0].id]" model="sale.order" /> |
493 | + <value eval="ref('account.sales_journal')" /> |
494 | + <value eval="" /> |
495 | + <value eval="'out_invoice'" /> |
496 | + </function> |
497 | + <assert id="test_order_2" model="sale.order" severity="error" string="the sale order's picking is invoiced"> |
498 | + <test expr="picking_ids[0].invoice_state">invoiced</test> |
499 | + <test expr="len(invoice_ids) == 1" /> |
500 | + <test expr="invoice_ids[0].amount_untaxed == amount_untaxed" /> |
501 | + <test expr="invoice_ids[0].amount_total == amount_total" /> |
502 | + <test expr="invoice_ids[0].reconciled == False" /> |
503 | + <test expr="invoice_ids[0].residual == 450*2 + 90*3" /> |
504 | + <test expr="invoice_ids[0].state">draft</test> |
505 | + <test expr="invoice_ids[0].address_invoice_id == partner_invoice_id" /> |
506 | + </assert> |
507 | + |
508 | + <!-- Confirm the invoice --> |
509 | + <workflow action="invoice_open" model="account.invoice"> |
510 | + <value eval="obj(ref('test_order_2')).invoice_ids[0].id" model="sale.order" /> |
511 | + </workflow> |
512 | + <assert id="test_order_2" model="sale.order" severity="error" string="the sale order's picking is invoiced"> |
513 | + <test expr="invoice_ids[0].reconciled == False" /> |
514 | + <test expr="invoice_ids[0].residual == amount_total" /> |
515 | + <test expr="invoice_ids[0].state">open</test> |
516 | + </assert> |
517 | + |
518 | + <!-- Pay the invoice --> |
519 | + <function model="account.invoice" name="pay_and_reconcile"> |
520 | + <value eval="[obj(ref('test_order_2')).invoice_ids[0].id]" model="sale.order" /> |
521 | + <value eval="obj(ref('test_order_2')).amount_total" model="sale.order" /> |
522 | + <value eval="ref('account.cash')" /> |
523 | + <value eval="ref('account.period_' + str(int(time.strftime('%m'))))" /> |
524 | + <value eval="ref('account.bank_journal')" /> |
525 | + <value eval="ref('account.cash')" /> |
526 | + <value eval="ref('account.period_' + str(int(time.strftime('%m'))))" /> |
527 | + <value eval="ref('account.bank_journal')" /> |
528 | + </function> |
529 | + <assert id="test_order_2" model="sale.order" severity="error" string="the sale order's invoice is now paid"> |
530 | + <test expr="invoice_ids[0].reconciled == True" /> |
531 | + <test expr="invoice_ids[0].residual == 0.0" /> |
532 | + <test expr="invoice_ids[0].state">paid</test> |
533 | + <test expr="state">done</test> |
534 | + <test expr="shipped == True" /> |
535 | + <test expr="invoiced == True" /> |
536 | + </assert> |
537 | + </data> |
538 | +</openerp> |
539 | |
540 | === modified file 'sale/test/sale_test.xml' |
541 | --- sale/test/sale_test.xml 2010-03-08 19:09:29 +0000 |
542 | +++ sale/test/sale_test.xml 2010-04-07 13:28:34 +0000 |
543 | @@ -1,10 +1,10 @@ |
544 | <?xml version="1.0" encoding="utf-8"?> |
545 | <openerp> |
546 | <data> |
547 | - |
548 | + |
549 | <!-- =========================================================================================== |
550 | Smoke test 1 for sale.order process - Output location NOT chained to Customers locations. |
551 | - |
552 | + |
553 | 0. Verify that the virtual stock level for the products is sufficient. |
554 | 1. creates a simple sale order with 2 lines, |
555 | in manual invoice mode |
556 | @@ -16,6 +16,7 @@ |
557 | 7. deliver the products |
558 | 8. verify that everything is done: sale.order, invoice, picking. |
559 | |
560 | + |
561 | =========================================================================================== |
562 | --> |
563 | |
564 | @@ -33,13 +34,13 @@ |
565 | <field name="shop_id" ref="shop"/> |
566 | <field model="product.pricelist" name="pricelist_id" search="[]"/> |
567 | <field name="user_id" ref="base.user_root"/> |
568 | - <field model="res.partner" name="partner_id" search="[]"/> |
569 | <field name="order_policy">manual</field> <!-- force manual invoicing --> |
570 | <field name="picking_policy">one</field> <!-- full delivery only --> |
571 | <field name="invoice_quantity">order</field> <!-- invoice based on ordered quantities --> |
572 | - <field model="res.partner.address" name="partner_invoice_id" search="[]"/> |
573 | - <field model="res.partner.address" name="partner_shipping_id" search="[]"/> |
574 | - <field model="res.partner.address" name="partner_order_id" search="[]"/> |
575 | + <field name="partner_id" ref="base.res_partner_agrolait"/> |
576 | + <field name="partner_invoice_id" ref="base.res_partner_address_8invoice"/> |
577 | + <field name="partner_shipping_id" ref="base.res_partner_address_8delivery"/> |
578 | + <field name="partner_order_id" ref="base.res_partner_address_8"/> |
579 | <field name="name">SO-SMOKE-TEST</field> |
580 | </record> |
581 | <!-- Resource: sale.order.line --> |
582 | @@ -63,59 +64,64 @@ |
583 | <field name="product_uos_qty">3</field> |
584 | <field name="type">make_to_stock</field> |
585 | </record> |
586 | - |
587 | <assert id="smoke_test_sale_order" model="sale.order" severity="error" string="The amount of the sale order is correctly computed"> |
588 | - <test expr="sum([l.price_subtotal for l in order_line]) == amount_untaxed"/> |
589 | + <test expr="amount_untaxed == 450*2 + 90*3"/> |
590 | + <test expr="state">draft</test> |
591 | </assert> |
592 | |
593 | |
594 | <!-- ==== 2. CONFIRM SALE ORDER ==== --> |
595 | <workflow action="order_confirm" model="sale.order" ref="smoke_test_sale_order"/> |
596 | - |
597 | <assert id="smoke_test_sale_order" model="sale.order" string="the sale order is now in 'Manual in progress' state"> |
598 | <test expr="state">manual</test> |
599 | + <test expr="len(picking_ids) == 1"/> |
600 | + <test expr="picking_ids[0].address_id == partner_shipping_id"/> |
601 | + <test expr="picking_ids[0].invoice_state">none</test> |
602 | + <test expr="picking_ids[0].state">confirmed</test> <!-- Used to be desactivated because of MRP_JIT --> |
603 | </assert> |
604 | |
605 | |
606 | <!-- ==== 3. CREATE DRAFT INVOICE ==== --> |
607 | <workflow action="manual_invoice" model="sale.order" ref="smoke_test_sale_order" uid="base.user_root"/> |
608 | |
609 | - <assert id="smoke_test_sale_order" model="sale.order" string="the sale order is now in progress"> |
610 | + <assert id="smoke_test_sale_order" model="sale.order" string="the sale order is now in progress and has an invoice"> |
611 | <test expr="state">progress</test> |
612 | - </assert> |
613 | - |
614 | - <assert id="smoke_test_sale_order" model="sale.order" severity="fatal" string="the sale order has now a corresponding invoice"> |
615 | <test expr="len(invoice_ids) == 1"/> |
616 | </assert> |
617 | |
618 | - <assert id="smoke_test_sale_order" model="sale.order" severity="fatal" string="the sale order's has the same amount and is currently draft"> |
619 | + <assert id="smoke_test_sale_order" model="sale.order" severity="error" string="the sale order's invoice has the same amount and is a draft"> |
620 | <test expr="invoice_ids[0].amount_untaxed == amount_untaxed"/> |
621 | <test expr="invoice_ids[0].amount_total == amount_total"/> |
622 | <test expr="invoice_ids[0].state">draft</test> |
623 | + <test expr="invoice_ids[0].address_invoice_id == partner_invoice_id"/> |
624 | </assert> |
625 | |
626 | <!-- ==== 4. CONFIRM INVOICE ==== --> |
627 | <workflow action="invoice_open" model="account.invoice"> |
628 | <value eval="obj(ref('smoke_test_sale_order')).invoice_ids[0].id" model="sale.order"/> |
629 | </workflow> |
630 | - |
631 | - |
632 | + <assert id="smoke_test_sale_order" model="sale.order" severity="error" string="the sale order's picking is invoiced"> |
633 | + <test expr="invoice_ids[0].reconciled == False"/> |
634 | + <test expr="invoice_ids[0].residual == amount_total"/> |
635 | + <test expr="invoice_ids[0].state">open</test> |
636 | + </assert> |
637 | + |
638 | <!-- ==== 5. PAY THE INVOICE AND RECONCILE ==== --> |
639 | <function model="account.invoice" name="pay_and_reconcile"> |
640 | <value eval="[obj(ref('smoke_test_sale_order')).invoice_ids[0].id]" model="sale.order"/> |
641 | <value eval="obj(ref('smoke_test_sale_order')).amount_total" model="sale.order"/> |
642 | - <value model="account.account" search="[('user_type.name', '=', 'Cash')]"/> |
643 | + <value eval="ref('account.cash')"/> |
644 | <value eval="ref('account.period_' + str(int(time.strftime('%m'))))"/> |
645 | <value eval="ref('account.bank_journal')"/> |
646 | - <value model="account.account" search="[('user_type.name', '=', 'Cash')]"/> |
647 | + <value eval="ref('account.cash')"/> |
648 | <value eval="ref('account.period_' + str(int(time.strftime('%m'))))"/> |
649 | <value eval="ref('account.bank_journal')"/> |
650 | </function> |
651 | - |
652 | - <assert id="smoke_test_sale_order" model="sale.order" severity="fatal" string="the sale order's invoice is now paid"> |
653 | + <assert id="smoke_test_sale_order" model="sale.order" severity="error" string="the sale order's invoice is now paid"> |
654 | + <test expr="invoice_ids[0].reconciled == True"/> |
655 | + <test expr="invoice_ids[0].residual == 0.0"/> |
656 | <test expr="invoice_ids[0].state">paid</test> |
657 | </assert> |
658 | - |
659 | |
660 | <!-- ==== VERIFY THE PICKING AND MOVES ARE CONFIRMED ==== --> |
661 | <!-- Check the state of the picking and moves --> |
662 | @@ -140,7 +146,7 @@ |
663 | <function model="stock.picking" name="action_assign"> |
664 | <value eval="[obj(ref('smoke_test_sale_order')).picking_ids[0].id]" model="sale.order"/> |
665 | </function> |
666 | - <assert id="smoke_test_sale_order" model="sale.order" severity="fatal" string="the sale order's picking is now assigned"> |
667 | + <assert id="smoke_test_sale_order" model="sale.order" severity="error" string="the sale order's picking is now assigned"> |
668 | <test expr="picking_ids[0].state">assigned</test> |
669 | </assert> |
670 | |
671 | @@ -160,8 +166,10 @@ |
672 | <!-- ==== 8. VERIFY THAT EVERYTHING IS DONE ==== --> |
673 | <assert id="smoke_test_sale_order" model="sale.order" string="the sale order's picking is now done"> |
674 | <test expr="picking_ids[0].state">done</test> |
675 | + <test expr="shipped == True"/> |
676 | + <test expr="invoiced == True"/> |
677 | </assert> |
678 | - |
679 | + |
680 | <assert id="smoke_test_sale_order" model="sale.order" string="the sale order is now done"> |
681 | <test expr="state">done</test> |
682 | </assert> |
Resubmitting, as requested during the IRC meeting last Friday.