Merge lp:~agilebg/account-invoice-report/7.0-bug-1284049-hurrinico into lp:~account-core-editors/account-invoice-report/7.0

Proposed by Nicola Malcontenti - Agile BG
Status: Merged
Merged at revision: 56
Proposed branch: lp:~agilebg/account-invoice-report/7.0-bug-1284049-hurrinico
Merge into: lp:~account-core-editors/account-invoice-report/7.0
Diff against target: 112 lines (+79/-2)
3 files modified
account_invoice_production_lot/__openerp__.py (+1/-0)
account_invoice_production_lot/invoice.py (+7/-2)
account_invoice_production_lot/test/sale.yml (+71/-0)
To merge this branch: bzr merge lp:~agilebg/account-invoice-report/7.0-bug-1284049-hurrinico
Reviewer Review Type Date Requested Status
Lorenzo Battistini (community) code review Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+208753@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM.

Is there any chance I could convince you to write an automated test for this?

review: Approve (code review, no test)
Revision history for this message
Nicola Malcontenti - Agile BG (hurrin1c0) wrote :

> LGTM.
>
> Is there any chance I could convince you to write an automated test for this?

Sorry i forgot it, i'll made soon

51. By Hurrinico

[FIX] Fixed Tests

Revision history for this message
Nicola Malcontenti - Agile BG (hurrin1c0) wrote :

> LGTM.
>
> Is there any chance I could convince you to write an automated test for this?
Hi Alexandre,
Sorry For the late, i have write the automated test for checking the bug.

Regards.
-N.

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Nico,

line 74,76: I think you should use 'lot_icecream_0' and 'lot_icecream_1'

line 91: you are writing 'prodlot_id' field with another lot, but I think it's unnecessary, as lots are already assigned by 'stock.move.split' wizard.

line 115: the test is checking if the invoice lines are 2, but the bug said
"Now the 2 different serial number will be repeat for each invoice line, while each line must have only its serial"
So, the test should check if every invoice line has got only one lot

line 112: 'ac' is unnecessary

Thanks

review: Needs Fixing
52. By Hurrinico

[FIX] Mod tests

53. By Hurrinico

[FIX] Minor fixing

Revision history for this message
Lorenzo Battistini (elbati) wrote :

just remove "name = ''" at line 110

Thanks!

review: Approve (code review)
54. By Hurrinico

[FIX] Remove name

Revision history for this message
Nicola Malcontenti - Agile BG (hurrin1c0) wrote :

Tests should be ready

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_invoice_production_lot/__openerp__.py'
2--- account_invoice_production_lot/__openerp__.py 2014-01-02 10:03:31 +0000
3+++ account_invoice_production_lot/__openerp__.py 2014-04-14 15:24:01 +0000
4@@ -29,6 +29,7 @@
5 "depends": [
6 "sale_stock",
7 "invoice_webkit",
8+ "stock_picking_invoice_link",
9 ],
10 "author": "Agile Business Group",
11 "summary": "Display delivered serial numbers in invoice",
12
13=== modified file 'account_invoice_production_lot/invoice.py'
14--- account_invoice_production_lot/invoice.py 2014-01-02 10:03:31 +0000
15+++ account_invoice_production_lot/invoice.py 2014-04-14 15:24:01 +0000
16@@ -30,10 +30,15 @@
17 result = {}
18 for line in self.browse(cr, uid, ids, context=context):
19 result[line.id] = []
20- for order_line in line.order_lines:
21- for move in order_line.move_ids:
22+ if line.move_line_ids:
23+ for move in line.move_line_ids:
24 if move.prodlot_id:
25 result[line.id].append(move.prodlot_id.id)
26+ else:
27+ for order_line in line.order_lines:
28+ for move in order_line.move_ids:
29+ if move.prodlot_id:
30+ result[line.id].append(move.prodlot_id.id)
31 return result
32
33 _inherit = "account.invoice.line"
34
35=== modified file 'account_invoice_production_lot/test/sale.yml'
36--- account_invoice_production_lot/test/sale.yml 2013-10-15 15:40:02 +0000
37+++ account_invoice_production_lot/test/sale.yml 2014-04-14 15:24:01 +0000
38@@ -75,3 +75,74 @@
39 for invoice in order.invoice_ids:
40 invoice.load_lines_lots()
41 assert invoice.invoice_line[0].formatted_note == '<ul> <li>S/N Lot0 for Ice cream</li> </ul>', "Wrgong formatted note for '%s' line" % invoice.invoice_line[0].name
42+-
43+ I create a new draft Sale Order
44+-
45+ !record {model: sale.order, id: sale_order_2}:
46+ partner_id: base.res_partner_2
47+ partner_invoice_id: base.res_partner_address_3
48+ partner_shipping_id: base.res_partner_address_3
49+ pricelist_id: 1
50+ order_policy: picking
51+ order_line:
52+ - product_id: product_icecream
53+ product_uom_qty: 2.0
54+ product_uom: 1
55+ price_unit: 100.0
56+-
57+ !record {model: stock.production.lot, id: lot_icecream_1}:
58+ name: Lot1 for Ice cream
59+ product_id: product_icecream
60+-
61+ I confirm the quotation with Invoice based on deliveries policy.
62+-
63+ !workflow {model: sale.order, action: order_confirm, ref: sale_order_2}
64+-
65+ Now, I split serial number.
66+-
67+ !python {model: stock.picking}: |
68+ order = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_2"))
69+ move_ids = [x.id for x in order.picking_ids[0].move_lines]
70+ context.update({'active_model': 'stock.move', 'active_id': move_ids[0], 'active_ids': move_ids})
71+-
72+ !record {model: stock.move.split, id: split_lot_incomming}:
73+ line_ids:
74+ - name: lot_icecream_0
75+ quantity: 1
76+ - name: lot_icecream_1
77+ quantity: 1
78+
79+-
80+ !python {model: stock.move.split }: |
81+ self.split_lot(cr, uid, [ref('split_lot_incomming')], context=context)
82+-
83+ Now, I dispatch delivery order.
84+-
85+ !python {model: stock.partial.picking}: |
86+ order = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_2"))
87+ for pick in order.picking_ids:
88+ data = pick.force_assign()
89+ if data == True:
90+ partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
91+ self.do_partial(cr, uid, [partial_id])
92+-
93+ I create Invoice from Delivery Order.
94+-
95+ !python {model: stock.invoice.onshipping}: |
96+ sale = self.pool.get('sale.order')
97+ sale_order = sale.browse(cr, uid, ref("sale_order_2"))
98+ ship_ids = [x.id for x in sale_order.picking_ids]
99+ wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
100+ {'active_ids': ship_ids, 'active_model': 'stock.picking'})
101+ self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]})
102+-
103+ I check the invoice lines.
104+-
105+ !python {model: sale.order}: |
106+ order = self.browse(cr, uid, ref("sale_order"))
107+ assert order.invoice_ids, "Invoice is not created."
108+ for invoice in order.invoice_ids:
109+ invoice.load_lines_lots()
110+ for line in invoice.invoice_line:
111+ assert len(line.prod_lot_ids) == 1,"there must be one lot only"
112+

Subscribers

People subscribed via source and target branches