openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #20228
[Bug 1092448] Re: Invoice created incorrectly with option - Generate invoices after and based on delivery orders
*** This bug is a duplicate of bug 1088807 ***
https://bugs.launchpad.net/bugs/1088807
Hello, for this bug, I have investigate and found that
* If Generate invoices after and based on delivery orders = YES, the
invoice will be generated twice, from both the DO Lines, and the SO
Lines. So give it double of lines.
I have do the following change (put "continue" syntax to avoid Invoice
Lines from SO Lines) and the result is OK. But for this one I am not
very sure it will effect other modules.
--> addons/sale_stock/stock.py
===========================
def action_invoice_create(self, cursor, user, ids, journal_id=False,
group=False, type='out_invoice', context=None):
if context is None:
context = {}
invoice_obj = self.pool.get('account.invoice')
picking_obj = self.pool.get('stock.picking')
invoice_line_obj = self.pool.get('account.invoice.line')
fiscal_position_obj = self.pool.get('account.fiscal.position')
order_line_obj = self.pool.get('sale.order.line')
result = super(stock_picking, self).action_invoice_create(cursor, user,
ids, journal_id=journal_id, group=group, type=type,
context=context)
picking_ids = result.keys()
invoice_ids = result.values()
invoices = {}
for invoice in invoice_obj.browse(cursor, user, invoice_ids,
context=context):
invoices[invoice.id] = invoice
for picking in picking_obj.browse(cursor, user, picking_ids,
context=context):
if not picking.sale_id or picking.backorder_id:
continue
sale_lines = picking.sale_id.order_line
invoice_created = invoices[result[picking.id]]
if picking.sale_id.user_id:
invoice_obj.write(cursor, user, [invoice_created.id], {'user_id': picking.sale_id.user_id.id}, context=context)
if picking.sale_id.fiscal_position:
invoice_obj.write(cursor, user, [invoice_created.id], {'fiscal_position': picking.sale_id.fiscal_position.id}, context=context)
if picking.sale_id.client_order_ref:
inv_name = picking.sale_id.client_order_ref + " : " + invoice_created.name
invoice_obj.write(cursor, user, [invoice_created.id], {'name': inv_name}, context=context)
# start kittiu
continue
# end kittiu
for sale_line in sale_lines:
account_id = False
if not type:
....................
=============================
The code from "for sale_line in sale_lines:" seem to be intentionally
written, but it is obviously create this error. So, I leave it to expert
to help :).
Thank you,
Kitti U.
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1092448
Title:
Invoice created incorrectly with option - Generate invoices after and
based on delivery orders
Status in OpenERP Addons (modules):
New
Bug description:
Version 7
(Build 2830)
server (4714)
addons (8420)
web (3640)
Config:
Fresh database install, then setting --> Generate invoices after and based on delivery orders = YES
Step:
1. Create sales order, USB Adapter = 10 units, then confirm order
2. Click "View Delivery Order" --> "Force Availability" --> "Deliver" to delivery the whole quantity
3. On Delivery Order, click "Create Invoice/Refund", click "Create"
4. On Invoice, you will see there are 2 lines each for 10 units, double our order.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1092448/+subscriptions
References