Nimesh Contractor(Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-addons22-nco into lp:openobject-addons.

Requested reviews:
  Harry (OpenERP) (hmo-tinyerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons22-nco/+merge/135317

Hello,
      
      For invoicing Group the similar line for per product/invoicing ratio.

Thanks,
 NCO.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons22-nco/+merge/135317
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-addons22-nco.
=== modified file 'account_analytic_analysis/account_analytic_analysis.py'
--- account_analytic_analysis/account_analytic_analysis.py	2012-10-28 12:17:30 +0000
+++ account_analytic_analysis/account_analytic_analysis.py	2012-11-21 05:57:56 +0000
@@ -296,11 +296,14 @@
     def _timesheet_ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None):
         lines_obj = self.pool.get('account.analytic.line')
         res = {}
+        inv_ids = []
         for account in self.browse(cr, uid, ids, context=context):
             res[account.id] = 0.0
             line_ids = lines_obj.search(cr, uid, [('account_id','=', account.id), ('invoice_id','!=',False), ('to_invoice','!=', False), ('journal_id.type', '=', 'general')], context=context)
             for line in lines_obj.browse(cr, uid, line_ids, context=context):
-                res[account.id] += line.invoice_id.amount_untaxed
+                if line.invoice_id not in inv_ids:
+                    inv_ids.append(line.invoice_id)
+                    res[account.id] += line.invoice_id.amount_untaxed
         return res
 
     def _remaining_ca_calc(self, cr, uid, ids, name, arg, context=None):

=== modified file 'analytic_contract_hr_expense/analytic_contract_hr_expense.py'
--- analytic_contract_hr_expense/analytic_contract_hr_expense.py	2012-06-25 06:32:33 +0000
+++ analytic_contract_hr_expense/analytic_contract_hr_expense.py	2012-11-21 05:57:56 +0000
@@ -136,6 +136,7 @@
             'name': name,
             'view_type': 'form',
             'view_mode': 'tree,form',
+            'context':{'analytic_account':ids[0]},
             'domain' : domain,
             'res_model': 'hr.expense.expense',
             'nodestroy': True,

=== modified file 'hr_expense/hr_expense_view.xml'
--- hr_expense/hr_expense_view.xml	2012-11-15 12:38:51 +0000
+++ hr_expense/hr_expense_view.xml	2012-11-21 05:57:56 +0000
@@ -85,7 +85,7 @@
                     </group>
                     <notebook>
                         <page string="Description">
-                            <field name="line_ids" context="{'currency_id': currency_id}">
+                            <field name="line_ids" context="{'currency_id': currency_id, 'default_analytic_account': context.get('analytic_account')}">
                                 <form string="Expense Lines" version="7.0">
                                     <group>
                                         <group>

=== modified file 'hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py'
--- hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py	2012-10-30 11:26:32 +0000
+++ hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py	2012-11-21 05:57:56 +0000
@@ -106,18 +106,19 @@
             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),))
 
-            for product_id, user_id, factor_id, qty, uom, line_name in cr.fetchall():
+            curr_line = {}
+            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:
@@ -133,6 +134,7 @@
                     raise osv.except_osv(_("Configuration Error!"), _("Please define income account for product '%s'.") % product.name)
                 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)])
                 curr_line = {
                     'price_unit': price,
                     'quantity': qty,
@@ -175,7 +177,6 @@
 
             invoice_obj.button_reset_taxes(cr, uid, [last_invoice], context)
         return invoices
-
 #
 # TODO: check unit of measure !!!
 #

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to