diff options
| author | Nimesh (Open ERP) <nco@tinyerp.com> | 2012-11-21 11:16:47 +0530 |
|---|---|---|
| committer | Nimesh (Open ERP) <nco@tinyerp.com> | 2012-11-21 11:16:47 +0530 |
| commit | 542b048b3ffa8dbe1d16662a39892ea0a7d4e5b5 (patch) | |
| tree | a689b1a020202159a3fd99c64cb3b676fb46ff65 /addons | |
| parent | 8a59fa019959122b3dcb7a523382be3a1b4f4d03 (diff) | |
[IMP] group the lines for similar produt/ratio by changeing query.
bzr revid: nco@tinyerp.com-20121121054647-2k7hvqyz0s4ah45h
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 8c68abf272c..2612765b362 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -106,20 +106,19 @@ class account_analytic_line(osv.osv): last_invoice = invoice_obj.create(cr, uid, curr_invoice, context=context2) invoices.append(last_invoice) - cr.execute("SELECT product_id, user_id, to_invoice, sum(unit_amount), product_uom_id, name " \ + cr.execute("SELECT product_id, user_id, to_invoice, sum(unit_amount), product_uom_id " \ "FROM account_analytic_line as line " \ "WHERE account_id = %s " \ "AND id IN %s AND to_invoice IS NOT NULL " \ - "GROUP BY product_id, user_id, to_invoice, product_uom_id, name", (account.id, tuple(ids),)) + "GROUP BY product_id, user_id, to_invoice, product_uom_id", (account.id, tuple(ids),)) curr_line = {} - total_qty = 0 - for product_id, user_id, factor_id, qty, uom, line_name in cr.fetchall(): + for product_id, user_id, factor_id, qty, uom in cr.fetchall(): if data.get('product'): product_id = data['product'][0] product = product_obj.browse(cr, uid, product_id, context=context2) if not product: - raise osv.except_osv(_('Error!'), _('There is no product defined for the line %s. Please select one or force the product through the wizard.') % (line_name)) + raise osv.except_osv(_('Error!'), _('There is no product defined for the line. Please select one or force the product through the wizard.')) factor = invoice_factor_obj.browse(cr, uid, factor_id, context=context2) factor_name = product_obj.name_get(cr, uid, [product_id], context=context2)[0][1] if factor.customer_name: @@ -136,10 +135,6 @@ class account_analytic_line(osv.osv): taxes = product.taxes_id or general_account.tax_ids tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes) invoice_line_ids = invoice_line_obj.search(cr, uid, [('product_id', '=', product.id), ('invoice_id', '=', last_invoice)]) - total_qty +=qty - if invoice_line_ids: - invoice_line_obj.write(cr, uid, invoice_line_ids, {'quantity': total_qty}) - continue curr_line = { 'price_unit': price, 'quantity': qty, |
