diff --git a/addons/account/account.py b/addons/account/account.py index 3959799f1bb..e92bd3a7879 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1670,7 +1670,7 @@ class account_move_reconcile(osv.osv): elif reconcile.line_partial_ids: first_partner = reconcile.line_partial_ids[0].partner_id.id move_lines = reconcile.line_partial_ids - if any([line.partner_id.id != first_partner for line in move_lines]): + if any([(line.account_id.type in ('receivable', 'payable') and line.partner_id.id != first_partner) for line in move_lines]): return False return True diff --git a/addons/account/account_financial_report_data.xml b/addons/account/account_financial_report_data.xml index 6410a5e887c..e8ff33151c3 100644 --- a/addons/account/account_financial_report_data.xml +++ b/addons/account/account_financial_report_data.xml @@ -6,16 +6,19 @@ --> Profit and Loss + sum Income + detail_with_hierarchy account_type Expense + detail_with_hierarchy account_type diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 006e2c55f5f..d6c25364784 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -626,7 +626,7 @@ class account_move_line(osv.osv): (_check_date, 'The date of your Journal Entry is not in the defined period! You should change the date or remove this constraint from the journal.', ['date']), (_check_currency, 'The selected account of your Journal Entry forces to provide a secondary currency. You should remove the secondary currency on the account or select a multi-currency view on the journal.', ['currency_id']), (_check_currency_and_amount, "You cannot create journal items with a secondary currency without recording both 'currency' and 'amount currency' field.", ['currency_id','amount_currency']), - (_check_currency_amount, 'The amount expressed in the secondary currency must be positif when journal item are debit and negatif when journal item are credit.', ['amount_currency']), + (_check_currency_amount, 'The amount expressed in the secondary currency must be positive when the journal item is a debit and negative when if it is a credit.', ['amount_currency']), (_check_currency_company, "You cannot provide a secondary currency if it is the same than the company one." , ['currency_id']), ] diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 33ab3be209c..be1e0aac402 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -259,17 +259,14 @@ class account_analytic_account(osv.osv): return res if child_ids: - cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount), 0.0) \ - FROM account_analytic_line \ - JOIN account_analytic_journal \ - ON account_analytic_line.journal_id = account_analytic_journal.id \ - WHERE account_analytic_line.account_id IN %s \ - AND account_analytic_journal.type = 'sale' \ - GROUP BY account_analytic_line.account_id", (child_ids,)) - for account_id, sum in cr.fetchall(): - res[account_id] = round(sum,2) + #Search all invoice lines not in cancelled state that refer to this analytic account + inv_line_obj = self.pool.get("account.invoice.line") + inv_lines = inv_line_obj.search(cr, uid, ['&', ('account_analytic_id', 'in', child_ids), ('invoice_id.state', '!=', 'cancel')], context=context) + for line in inv_line_obj.browse(cr, uid, inv_lines, context=context): + res[line.account_analytic_id.id] += line.price_subtotal for acc in self.browse(cr, uid, res.keys(), context=context): res[acc.id] = res[acc.id] - (acc.timesheet_ca_invoiced or 0.0) + res_final = res return res_final @@ -633,6 +630,21 @@ class account_analytic_account(osv.osv): pass return result + + def hr_to_invoice_timesheets(self, cr, uid, ids, context=None): + domain = [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'general'), ('account_id', 'in', ids)] + names = [record.name for record in self.browse(cr, uid, ids, context=context)] + name = _('Timesheets to Invoice of %s') % ','.join(names) + return { + 'type': 'ir.actions.act_window', + 'name': name, + 'view_type': 'form', + 'view_mode': 'tree,form', + 'domain' : domain, + 'res_model': 'account.analytic.line', + 'nodestroy': True, + } + def _prepare_invoice(self, cr, uid, contract, context=None): context = context or {} diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index d31746e7e70..cd4be740815 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -98,8 +98,8 @@ -