diff --git a/addons/account/account.py b/addons/account/account.py index aa0a27ad76d..8d7912356a6 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -19,7 +19,7 @@ # ############################################################################## import time -from datetime import datetime +from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta from operator import itemgetter @@ -79,9 +79,19 @@ class account_payment_term(osv.osv): elif line.value == 'balance': amt = round(amount, prec) if amt: - next_date = datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days) + next_date = (datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days)) if line.days2 < 0: - next_date += relativedelta(day=line.days2) + nyear = next_date.strftime("%Y") + nmonth = str(int(next_date.strftime("%m"))% 12+1) + nday = "1" + + ndate = "%s-%s-%s" % (nyear, nmonth, nday) + nseconds = time.mktime(time.strptime(ndate, '%Y-%m-%d')) + next_month = datetime.fromtimestamp(nseconds) + + delta = timedelta(seconds=1) + next_date = next_month - delta + next_date = next_date + relativedelta(days=line.days2) if line.days2 > 0: next_date += relativedelta(day=line.days2, months=1) result.append( (next_date.strftime('%Y-%m-%d'), amt) ) @@ -1236,7 +1246,7 @@ class account_move(osv.osv): return amount def _centralise(self, cr, uid, move, mode, context=None): - assert(mode in ('debit', 'credit'), 'Invalid Mode') #to prevent sql injection + assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection if context is None: context = {} diff --git a/addons/account/invoice.py b/addons/account/invoice.py index d40d4037c97..35437fa019a 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -462,7 +462,7 @@ class account_invoice(osv.osv): date_invoice = time.strftime('%Y-%m-%d') pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice) - + if pterm_list: pterm_list = [line[0] for line in pterm_list] pterm_list.sort() diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 65223706f40..3fe3e34cfe7 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -307,7 +307,13 @@ account.analytic.journal search - + + + + + + + @@ -334,6 +340,7 @@ account.analytic.journal form tree,form,search + diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 515c9edf8c0..a70d79cdd40 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -49,18 +49,17 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): self.query = data['form'].get('query_line', '') self.direction_selection = data['form'].get('direction_selection', 'past') self.date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d')) + if (data['form']['result_selection'] == 'customer' ): + self.ACCOUNT_TYPE = ['receivable'] + elif (data['form']['result_selection'] == 'supplier'): + self.ACCOUNT_TYPE = ['payable'] + else: + self.ACCOUNT_TYPE = ['payable','receivable'] return super(aged_trial_report, self).set_context(objects, data, ids, report_type=report_type) def _get_lines(self, form): res = [] account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') - if (form['result_selection'] == 'customer' ): - self.ACCOUNT_TYPE = ['receivable'] - elif (form['result_selection'] == 'supplier'): - self.ACCOUNT_TYPE = ['payable'] - else: - self.ACCOUNT_TYPE = ['payable','receivable'] - self.cr.execute('SELECT DISTINCT res_partner.id AS id,\ res_partner.name AS name \ FROM res_partner,account_move_line AS l, account_account\ @@ -129,8 +128,8 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header): # Use one query per period and store results in history (a list variable) # Each history will contain : history[1] = {'': } - history = [] - for i in range(5): + history = [] + for i in range(5): self.cr.execute('SELECT partner_id, SUM(debit-credit)\ FROM account_move_line AS l, account_account\ WHERE (l.account_id = account_account.id)\ diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index bcc9c75be57..076369f7e10 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -67,7 +67,7 @@ class account_balance(report_sxw.rml_parse, common_report_header): return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name return super(account_balance ,self)._get_account(data) - def lines(self, form, ids=[], done=None, level=1): + def lines(self, form, ids=[], done=None):#, level=1): obj_account = self.pool.get('account.account') if not ids: ids = self.ids @@ -94,7 +94,7 @@ class account_balance(report_sxw.rml_parse, common_report_header): child_ids = obj_account._get_children_and_consol(self.cr, self.uid, ids, ctx) if child_ids: ids = child_ids - accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id'], ctx) + accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id','level'], ctx) for account in accounts: if account['id'] in done: continue @@ -104,7 +104,7 @@ class account_balance(report_sxw.rml_parse, common_report_header): 'type': account['type'], 'code': account['code'], 'name': account['name'], - 'level': level, + 'level': account['level'], 'debit': account['debit'], 'credit': account['credit'], 'balance': account['balance'], @@ -124,12 +124,12 @@ class account_balance(report_sxw.rml_parse, common_report_header): # return False # if not _check_rec(account) : # continue - if account['parent_id']: +# if account['parent_id']: # acc = obj_account.read(self.cr, self.uid, [ account['parent_id'][0] ] ,['name'], ctx) - for r in result_acc: - if r['id'] == account['parent_id'][0]: - res['level'] = r['level'] + 1 - break +# for r in result_acc: +# if r['id'] == account['parent_id'][0]: +# res['level'] = r['level'] + 1 +# break if form['display_account'] == 'bal_movement': if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 : result_acc.append(res) diff --git a/addons/account/report/voucher_print.rml b/addons/account/report/voucher_print.rml index 795fd678645..028575c81f2 100644 --- a/addons/account/report/voucher_print.rml +++ b/addons/account/report/voucher_print.rml @@ -170,7 +170,7 @@ Dated : - [[ time.strftime('%d %B,%Y', time.strptime(voucher.date , '%Y-%m-%d')) or '' ]] + [[ formatLang(voucher.date, date=True) or '' ]] diff --git a/addons/account/wizard/account_statement_from_invoice.py b/addons/account/wizard/account_statement_from_invoice.py index 0523b5f60ca..a409bb77f89 100644 --- a/addons/account/wizard/account_statement_from_invoice.py +++ b/addons/account/wizard/account_statement_from_invoice.py @@ -92,7 +92,7 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'ref': line.ref, 'reconcile_id': reconcile_id, 'date': time.strftime('%Y-%m-%d'), #time.strftime('%Y-%m-%d'), #line.date_maturity or, - }, context=context) + }, context=context) return {} account_statement_from_invoice_lines() @@ -107,10 +107,10 @@ class account_statement_from_invoice(osv.osv_memory): 'date': fields.date('Date payment',required=True), 'journal_ids': fields.many2many('account.journal', 'account_journal_relation', 'account_id', 'journal_id', 'Journal'), 'line_ids': fields.many2many('account.move.line', 'account_move_line_relation', 'move_id', 'line_id', 'Invoices'), - } + } _defaults = { 'date':lambda *a: time.strftime('%Y-%m-%d'), - } + } def search_invoices(self, cr, uid, ids, context=None): @@ -167,4 +167,4 @@ class account_statement_from_invoice(osv.osv_memory): } account_statement_from_invoice() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_statement_from_invoice_view.xml b/addons/account/wizard/account_statement_from_invoice_view.xml index b1c0e68534e..c5f42851e69 100644 --- a/addons/account/wizard/account_statement_from_invoice_view.xml +++ b/addons/account/wizard/account_statement_from_invoice_view.xml @@ -1,33 +1,33 @@ - + account.statement.from.invoice.form account.statement.from.invoice form
- - - - - + + + + + -