[MERGE] [FIX] sale_stock: invoice services when invoicing on delivery order
bzr revid: tde@openerp.com-20131226100605-wk4nht7msupkyuj9
This commit is contained in:
commit
327f0fdb40
|
@ -123,10 +123,22 @@ class stock_picking(osv.osv):
|
||||||
|
|
||||||
def _invoice_hook(self, cursor, user, picking, invoice_id):
|
def _invoice_hook(self, cursor, user, picking, invoice_id):
|
||||||
sale_obj = self.pool.get('sale.order')
|
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:
|
if picking.sale_id:
|
||||||
sale_obj.write(cursor, user, [picking.sale_id.id], {
|
sale_obj.write(cursor, user, [picking.sale_id.id], {
|
||||||
'invoice_ids': [(4, invoice_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)
|
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
|
# Redefinition of the new field in order to update the model stock.picking.out in the orm
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
-
|
-
|
||||||
In order to test process of the Sale Order,
|
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.
|
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.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.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 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
|
location_id = sale_order.shop_id.warehouse_id.lot_stock_id.id
|
||||||
output_id = sale_order.shop_id.warehouse_id.lot_output_id.id
|
output_id = sale_order.shop_id.warehouse_id.lot_output_id.id
|
||||||
for move in picking.move_lines:
|
for move in picking.move_lines:
|
||||||
|
|
Loading…
Reference in New Issue