diff --git a/addons/account/account.py b/addons/account/account.py index 9b728ff36e0..2fbc32b1bfd 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1023,7 +1023,10 @@ class account_period(osv.osv): if not result: result = self.search(cr, uid, args, context=context) if not result: - raise osv.except_osv(_('Error!'), _('There is no period defined for this date: %s.\nPlease create one.')%dt) + model, action_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'account', 'action_account_fiscalyear') + msg = _('There is no period defined for this date: %s.\nPlease, go to Configuration/Periods and configure a fiscal year.') % dt + raise openerp.exceptions.RedirectWarning(msg, action_id, _('Go to the configuration panel')) + return result def action_draft(self, cr, uid, ids, *args): @@ -3184,11 +3187,14 @@ class wizard_multi_charts_accounts(osv.osv_memory): def _get_analytic_journal(journal_type): # Get the analytic journal data = False - if journal_type in ('sale', 'sale_refund'): - data = obj_data.get_object_reference(cr, uid, 'account', 'analytic_journal_sale') - elif journal_type in ('purchase', 'purchase_refund'): - pass - elif journal_type == 'general': + try: + if journal_type in ('sale', 'sale_refund'): + data = obj_data.get_object_reference(cr, uid, 'account', 'analytic_journal_sale') + elif journal_type in ('purchase', 'purchase_refund'): + data = obj_data.get_object_reference(cr, uid, 'account', 'exp') + elif journal_type == 'general': + pass + except ValueError: pass return data and data[1] or False diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index cb242942656..b48e842caf5 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -849,18 +849,17 @@ class account_move_line(osv.osv): (tuple(ids), )) r = cr.fetchall() #TODO: move this check to a constraint in the account_move_reconcile object + if len(r) != 1: + raise osv.except_osv(_('Error'), _('Entries are not of the same account or already reconciled ! ')) if not unrec_lines: raise osv.except_osv(_('Error!'), _('Entry is already reconciled.')) account = account_obj.browse(cr, uid, account_id, context=context) + if not account.reconcile: + raise osv.except_osv(_('Error'), _('The account is not defined to be reconciled !')) if r[0][1] != None: raise osv.except_osv(_('Error!'), _('Some entries are already reconciled.')) - if context.get('fy_closing'): - # We don't want to generate any write-off when being called from the - # wizard used to close a fiscal year (and it doesn't give us any - # writeoff_acc_id). - pass - elif (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \ + if (not currency_obj.is_zero(cr, uid, account.company_id.currency_id, writeoff)) or \ (account.currency_id and (not currency_obj.is_zero(cr, uid, account.currency_id, currency))): if not writeoff_acc_id: raise osv.except_osv(_('Warning!'), _('You have to provide an account for the write off/exchange difference entry.')) @@ -1199,7 +1198,7 @@ class account_move_line(osv.osv): break # Automatically convert in the account's secondary currency if there is one and # the provided values were not already multi-currency - if account.currency_id and (vals.get('amount_currency', False) is False) and account.currency_id.id != account.company_id.currency_id.id: + if account.currency_id and 'amount_currency' not in vals and account.currency_id.id != account.company_id.currency_id.id: vals['currency_id'] = account.currency_id.id ctx = {} if 'date' in vals: diff --git a/addons/account/account_unit_test.xml b/addons/account/account_unit_test.xml index 7795c2700cc..5fb1c55b669 100644 --- a/addons/account/account_unit_test.xml +++ b/addons/account/account_unit_test.xml @@ -8,7 +8,7 @@ draft - out_invoice + in_invoice Test invoice 1 diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 60821c2b454..1ebf75ab5fa 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1211,6 +1211,7 @@ account.move.line + tree @@ -1600,7 +1601,6 @@ @@ -58,10 +31,11 @@ account.analytic.entries.graph analytic.entries.report - - - - + + + + + @@ -69,7 +43,7 @@ Analytic Entries Analysis analytic.entries.report form - tree,graph + graph {'search_default_year':1,'search_default_month':1, 'group_by_no_leaf':1, 'search_default_Account':1, 'search_default_Month':1, 'group_by':[]} From this view, have an analysis of your different analytic entries following the analytic account you defined matching your business need. Use the tool search to analyse information about analytic entries generated in the system. diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index 66959051ea4..2d1af681062 100644 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -38,8 +38,8 @@ account.entries.report.graph account.entries.report - - + + @@ -103,9 +103,9 @@ Entries Analysis account.entries.report form - tree,graph + graph - + {'group_by':[], 'search_default_usertype':1, 'search_default_thisyear':1, 'group_by_no_leaf':1} From this view, have an analysis of your different financial accounts. The document shows your debit and credit taking in consideration some criteria you can choose by using the search tool. diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index d8dc45f9a3b..8fecf85ee0b 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -55,11 +55,6 @@ class account_invoice_report(osv.osv): _columns = { 'date': fields.date('Date', readonly=True), - 'year': fields.char('Year', size=4, readonly=True), - 'day': fields.char('Day', size=128, readonly=True), - 'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), - ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), - ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True), 'product_id': fields.many2one('product.product', 'Product', readonly=True), 'product_qty':fields.float('Qty', readonly=True), 'uom_name': fields.char('Reference Unit of Measure', size=128, readonly=True), @@ -105,7 +100,7 @@ class account_invoice_report(osv.osv): def _select(self): select_str = """ - SELECT sub.id, sub.date, sub.year, sub.month, sub.day, sub.product_id, sub.partner_id, sub.country_id, + SELECT sub.id, sub.date, sub.product_id, sub.partner_id, sub.country_id, sub.payment_term, sub.period_id, sub.uom_name, sub.currency_id, sub.journal_id, sub.fiscal_position, sub.user_id, sub.company_id, sub.nbr, sub.type, sub.state, sub.categ_id, sub.date_due, sub.account_id, sub.account_line_id, sub.partner_bank_id, @@ -118,9 +113,6 @@ class account_invoice_report(osv.osv): select_str = """ SELECT min(ail.id) AS id, ai.date_invoice AS date, - to_char(ai.date_invoice::timestamp with time zone, 'YYYY'::text) AS year, - to_char(ai.date_invoice::timestamp with time zone, 'MM'::text) AS month, - to_char(ai.date_invoice::timestamp with time zone, 'YYYY-MM-DD'::text) AS day, ail.product_id, ai.partner_id, ai.payment_term, ai.period_id, CASE WHEN u.uom_type::text <> 'reference'::text @@ -192,9 +184,6 @@ class account_invoice_report(osv.osv): def _group_by(self): group_by_str = """ GROUP BY ail.product_id, ai.date_invoice, ai.id, - to_char(ai.date_invoice::timestamp with time zone, 'YYYY'::text), - to_char(ai.date_invoice::timestamp with time zone, 'MM'::text), - to_char(ai.date_invoice::timestamp with time zone, 'YYYY-MM-DD'::text), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.account_id, ail.account_id, ai.partner_bank_id, ai.residual, diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 47ce75b4d61..24723d7fb12 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -1,47 +1,16 @@ - - account.invoice.report.tree - account.invoice.report - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - account.invoice.report.graph account.invoice.report - - - + + + + + + @@ -72,7 +41,7 @@ - + @@ -80,9 +49,9 @@ - - - + + + @@ -92,8 +61,8 @@ Invoices Analysis account.invoice.report form - tree,graph - {'search_default_period':1,'search_default_current':1, 'search_default_year': 1, 'search_default_category_product':1, 'search_default_customer':1, 'group_by':[], 'group_by_no_leaf':1,} + graph + {'search_default_current':1, 'search_default_year': 1, 'search_default_customer':1, 'group_by':[], 'group_by_no_leaf':1,} From this report, you can have an overview of the amount invoiced to your customer. The tool search can also be used to personalise your Invoices reports and so, match this analysis to your needs. diff --git a/addons/account/report/account_treasury_report_view.xml b/addons/account/report/account_treasury_report_view.xml index be6ae0dfdc9..f1c84849831 100644 --- a/addons/account/report/account_treasury_report_view.xml +++ b/addons/account/report/account_treasury_report_view.xml @@ -22,9 +22,11 @@ account.treasury.report.graph account.treasury.report - - - + + + + + @@ -43,9 +45,9 @@ Treasury Analysis account.treasury.report form - tree,graph + graph - + {'group_by':[], 'group_by_no_leaf':0} From this view, have an analysis of your treasury. It sums the balance of every accounting entries made on liquidity accounts per period. diff --git a/addons/account/res_config.py b/addons/account/res_config.py index bf28e900378..8980a31927e 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -105,6 +105,9 @@ class account_config_settings(osv.osv_memory): 'module_account_followup': fields.boolean('Manage customer payment follow-ups', help='This allows to automate letters for unpaid invoices, with multi-level recalls.\n' '-This installs the module account_followup.'), + 'module_product_email_template': fields.boolean('Send products tools and information at the invoice confirmation', + help='With this module, link your products to a template to send complete information and tools to your customer.\n' + 'For instance when invoicing a training, the training agenda and materials will automatically be send to your customers.'), 'group_proforma_invoices': fields.boolean('Allow pro-forma invoices', implied_group='account.group_proforma_invoices', help="Allows you to put invoices in pro-forma state."), diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml index ce8b41fc2da..8a5b1978ecb 100644 --- a/addons/account/res_config_view.xml +++ b/addons/account/res_config_view.xml @@ -183,6 +183,10 @@