[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

bzr revid: tpa@tinyerp.com-20131003115451-bdjaw60s6bat98ra
This commit is contained in:
Turkesh Patel (Open ERP) 2013-10-03 17:24:51 +05:30
parent 4080a18ac3
commit 872b4de22c
2 changed files with 24 additions and 2 deletions

View File

@ -114,10 +114,22 @@ class stock_picking(osv.osv):
def _invoice_hook(self, cursor, user, picking, invoice_id):
sale_obj = self.pool.get('sale.order')
order_line_obj = self.pool.get('sale.order.line')
invoice_obj = self.pool.get('account.invoice')
invoice_line_obj = self.pool.get('account.invoice.line')
if picking.sale_id:
sale_obj.write(cursor, user, [picking.sale_id.id], {
'invoice_ids': [(4, invoice_id)],
})
})
for sale_line in picking.sale_id.order_line:
if sale_line.product_id.type == 'service' and not sale_line.invoiced:
vals = order_line_obj._prepare_order_line_invoice_line(cursor, user, sale_line, False)
vals['invoice_id'] = invoice_id
invoice_line_id = invoice_line_obj.create(cursor, user, vals)
order_line_obj.write(cursor, user, [sale_line.id], {
'invoice_lines': [(6, 0, [invoice_line_id])],
})
invoice_obj.button_compute(cursor, user, [invoice_id])
return super(stock_picking, self)._invoice_hook(cursor, user, picking, invoice_id)
# Redefinition of the new field in order to update the model stock.picking.out in the orm

View File

@ -1,5 +1,15 @@
-
In order to test process of the Sale Order,
-
Add SO line with service type product in SO to check flow which contain service type product in SO(BUG#1167330).
-
!record {model: sale.order.line, id: sale_order_1}:
name: 'On Site Assistance'
product_id: product.product_product_2
product_uom_qty: 1.0
product_uom: 1
price_unit: 150.0
order_id: sale.sale_order_6
-
First I check the total amount of the Quotation before Approved.
-
@ -62,7 +72,7 @@
assert picking.partner_id.id == sale_order.partner_shipping_id.id,"Shipping Address is not correspond with sale order."
assert picking.note == sale_order.note,"Note is not correspond with sale order."
assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice policy is not correspond with sale order."
assert len(picking.move_lines) == len(sale_order.order_line), "Total move of delivery order are not corresposning with total sale order lines."
assert len(picking.move_lines) == len(sale_order.order_line) - 1, "Total move of delivery order are not corresposning with total sale order lines."
location_id = sale_order.shop_id.warehouse_id.lot_stock_id.id
output_id = sale_order.shop_id.warehouse_id.lot_output_id.id
for move in picking.move_lines: