Merge lp:~openerp-dev/openobject-addons/trunk-wmsimplement-seduce-fp-service-product-sunil into lp:~openerp-dev/openobject-addons/trunk-wmsimplement-seduce-fp

Proposed by Sunil Sharma(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-wmsimplement-seduce-fp-service-product-sunil
Merge into: lp:~openerp-dev/openobject-addons/trunk-wmsimplement-seduce-fp
Diff against target: 90 lines (+43/-8) (has conflicts)
2 files modified
sale_stock/sale_stock.py (+23/-0)
sale_stock/test/picking_order_policy.yml (+20/-8)
Text conflict in sale_stock/sale_stock.py
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-wmsimplement-seduce-fp-service-product-sunil
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+189249@code.launchpad.net

Description of the change

Hello,

[FIX] sale_stock: bug#1167330
--> create a SO with one service and one stockable product. Invoice on delivery (second tab)
--> process the delivery. In the move you see only the product, it is ok.
--> create the invoice from the delivery.
--> right now, you see only the product. The service should be there.
[IMP] sale_stock: improved YML test case to cover this bug scenario.

Thanks
Sunil Sharma

To post a comment you must log in.
9317. By Sunil Sharma(OpenERP)

[IMP]:sale_stock:remove button_compute

9318. By Sunil Sharma(OpenERP)

[IMP]:sale_stock:remove space

9319. By Sunil Sharma(OpenERP)

[Merge] lp:~openerp-dev/openobject-addons/trunk-wmsimplement-seduce-fp

9320. By Sunil Sharma(OpenERP)

[IMP]:sale_stock:add button_compute

9321. By Sunil Sharma(OpenERP)

[MRG] merge with parent branch

9322. By jke-openerp

[REF] add invoice_lines keeping potential historic and detail in test picking_order_policy.yml why len -1

9323. By jke-openerp

[FIX] bug due to my last commit (compare product with product.type)

9324. By jke-openerp

.

Unmerged revisions

9324. By jke-openerp

.

9323. By jke-openerp

[FIX] bug due to my last commit (compare product with product.type)

9322. By jke-openerp

[REF] add invoice_lines keeping potential historic and detail in test picking_order_policy.yml why len -1

9321. By Sunil Sharma(OpenERP)

[MRG] merge with parent branch

9320. By Sunil Sharma(OpenERP)

[IMP]:sale_stock:add button_compute

9319. By Sunil Sharma(OpenERP)

[Merge] lp:~openerp-dev/openobject-addons/trunk-wmsimplement-seduce-fp

9318. By Sunil Sharma(OpenERP)

[IMP]:sale_stock:remove space

9317. By Sunil Sharma(OpenERP)

[IMP]:sale_stock:remove button_compute

9316. By Sunil Sharma(OpenERP)

[IMP]:sale_stock:improve code

9315. By Sunil Sharma(OpenERP)

[IMP]:sale_stock:[FIX] issue when we add product which is service with another stockable in SO with invoice on delivery and when after delivery we create invoice service type produc is not there in invoice line

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale_stock/sale_stock.py'
2--- sale_stock/sale_stock.py 2013-10-16 10:03:18 +0000
3+++ sale_stock/sale_stock.py 2013-10-17 12:03:30 +0000
4@@ -437,6 +437,7 @@
5 res['price_unit'] = sale_line.price_unit
6 res['discount'] = sale_line.discount
7 return res
8+<<<<<<< TREE
9
10
11 class stock_location_route(osv.osv):
12@@ -444,3 +445,25 @@
13 _columns = {
14 'sale_selectable':fields.boolean("Selectable on Sales Order Line")
15 }
16+=======
17+
18+class stock_picking(osv.osv):
19+ _inherit = 'stock.picking'
20+
21+ def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None):
22+ invoice_id = super(stock_picking, self)._create_invoice_from_picking(cr, uid, picking, vals, context=context)
23+ order_line_obj = self.pool.get('sale.order.line')
24+ invoice_obj = self.pool.get('account.invoice')
25+ invoice_line_obj = self.pool.get('account.invoice.line')
26+ service_line_ids = order_line_obj.search(cr, uid, [('product_id.type', '=' , 'service'), ('order_id.procurement_group_id', '=' , picking.group_id.id),('invoiced', '=' , False)], context=context)
27+ for sale_line in order_line_obj.browse(cr, uid, service_line_ids, context=context):
28+ vals = order_line_obj._prepare_order_line_invoice_line(cr, uid, sale_line, False, context=context)
29+ vals['invoice_id'] = invoice_id
30+ invoice_line_id = invoice_line_obj.create(cr, uid, vals, context=context)
31+ order_line_obj.write(cr, uid, [sale_line.id], {
32+ 'invoice_lines': [(4, invoice_line_id)],
33+ }, context=context)
34+ invoice_obj.button_compute(cr, uid, [invoice_id], context=context)
35+ return invoice_id
36+
37+>>>>>>> MERGE-SOURCE
38
39=== modified file 'sale_stock/test/picking_order_policy.yml'
40--- sale_stock/test/picking_order_policy.yml 2013-10-10 13:32:12 +0000
41+++ sale_stock/test/picking_order_policy.yml 2013-10-17 12:03:30 +0000
42@@ -4,6 +4,16 @@
43 !context
44 uid: 'res_sale_stock_salesman'
45 -
46+ Add SO line with service type product in SO to check flow which contain service type product in SO(BUG#1167330).
47+-
48+ !record {model: sale.order.line,id: sale_order_1}:
49+ name: 'On Site Assistance'
50+ product_id: product.product_product_2
51+ product_uom_qty: 1.0
52+ product_uom: 1
53+ price_unit: 150.0
54+ order_id: sale.sale_order_6
55+-
56 First I check the total amount of the Quotation before Approved.
57 -
58 !assert {model: sale.order, id: sale.sale_order_6, string: The amount of the Quotation is not correctly computed}:
59@@ -34,13 +44,15 @@
60 from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
61 order = self.browse(cr, uid, ref("sale.sale_order_6"))
62 for order_line in order.order_line:
63- procurement = order_line.procurement_ids[0]
64- date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
65- date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
66- assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
67- assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
68- assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
69- assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
70+ #For service type product we now create procurement in project_mrp module.
71+ if order_line.procurement_ids:
72+ procurement = order_line.procurement_ids[0]
73+ date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
74+ date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
75+ assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
76+ assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
77+ assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
78+ assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
79 -
80 Only stock user can change data related warehouse therefore test with that user which have stock user rights,
81 -
82@@ -73,7 +85,7 @@
83 assert picking.partner_id.id == sale_order.partner_shipping_id.id,"Shipping Address is not correspond with sale order."
84 assert picking.note == sale_order.note,"Note is not correspond with sale order."
85 assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice policy is not correspond with sale order."
86- assert len(picking.move_lines) == len(sale_order.order_line), "Total move of delivery order are not corresposning with total sale order lines."
87+ assert len(picking.move_lines) == len([ol for ol in sale_order.order_line if ol.product_id.type != 'service']), "Total move of delivery order are not corresposning with total sale order lines for product."
88 location_id = sale_order.warehouse_id.lot_stock_id.id
89 for move in picking.move_lines:
90 order_line = move.procurement_id.sale_line_id

Subscribers

People subscribed via source and target branches