diff --git a/addons/.project b/addons/.project new file mode 100644 index 00000000000..8fc3cc934ff --- /dev/null +++ b/addons/.project @@ -0,0 +1,17 @@ + + + pso-newaddons + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py index 5084b6e2318..e8f25d84ad4 100644 --- a/addons/account/__terp__.py +++ b/addons/account/__terp__.py @@ -67,7 +67,7 @@ "product_view.xml", "account_assert_test.xml", "process/invoice_process.xml", - "process/statement_process.xml" + "process/statement_process.xml", ], "translations" : { "fr": "i18n/french_fr.csv" diff --git a/addons/account/account.py b/addons/account/account.py index 1f8428527ae..00d2ec3dcba 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1032,6 +1032,7 @@ class account_tax_code(osv.osv): _name = 'account.tax.code' _description = 'Tax Code' + _rec_name = 'code' _columns = { 'name': fields.char('Tax Case Name', size=64, required=True), 'code': fields.char('Case Code', size=16), @@ -1681,6 +1682,7 @@ class account_tax_code_template(osv.osv): _name = 'account.tax.code.template' _description = 'Tax Code Template' _order = 'code' + _rec_name = 'code' _columns = { 'name': fields.char('Tax Case Name', size=64, required=True), 'code': fields.char('Case Code', size=16), diff --git a/addons/account/account_wizard.xml b/addons/account/account_wizard.xml index 7be194e2f65..01a7f2759dd 100644 --- a/addons/account/account_wizard.xml +++ b/addons/account/account_wizard.xml @@ -86,6 +86,12 @@ + + + + + + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 4b9ab3f10d5..8e236c6879c 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -287,7 +287,7 @@ class account_invoice(osv.osv): pt_obj= self.pool.get('account.payment.term') if not date_invoice : - date_invoice = self._defaults["date_invoice"](cr,uid,{}) + date_invoice = time.strftime('%Y-%m-%d') pterm_list= pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice) @@ -857,26 +857,11 @@ class account_invoice_line(osv.osv): taxep=None lang=self.pool.get('res.partner').read(cr, uid, [partner_id])[0]['lang'] tax_obj = self.pool.get('account.tax') + part = self.pool.get('res.partner').browse(cr, uid, partner_id) if type in ('out_invoice', 'out_refund'): - part = self.pool.get('res.partner').browse(cr, uid, partner_id) - taxep = part.property_account_position and part.property_account_position.account_tax - if not taxep or not taxep.id: - tax_id = map(lambda x: x.id, res.taxes_id) - else: - tax_id = [taxep.id] - for t in res.taxes_id: - if not t.tax_group==taxep.tax_group: - tax_id.append(t.id) + tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, part, res.taxes_id) else: - part = self.pool.get('res.partner').browse(cr, uid, partner_id) - taxep = part.property_account_position and part.property_account_position.account_supplier_tax - if not taxep or not taxep.id: - tax_id = map(lambda x: x.id, res.supplier_taxes_id) - else: - tax_id = [taxep.id] - for t in res.supplier_taxes_id: - if not t.tax_group==taxep.tax_group: - tax_id.append(t.id) + tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, part, res.supplier_taxes_id) if type in ('in_invoice', 'in_refund'): result = self.product_id_change_unit_price_inv(cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=context) else: @@ -968,13 +953,8 @@ class account_invoice_line(osv.osv): return {} taxes = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids part = self.pool.get('res.partner').browse(cr, uid, partner_id) - taxep = partner.property_account_position and partner.property_account_position.account_tax - if not taxep.id: - return {'value': {'invoice_line_tax_id': map(lambda x: x.id, taxes or []) }} - res = [taxep.id] - for t in taxes: - if not t.tax_group==taxep.tax_group: - res.append(t.id) + + res = self.pool.get('account.fiscal.position').map_tax(cr, uid, part, taxes) r = {'value':{'invoice_line_tax_id': res}} return r account_invoice_line() diff --git a/addons/account/partner.py b/addons/account/partner.py index fbb4839f452..bbc79406780 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -37,16 +37,24 @@ class account_fiscal_position(osv.osv): _columns = { 'name': fields.char('Fiscal Position', size=64, translate=True, required=True), 'company_id': fields.many2one('res.company', 'Company'), - 'account_tax': fields.many2one( - 'account.tax', 'Customer Tax', - help="This account will be used as the receivable account for partners in this position", - ), - 'account_supplier_tax': fields.many2one( - 'account.tax', 'Supplier Tax', - help="This account will be used as the payable account for partners in this position", - ), - 'account_ids': fields.one2many('account.fiscal.position.account', 'position_id', 'Accounts Mapping') + 'account_ids': fields.one2many('account.fiscal.position.account', 'position_id', 'Accounts Mapping'), + 'tax_ids': fields.one2many('account.fiscal.position.tax', 'position_id', 'Taxes Mapping') } + def map_tax(self, cr, uid, partner, taxes, context={}): + if (not partner) or (not partner.property_account_position) : + return map(lambda x: x.id, taxes) + result = [] + for t in taxes: + ok = False + for tax in partner.property_account_position.tax_ids: + if tax.tax_src_id.id==t.id: + if tax.tax_dest_id: + result.append(tax.tax_dest_id.id) + ok=True + if not ok: + result.append(t.id) + return result + def map_account(self, cr, uid, partner, account_id, context={}): if (not partner) or (not partner.property_account_position) : return account_id @@ -58,6 +66,18 @@ class account_fiscal_position(osv.osv): account_fiscal_position() +class account_fiscal_position_tax(osv.osv): + _name = 'account.fiscal.position.tax' + _description = 'Fiscal Position Taxes Mapping' + _rec_name = 'position_id' + _columns = { + 'position_id': fields.many2one('account.fiscal.position', 'Fiscal Position', required=True, ondelete='cascade'), + 'tax_src_id': fields.many2one('account.tax', 'Tax Source', required=True), + 'tax_dest_id': fields.many2one('account.tax', 'Replacement Tax') + } +account_fiscal_position_tax() + + class account_fiscal_position_account(osv.osv): _name = 'account.fiscal.position.account' _description = 'Fiscal Position Accounts Mapping' diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index bfe4e80ced0..94f5f7fec00 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -11,8 +11,16 @@ - - + + + + + +
+ + + + @@ -34,8 +42,6 @@ - - diff --git a/addons/account/process/invoice_process.xml b/addons/account/process/invoice_process.xml index 5fb1c522be1..9d39c9e8be8 100644 --- a/addons/account/process/invoice_process.xml +++ b/addons/account/process/invoice_process.xml @@ -13,7 +13,7 @@ @@ -23,6 +23,7 @@ + @@ -62,10 +63,11 @@ - + + @@ -102,10 +104,18 @@ - + + + + + + + + + @@ -123,6 +133,7 @@ + @@ -169,6 +180,17 @@ + + + + + + + + + diff --git a/addons/account/process/statement_process.xml b/addons/account/process/statement_process.xml index 57cfe332531..3ee13ace8d5 100644 --- a/addons/account/process/statement_process.xml +++ b/addons/account/process/statement_process.xml @@ -78,15 +78,16 @@ + - + - - + + @@ -130,6 +131,26 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 5076fbaba87..11252b0707a 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -45,12 +45,28 @@ class journal_print(report_sxw.rml_parse): 'sum_credit': self._sum_credit }) - def lines(self, period_id, journal_id, *args): + def lines(self, period_id, journal_id, sort_selection='date', *args): + if type(period_id)==type([]): + ids_final = [] + for journal in journal_id: + for period in period_id: + ids_journal_period = self.pool.get('account.journal.period').search(self.cr,self.uid, [('journal_id','=',journal),('period_id','=',period)]) + if ids_journal_period: + self.cr.execute('update account_journal_period set state=%s where journal_id=%d and period_id=%d and state=%s', ('printed',journal,period,'draft')) + self.cr.commit() + self.cr.execute('select id from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\' order by ('+ sort_selection +'),id', (period, journal)) + ids = map(lambda x: x[0], self.cr.fetchall()) + ids_final.append(ids) + line_ids = [] + for line_id in ids_final: + a = self.pool.get('account.move.line').browse(self.cr, self.uid, line_id ) + line_ids.append(a) + return line_ids self.cr.execute('update account_journal_period set state=%s where journal_id=%d and period_id=%d and state=%s', ('printed',journal_id,period_id,'draft')) self.cr.commit() self.cr.execute('select id from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\' order by date,id', (period_id, journal_id)) ids = map(lambda x: x[0], self.cr.fetchall()) - return self.pool.get('account.move.line').browse(self.cr, self.uid, ids) + return self.pool.get('account.move.line').browse(self.cr, self.uid, ids ) def _sum_debit(self, period_id, journal_id): self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id)) @@ -60,7 +76,7 @@ class journal_print(report_sxw.rml_parse): self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print,header=False) - +report_sxw.report_sxw('report.account.journal.period.print.wiz', 'account.journal.period', 'addons/account/report/wizard_account_journal.rml', parser=journal_print,header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/aged_trial_balance.py b/addons/account/report/aged_trial_balance.py index bd04138c8bf..ee7f5555ae9 100755 --- a/addons/account/report/aged_trial_balance.py +++ b/addons/account/report/aged_trial_balance.py @@ -31,13 +31,13 @@ import rml_parse from report import report_sxw class aged_trial_report(rml_parse.rml_parse): - + def __init__(self, cr, uid, name, context): super(aged_trial_report, self).__init__(cr, uid, name, context) self.line_query = '' self.total_account = [] - - + + self.localcontext.update({ 'time': time, 'get_lines': self._get_lines, @@ -46,19 +46,19 @@ class aged_trial_report(rml_parse.rml_parse): 'get_for_period': self._get_for_period, 'get_company': self._get_company, 'get_currency': self._get_currency, - + }) - - + + def _get_lines(self, form): - + if (form['result_selection'] == 'customer' ): self.ACCOUNT_TYPE = "('receivable')" elif (form['result_selection'] == 'supplier'): self.ACCOUNT_TYPE = "('payable')" else: self.ACCOUNT_TYPE = "('payable','receivable')" - + res = [] account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') @@ -78,7 +78,7 @@ class aged_trial_report(rml_parse.rml_parse): for i in range(7): self.total_account.append(0) # - + for partner in partners: values = {} ## If choise selection is in the future @@ -94,7 +94,7 @@ class aged_trial_report(rml_parse.rml_parse): "AND account_account.active", (form['date1'], partner['id'],form['date1'], form['company_id'])) before = self.cr.fetchone() - + self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0) values['direction'] = before and before[0] or 0.0 @@ -112,7 +112,6 @@ class aged_trial_report(rml_parse.rml_parse): after = self.cr.fetchone() self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0) values['direction'] = after and after[0] or "" - #print str(values['direction']) for i in range(5): self.cr.execute("SELECT SUM(debit-credit) " \ "FROM account_move_line AS line, account_account " \ @@ -128,8 +127,6 @@ class aged_trial_report(rml_parse.rml_parse): during = self.cr.fetchone() # Ajout du compteur self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0) - - #print str(during) values[str(i)] = during and during[0] or "" self.cr.execute("SELECT SUM(debit-credit) " \ "FROM account_move_line AS line, account_account " \ @@ -145,19 +142,16 @@ class aged_trial_report(rml_parse.rml_parse): values['total'] = total and total[0] or 0.0 ## Add for total self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0) - print self.total_account,">>>>>>>>>>>>>Total>>>>>>>>>>>>>>>>" values['name'] = partner['name'] #t = 0.0 #for i in range(5)+['direction']: # t+= float(values.get(str(i), 0.0) or 0.0) #values['total'] = t - + if values['total']: - res.append(values) - + total = 0.0 - totals = {} for r in res: total += float(r['total'] or 0.0) @@ -166,24 +160,17 @@ class aged_trial_report(rml_parse.rml_parse): totals[str(i)] += float(r[str(i)] or 0.0) return res - - - def _get_total(self,pos): - print self.total_account,"========_get_total========" period = self.total_account[int(pos)] - return period + return period - def _get_direction(self,pos): - period = self.total_account[int(pos)] - return period + return period def _get_for_period(self,pos): - period = self.total_account[int(pos)] - return period + return period def _get_company(self, form): return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name @@ -194,5 +181,5 @@ class aged_trial_report(rml_parse.rml_parse): report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner', 'addons/account/report/aged_trial_balance.rml',parser=aged_trial_report,header=False) - + diff --git a/addons/account/report/central_journal.py b/addons/account/report/central_journal.py index 7b595a311a7..35cd4f83f30 100644 --- a/addons/account/report/central_journal.py +++ b/addons/account/report/central_journal.py @@ -43,20 +43,33 @@ class journal_print(report_sxw.rml_parse): 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit }) - + def lines(self, period_id, journal_id, *args): + if type(period_id)==type([]): + ids_final = [] + for journal in journal_id: + for period in period_id: + ids_journal_period = self.pool.get('account.journal.period').search(self.cr,self.uid, [('journal_id','=',journal),('period_id','=',period)]) + if ids_journal_period: + self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%d and l.journal_id=%d and l.state<>\'draft\' group by a.id, a.code, a.name, l.journal_id, l.period_id', (period, journal)) + res = self.cr.dictfetchall() + a = {'journal':self.pool.get('account.journal').browse(self.cr, self.uid, journal),'period':self.pool.get('account.period').browse(self.cr, self.uid, period)} + res[0].update(a) + ids_final.append(res) + return ids_final self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%d and l.journal_id=%d and l.state<>\'draft\' group by a.id, a.code, a.name', (period_id, journal_id)) - return self.cr.dictfetchall() - + res = self.cr.dictfetchall() + return res + def _sum_debit(self, period_id, journal_id): self.cr.execute('select sum(debit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 - + def _sum_credit(self, period_id, journal_id): self.cr.execute('select sum(credit) from account_move_line where period_id=%d and journal_id=%d and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0 report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/central_journal.rml',parser=journal_print, header=False) - +report_sxw.report_sxw('report.account.central.journal.wiz', 'account.journal.period', 'addons/account/report/wizard_central_journal.rml',parser=journal_print, header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index f4ff9f9ef45..57a355f4f93 100755 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -40,7 +40,11 @@ class general_ledger(rml_parse.rml_parse): def preprocess(self, objects, data, ids): ## + + self.borne_date = self.get_min_date(data['form']) + + ## new_ids = [] if (data['model'] == 'account.account'): @@ -54,6 +58,7 @@ class general_ledger(rml_parse.rml_parse): def __init__(self, cr, uid, name, context): super(general_ledger, self).__init__(cr, uid, name, context) + self.date_borne = {} self.query = "" self.child_ids = "" self.tot_currency = 0.0 @@ -109,6 +114,7 @@ class general_ledger(rml_parse.rml_parse): return result def get_children_accounts(self, account, form): + self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', self.ids)]) res = [] @@ -116,16 +122,17 @@ class general_ledger(rml_parse.rml_parse): ## We will make the test for period or date ## We will now make the test # - if form.has_key('fiscalyear'): + if form.has_key('fiscalyear'): ctx['fiscalyear'] = form['fiscalyear'] ctx['periods'] = form['periods'][0][2] else: ctx['date_from'] = form['date_from'] ctx['date_to'] = form['date_to'] - ## +# # self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx) + for child_id in self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', [account.id])]): child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) @@ -153,69 +160,111 @@ class general_ledger(rml_parse.rml_parse): res.append(child_account) ## - if form['soldeinit']: - ## We will now compute solde initiaux - for move in res: - SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date < '" + self.borne_date['max_date'] + "'" + " AND l.date > '" + self.borne_date['min_date'] + "'" - self.cr.execute(SOLDEINIT) - resultat = self.cr.dictfetchall() - if resultat[0] : - if resultat[0]['sum_debit'] == None: - sum_debit = 0 - else: - sum_debit = resultat[0]['sum_debit'] - if resultat[0]['sum_credit'] == None: - sum_credit = 0 - else: - sum_credit = resultat[0]['sum_credit'] - - move.init_credit = sum_credit - move.init_debit = sum_debit - - else: - move.init_credit = 0 - move.init_debit = 0 + + ## We will now compute solde initiaux + + for move in res: + + SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'" + self.cr.execute(SOLDEINIT) + resultat = self.cr.dictfetchall() + + if resultat[0] : + + if resultat[0]['sum_debit'] == None: + sum_debit = 0 + else: + + sum_debit = resultat[0]['sum_debit'] + if resultat[0]['sum_credit'] == None: + sum_credit = 0 + else: + sum_credit = resultat[0]['sum_credit'] + + move.init_credit = sum_credit + move.init_debit = sum_debit + + else: + move.init_credit = 0 + move.init_debit = 0 + ## + return res def get_min_date(self,form): + ## Get max born from account_fiscal year # - sql = """ select min(fy.date_start) from account_fiscalyear + sql = """ select min(fy.date_start) as start_date,max(fy.date_stop) as stop_date from account_fiscalyear As fy where fy.state <> 'close' """ self.cr.execute(sql) res = self.cr.dictfetchall() - borne_min = res[0]['min'] - # - ## - if form.has_key('fiscalyear'): + borne_min = res[0]['start_date'] + borne_max = res[0]['stop_date'] + if form['state'] == 'byperiod': ## This function will return the most aged date periods = form['periods'][0][2] if not periods: sql = """ - Select min(p.date_start) from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """ + Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """ """ else: periods_id = ','.join(map(str, periods)) sql = """ - Select min(p.date_start) from account_period as p where p.id in ( """ + periods_id + """) + Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """) """ self.cr.execute(sql) res = self.cr.dictfetchall() - borne_max = res[0]['min'] - else: - borne_max = form['date_from'] - date_borne = { + borne_min = res[0]['start_date'] + borne_max = res[0]['stop_date'] + elif form['state'] == 'bydate': + borne_min = form['date_from'] + borne_max = form['date_to'] + elif form['state'] == 'all': + periods = form['periods'][0][2] + if not periods: + sql = """ + Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """ + """ + else: + periods_id = ','.join(map(str, periods)) + sql = """ + Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """) + """ + self.cr.execute(sql) + res = self.cr.dictfetchall() + period_min = res[0]['start_date'] + period_max = res[0]['stop_date'] + date_min = form['date_from'] + date_max = form['date_to'] + if period_min='%s' + ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag) + self.cr.execute(sql) - res = self.cr.dictfetchall() + + res = self.cr.dictfetchall() + sum = 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') for l in res: diff --git a/addons/account/report/general_ledger.rml b/addons/account/report/general_ledger.rml index 20817dff3f3..17b9adccd4f 100755 --- a/addons/account/report/general_ledger.rml +++ b/addons/account/report/general_ledger.rml @@ -35,16 +35,15 @@ - + - - + @@ -91,244 +90,86 @@ + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] - - Date - - - Partner - - - Ref - - - Mvt - - - Entry Label - - - Debit - - - Crebit - - - Balance - + Date + Partner + Ref + Mvt + Entry Label + Debit + Crebit + Balance + [[ repeatIn(objects, 'a') ]] + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] - [[ repeatIn(objects, 'a') ]] - [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] - - - - - - - [[ o.code ]] [[ o.name ]] - - - [[ sum_debit_account(o, data['form']) or '0.0' ]] - - - [[sum_credit_account(o, data['form']) or '0.0' ]] - - - [[sum_solde_account(o, data['form']) or '0.0' ]] - - - - - - - [[ data['form']['soldeinit'] == True or removeParentNode('tr') ]] - - - - - - Balance Initial - - - - - - - - - - - - [[ o.init_debit or '0.0' ]] - - - [[ o.init_credit or '0.0' ]] - - - [[ (o.init_debit - o.init_credit) or '0.0' ]] - - - - [[ repeatIn(lines(o, data['form']), 'line') ]] - [[ line['date'] ]] - - - - [[ line['partner'] ]] - - - [[ line['ref'] ]] - - - [[ line['move'] ]] - - - [[ line['name'] ]] - - - [[ line['debit'] and line['debit'] or '0.0' ]] - - - [[ line['credit'] and line['credit'] or '0.0' ]] - - - [[ line['progress'] and line['progress'] or '0.0' ]] - - - - - + + + [[ o.code or '']] [[ o.name or '']] + + [[ sum_debit_account(o, data['form']) or '0.0' ]] + [[sum_credit_account(o, data['form']) or '0.0' ]] + [[sum_solde_account(o, data['form']) or '0.0' ]] + + + + + [[ repeatIn(lines(o, data['form']), 'line') ]] + [[ line['date'] or '' ]] + [[ line['partner'] or '']] + [[ line['ref'] or '']] + [[ line['move'] or '']] + [[ line['name'] or '' ]] + [[ line['debit'] and line['debit'] or '0.0' ]] + [[ line['credit'] and line['credit'] or '0.0' ]] + [[ line['progress'] and line['progress'] or '0.0' ]] - [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] - - - Date - - - Partner - - - Ref - - - Mvt - - - Entry Label - - - Debit - - - Crebit - - - Balance - - - Currency - - + [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] + Date + Partner + Ref + Mvt + Entry Label + Debit + Crebit + Balance + Currency + [[ repeatIn(objects, 'a') ]] - [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] - - - - - - - [[ o.code ]] [[ o.name ]] - - - [[ sum_debit_account(o, data['form']) or '0.0' ]] - - - [[sum_credit_account(o, data['form']) or '0.0' ]] - - - [[sum_solde_account(o, data['form']) or '0.0' ]] - - - - [[ sum_currency_amount_account(a, data['form']) or '0.0' ]] - - - - - - [[ data['form']['soldeinit'] == True or removeParentNode('tr') ]] - - - - - - Balance Initial - - - - - - - - - - - - [[ o.init_debit or '0.0' ]] - - - [[ o.init_credit or '0.0' ]] - - - [[ (o.init_debit - o.init_credit) or '0.0' ]] - - - - - + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] + + + + + [[ o.code or '' ]] [[ o.name or '' ]] + + [[ sum_debit_account(o, data['form']) or '0.0' ]] + [[sum_credit_account(o, data['form']) or '0.0' ]] + [[sum_solde_account(o, data['form']) or '0.0' ]] + [[ sum_currency_amount_account(a, data['form']) or '0.0' ]] + + + - [[ repeatIn(lines(o, data['form']), 'line') ]] - - [[ line['date'] ]] - - - [[ line['partner'] ]] - - - [[ line['ref'] ]] - - - [[ line['move'] ]] - - - [[ line['name'] ]] - - - [[ line['debit'] and line['debit'] or '0.0' ]] - - - [[ line['credit'] and line['credit'] or '0.0' ]] - - - [[ line['progress'] and line['progress'] or '0.0' ]] - - - [[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] ]] - - - + [[ repeatIn(lines(o, data['form']), 'line') ]] + [[ line['date'] or '' ]] + [[ line['partner'] or '' ]] + [[ line['ref'] or '']] + [[ line['move'] or '' ]] + [[ line['name'] or '' ]] + [[ line['debit'] and line['debit'] or '0.0' ]] + [[ line['credit'] and line['credit'] or '0.0' ]] + [[ line['progress'] and line['progress'] or '0.0' ]] + [[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']] - - - - + diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py index f090b18c090..3410d1ffc11 100755 --- a/addons/account/report/general_ledger_landscape.py +++ b/addons/account/report/general_ledger_landscape.py @@ -35,8 +35,8 @@ import pooler class general_ledger_landscape(rml_parse.rml_parse): _name = 'report.account.general.ledger_landscape' - - + + def preprocess(self, objects, data, ids): ## self.borne_date = self.get_min_date(data['form']) @@ -46,18 +46,19 @@ class general_ledger_landscape(rml_parse.rml_parse): new_ids = ids else: new_ids.append(data['form']['Account_list']) - + objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) - - super(general_ledger_landscape, self).preprocess(objects, data, new_ids) - + + super(general_ledger_landscape, self).preprocess(objects, data, new_ids) + def __init__(self, cr, uid, name, context): super(general_ledger_landscape, self).__init__(cr, uid, name, context) + self.date_borne = {} self.query = "" self.child_ids = "" self.tot_currency = 0.0 self.period_sql = "" - self.sold_accounts = {} + self.sold_accounts = {} self.localcontext.update( { 'time': time, 'lines': self.lines, @@ -66,7 +67,7 @@ class general_ledger_landscape(rml_parse.rml_parse): 'sum_solde_account': self._sum_solde_account, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, - 'sum_solde': self._sum_solde, + 'sum_solde': self._sum_solde, 'get_children_accounts': self.get_children_accounts, 'sum_currency_amount_account': self._sum_currency_amount_account }) @@ -75,7 +76,7 @@ class general_ledger_landscape(rml_parse.rml_parse): result = {} #for id in ids: # result.setdefault(id, False) - + for account_line in self.pool.get('account.move.line').browse(cr, uid, ids, context): # For avoid long text in the field we will limit it to 5 lines # @@ -85,7 +86,7 @@ class general_ledger_landscape(rml_parse.rml_parse): num_id_move = str(account_line.move_id.id) num_id_line = str(account_line.id) account_id = str(account_line.account_id.id) - # search the basic account + # search the basic account # We have the account ID we will search all account move line from now until this time # We are in the case of we are on the top of the account move Line cr.execute('SELECT distinct(ac.code) as code_rest,ac.name as name_rest from account_account AS ac, account_move_line mv\ @@ -103,68 +104,101 @@ class general_ledger_landscape(rml_parse.rml_parse): result[account_line.id] = concat + '...' break rup_id+=1 - - #print str(result) return result - + def get_min_date(self,form): + ## Get max born from account_fiscal year # - sql = """ select min(fy.date_start) from account_fiscalyear + sql = """ select min(fy.date_start) as start_date,max(fy.date_stop) as stop_date from account_fiscalyear As fy where fy.state <> 'close' """ self.cr.execute(sql) res = self.cr.dictfetchall() - borne_min = res[0]['min'] - # - ## - if form.has_key('fiscalyear'): + borne_min = res[0]['start_date'] + borne_max = res[0]['stop_date'] + if form['state'] == 'byperiod': ## This function will return the most aged date periods = form['periods'][0][2] if not periods: sql = """ - Select min(p.date_start) from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """ + Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """ """ else: periods_id = ','.join(map(str, periods)) sql = """ - Select min(p.date_start) from account_period as p where p.id in ( """ + periods_id + """) + Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """) """ self.cr.execute(sql) res = self.cr.dictfetchall() - borne_max = res[0]['min'] - else: - borne_max = form['date_from'] - date_borne = { + borne_min = res[0]['start_date'] + borne_max = res[0]['stop_date'] + elif form['state'] == 'bydate': + borne_min = form['date_from'] + borne_max = form['date_to'] + elif form['state'] == 'all': + periods = form['periods'][0][2] + if not periods: + sql = """ + Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """ + """ + else: + periods_id = ','.join(map(str, periods)) + sql = """ + Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """) + """ + self.cr.execute(sql) + res = self.cr.dictfetchall() + period_min = res[0]['start_date'] + period_max = res[0]['stop_date'] + date_min = form['date_from'] + date_max = form['date_to'] + if period_min 0 : if ( sold_account <> 0.0): res.append(child_account) - else: + else: if child_account.type != 'view' \ and len(self.pool.get('account.move.line').search(self.cr, self.uid, [('account_id','=',child_account.id)], @@ -205,17 +238,17 @@ class general_ledger_landscape(rml_parse.rml_parse): sum_credit = 0 else: sum_credit = resultat[0]['sum_credit'] - + move.init_credit = sum_credit move.init_debit = sum_debit - + else: move.init_credit = 0 move.init_debit = 0 - + ## return res - + def lines(self, account, form): inv_types = { 'out_invoice': 'CI: ', @@ -229,12 +262,19 @@ class general_ledger_landscape(rml_parse.rml_parse): else: sorttag = 'j.code' sql = """ - SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name, l.debit, l.credit, l.period_id - FROM account_move_line l LEFT JOIN res_currency c on (l.currency_id=c.id) JOIN account_journal j on (l.journal_id=j.id) - AND account_id = %d AND %s - ORDER by %s"""%(account.id,self.query,sorttag) + SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name , l.debit, l.credit, l.period_id + FROM account_move_line as l + LEFT JOIN res_currency c on (l.currency_id=c.id) + JOIN account_journal j on (l.journal_id=j.id) + AND account_id = %d + AND %s + WHERE l.date<='%s' + AND l.date>='%s' + ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag) + self.cr.execute(sql) - res = self.cr.dictfetchall() + + res = self.cr.dictfetchall() sum = 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') for l in res: @@ -258,11 +298,11 @@ class general_ledger_landscape(rml_parse.rml_parse): if (l['credit'] > 0): if l['amount_currency'] != None: l['amount_currency'] = abs(l['amount_currency']) * -1 - + # if l['amount_currency'] != None: - self.tot_currency = self.tot_currency + l['amount_currency'] - + self.tot_currency = self.tot_currency + l['amount_currency'] + return res def _sum_debit_account(self, account, form): @@ -291,7 +331,7 @@ class general_ledger_landscape(rml_parse.rml_parse): sum_credit += account.init_credit # ## - + return sum_credit def _sum_solde_account(self, account, form): @@ -301,7 +341,7 @@ class general_ledger_landscape(rml_parse.rml_parse): sum_solde = self.cr.fetchone()[0] or 0.0 if form['soldeinit']: sum_solde += account.init_debit - account.init_credit - + return sum_solde def _sum_debit(self, form): @@ -330,31 +370,24 @@ class general_ledger_landscape(rml_parse.rml_parse): self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\ "FROM account_move_line l "\ "WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query) -# print ("SELECT (sum(debit) - sum(credit)) as Test "\ -# "FROM account_move_line l "\ -# "WHERE l.account_id in ("+','.join(map(str, child_ids))+") AND "+query+period_sql) sum_solde = self.cr.fetchone()[0] or 0.0 return sum_solde - + def _set_get_account_currency_code(self, account_id): - print"====account_id=====",account_id self.cr.execute("SELECT c.code as code "\ "FROM res_currency c,account_account as ac "\ "WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id)) result = self.cr.fetchone() - print"====result====",result if result: self.account_currency = result[0] else: self.account_currency = False - - + def _sum_currency_amount_account(self, account, form): - self._set_get_account_currency_code(account.id) self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %d "%account.id) total = self.cr.fetchone() - + if self.account_currency: return_field = str(total[0]) + self.account_currency return return_field diff --git a/addons/account/report/general_ledger_landscape.rml b/addons/account/report/general_ledger_landscape.rml index 16ddfa9a594..ebc0d822f2b 100755 --- a/addons/account/report/general_ledger_landscape.rml +++ b/addons/account/report/general_ledger_landscape.rml @@ -37,9 +37,8 @@ - + - @@ -92,335 +91,93 @@ - - - [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] - + [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] + + Date + JNRL + Partner + Ref + Mvt + Entry Label + Counterpart + Debit + Credit + Balance + Currency + + [[ repeatIn(objects, 'a') ]] + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] + + + + + [[ o.code ]] [[ o.name ]] + + [[ sum_debit_account(o, data['form']) or '0.0' ]] + [[ sum_credit_account(o, data['form']) or '0.0' ]] + [[ sum_solde_account(o, data['form']) or '0.0' ]] + [[ sum_currency_amount_account(o, data['form']) or '0.0' ]] + + + + + + [[ repeatIn(lines(o, data['form']), 'line') ]] + [[ line['date'] ]] + [[ line['code'] ]] + [[ line['partner'] ]] + [[ line['ref'] ]] + [[ line['move'] ]] + [[ line['name'] ]] + [[ strip_name(line['line_corresp'],55) ]] + [[ line['debit'] and line['debit'] or '0.0' ]] + [[ line['credit'] and line['credit'] or '0.0' ]] + [[ line['progress'] and line['progress'] or '0.0' ]] + [[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] ]] + + + + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] + + Date + JNRL + Partner + Ref + Mvt + Entry Label + Counterpart + Debit + Credit + Balance + + [[ repeatIn(objects, 'a') ]] + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] - - Date - - - - JNRL - - - - Partner - - - - Ref - - - - Mvt - - - - Entry Label - - - - Counterpart - - - - Debit - - - - Credit - - - - Balance - - - - Currency - + + + [[ o.code ]] [[ o.name ]] + + [[ sum_debit_account(o, data['form']) or '0.0']] + [[sum_credit_account(o, data['form']) or '0.0']] + [[sum_solde_account(o, data['form']) or '0.0' ]] + + + - - [[ repeatIn(objects, 'a') ]] - [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] - - - - - - - - - [[ o.code ]] [[ o.name ]] - - - [[ sum_debit_account(o, data['form']) or '0.0' ]] - - - [[ sum_credit_account(o, data['form']) or '0.0' ]] - - - [[ sum_solde_account(o, data['form']) or '0.0' ]] - - - - [[ sum_currency_amount_account(o, data['form']) or '0.0' ]] - - - - - - [[ data['form']['soldeinit'] == True or removeParentNode('tr') ]] - - Balance Initial - - - - - - - - - - - - - - - - - - - - - - [[ o.init_debit or '0.0' ]] - - - [[ o.init_credit or '0.0' ]] - - - [[ (o.init_debit - o.init_credit) or '0.0' ]] - - - - - + + [[ repeatIn(lines(o, data['form']), 'line') ]] + [[ line['date'] ]] + [[ line['code'] ]] + [[ line['partner'] ]] + [[ line['ref'] ]] + [[ line['move'] ]] + [[ line['name'] ]] + [[ strip_name(line['line_corresp'],55) ]] + [[ line['debit'] and line['debit'] or '0.0' ]] + [[ line['credit'] and line['credit'] or '0.0' ]] + [[ line['progress'] and line['progress'] or '0.0' ]] - - - [[ repeatIn(lines(o, data['form']), 'line') ]] - - - [[ line['date'] ]] - - - [[ line['code'] ]] - - - [[ line['partner'] ]] - - - [[ line['ref'] ]] - - - [[ line['move'] ]] - - - [[ line['name'] ]] - - - [[ strip_name(line['line_corresp'],55) ]] - - - [[ line['debit'] and line['debit'] or '0.0' ]] - - - [[ line['credit'] and line['credit'] or '0.0' ]] - - - [[ line['progress'] and line['progress'] or '0.0' ]] - - - [[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] ]] - - - - - - - - - - - - - [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] - - - - - - Date - - - - - - JNRL - - - - - - Partner - - - - - - Ref - - - - - - Mvt - - - - - - Entry Label - - - - - - Counterpart - - - - - - Debit - - - - - - Credit - - - - - - Balance - - - - - - [[ repeatIn(objects, 'a') ]] - [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] - [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] - - - - - [[ o.code ]] [[ o.name ]] - - - [[ sum_debit_account(o, data['form']) or '0.0']] - - - [[sum_credit_account(o, data['form']) or '0.0']] - - - [[sum_solde_account(o, data['form']) or '0.0' ]] - - - - - - [[ data['form']['soldeinit'] == True or removeParentNode('tr') ]] - - - - - - Solde Initial - - - - - - - - - - - - - - - - - - - [[ o.init_debit or '0.0' ]] - - - [[ o.init_credit or '0.0' ]] - - - [[ o.init_debit - o.init_credit or '0.0' ]] - - - - [[ repeatIn(lines(o, data['form']), 'line') ]] - - [[ line['date'] ]] - - - [[ line['code'] ]] - - - [[ line['partner'] ]] - - - [[ line['ref'] ]] - - - [[ line['move'] ]] - - - [[ line['name'] ]] - - - [[ strip_name(line['line_corresp'],55) ]] - - - [[ line['debit'] and line['debit'] or '0.0' ]] - - - [[ line['credit'] and line['credit'] or '0.0' ]] - - - [[ line['progress'] and line['progress'] or '0.0' ]] - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py index 519456527c8..23d4e54fa55 100644 --- a/addons/account/report/partner_balance.py +++ b/addons/account/report/partner_balance.py @@ -73,7 +73,8 @@ class partner_balance(report_sxw.rml_parse): ## Get All Period Date # # If we have no period we will take all perdio in the FiscalYear. - print"data['form']['periods'][0][2]",data['form']['periods'][0][2] + + if not data['form']['periods'][0][2] : periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) else: @@ -116,15 +117,14 @@ class partner_balance(report_sxw.rml_parse): else : stop_date = date_stop_date - print"===start_date===",start_date - print"===stop_date===",stop_date + final_date_array = [] final_date_array = final_date_array + self.date_range(start_date,stop_date) self.date_lst = final_date_array self.date_lst.sort() def transform_none_into_date_array(self,data): - print"======transform_none_into_date_array=====" + sql = "SELECT min(date) as start_date from account_move_line" self.cr.execute(sql) start_date = self.cr.fetchone()[0] @@ -132,7 +132,7 @@ class partner_balance(report_sxw.rml_parse): sql = "SELECT max(date) as start_date from account_move_line" self.cr.execute(sql) stop_date = self.cr.fetchone()[0] - print"stop_date",stop_date + array = [] array = array + self.date_range(start_date,stop_date) @@ -159,16 +159,16 @@ class partner_balance(report_sxw.rml_parse): # # if data['form']['state'] == 'none': - print"========none==========" + self.transform_none_into_date_array(data) elif data['form']['state'] == 'bydate': - print"========bydate==========" + self.transform_date_into_date_array(data) elif data['form']['state'] == 'byperiod': - print"========byperiod==========" + self.transform_period_into_date_array(data) elif data['form']['state'] == 'all': - print"========both==========" + self.transform_both_into_date_array(data) @@ -213,7 +213,7 @@ class partner_balance(report_sxw.rml_parse): # # if data['form']['soldeinit'] : - print"=====self.date_lst[0]=====",self.date_lst[0] + self.cr.execute( "SELECT p.ref, p.name,l.account_id,ac.name as account_name,ac.code as code , sum(debit) as debit, sum(credit) as credit, " \ "CASE WHEN sum(debit) > sum(credit) " \ @@ -525,7 +525,7 @@ class partner_balance(report_sxw.rml_parse): 'l.date IN (' + self.date_lst_string + ') ' \ 'GROUP BY partner_id') a = self.cr.fetchone()[0] - print"====self.cr.fetchone()====",a + if self.cr.fetchone() != None: result_tmp = result_tmp + (a or 0.0) else: @@ -555,7 +555,7 @@ class partner_balance(report_sxw.rml_parse): 'AND l.reconcile_id IS NULL ' \ 'GROUP BY partner_id', (self.date_lst[0],)) - print"self.cr.fetchone()[0]",self.cr.fetchone() + if self.cr.fetchone() != None: result_tmp = float(self.cr.fetchone()[0]) or 0.0 else: diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py index 6d7f7a9bf16..194e18d1d53 100755 --- a/addons/account/report/third_party_ledger.py +++ b/addons/account/report/third_party_ledger.py @@ -59,7 +59,7 @@ class third_party_ledger(rml_parse.rml_parse): for date in date_array: full_str_date.append(str(date)) return full_str_date - + # def transform_period_into_date_array(self,data): ## Get All Period Date @@ -67,66 +67,61 @@ class third_party_ledger(rml_parse.rml_parse): periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) else: periods_id = data['form']['periods'][0][2] - date_array = [] + date_array = [] for period_id in periods_id: period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id) date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop) self.date_lst = date_array self.date_lst.sort() - + def transform_date_into_date_array(self,data): return_array = self.date_range(data['form']['date1'],data['form']['date2']) self.date_lst = return_array self.date_lst.sort() def transform_both_into_date_array(self,data): - + if not data['form']['periods'][0][2] : periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) else: periods_id = data['form']['periods'][0][2] - date_array = [] + date_array = [] for period_id in periods_id: period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id) date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop) - + period_start_date = date_array[0] date_start_date = data['form']['date1'] period_stop_date = date_array[-1] date_stop_date = data['form']['date2'] - + if period_start_date - [[ (line['debit']) or '' ]] + [[ (line['debit']) or '0.0' ]] - [[ (line['credit']) or '' ]] + [[ (line['credit']) or '0.0' ]] - [[ (line['progress']) or '' ]] + [[ (line['progress']) or '0.0' ]] diff --git a/addons/account/report/wizard_account_journal.rml b/addons/account/report/wizard_account_journal.rml new file mode 100644 index 00000000000..def6acbecb8 --- /dev/null +++ b/addons/account/report/wizard_account_journal.rml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects, 'o') ]] + + [[repeatIn(lines(data['form']['period_id'][0][2],data['form']['journal_id'][0][2],data['form']['sort_selection']), 'line') ]] + + + Date + + + Voucher No + + + A/c No. + + + Third party + + + Entry label + + + Debit + + + Credit + + + + + [[line[0].period_id.name ]] + + + [[line[0].journal_id.code ]] + + + + + [[ '%.2f' % sum_debit(line[0].period_id.id, line[0].journal_id.id) or '0.00' ]] + + + [[ '%.2f' % sum_credit(line[0].period_id.id, line[0].journal_id.id) or '0.00' ]] + + + + [[repeatIn(line,'l')]] + + [[ l.date ]] + + + [[ l.ref ]] + + + [[ l.account_id.code ]] + + + [[ l.partner_id and l.partner_id.name ]] + + + [[ l.name ]] + + + [[ l.debit and '%.2f' % l.debit or '0.00' ]] + + + [[ l.credit and '%.2f' % l.credit or '0.00' ]] + + + + + + + + \ No newline at end of file diff --git a/addons/account/report/wizard_central_journal.rml b/addons/account/report/wizard_central_journal.rml new file mode 100644 index 00000000000..4c0b037971a --- /dev/null +++ b/addons/account/report/wizard_central_journal.rml @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects, 'o') ]] + [[ repeatIn(lines(data['form']['period_id'][0][2],data['form']['journal_id'][0][2]), 'line') ]] + + + + Journal Code + + + Journal Name + + + Printing Date + + + + + + + [[ line[0]['journal'].code or '' ]] + + + [[ line[0]['journal'].name ]] + + + [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] + + + + + + + + + + + + + Account Num. + + + Account Name + + + Debit + + + Credit + + + + + + + + + Total: + + + + + + + + [[ '%.2f' % sum_debit(line[0]['period'].id, line[0]['journal'].id) ]] + + + [[ '%.2f' % sum_credit(line[0]['period'].id, line[0]['journal'].id) ]] + + + + + + + + + + [[repeatIn(line,'l')]] + + + [[ l['code'] ]] + + + [[ l['name'] ]] + + + [[ formatLang(l['debit']) and '%.2f' % l['debit'] or '0.00' ]] + + + [[ formatLang(l['credit']) and '%.2f' % l['credit'] or '0.00' ]] + + + + + + + + + + + diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv index 18183dd0313..9dbdcb18b55 100644 --- a/addons/account/security/ir.model.access.csv +++ b/addons/account/security/ir.model.access.csv @@ -4,7 +4,8 @@ "access_account_account_type","account.account.type","model_account_account_type","account.group_account_user",1,0,0,0 "access_account_tax","account.tax","model_account_tax","account.group_account_user",1,0,0,0 "access_account_account","account.account","model_account_account","account.group_account_user",1,0,0,0 -"access_account_account_partner_manager","account.account partner manager","model_account_account","base.group_user",1,0,0,0 +"access_account_account_user","account.account user","model_account_account","base.group_user",1,0,0,0 +"access_account_account_partner_manager","account.account partner manager","model_account_account","base.group_partner_manager",1,0,0,0 "access_account_journal_view","account.journal.view","model_account_journal_view","account.group_account_user",1,0,0,0 "access_account_journal_column","account.journal.column","model_account_journal_column","account.group_account_user",1,0,0,0 "access_account_journal","account.journal","model_account_journal","account.group_account_user",1,0,0,0 @@ -56,9 +57,6 @@ "access_account_tax_code_manager","account.tax.code","model_account_tax_code","account.group_account_manager",1,1,1,1 "access_account_tax_manager","account.tax","model_account_tax","account.group_account_manager",1,1,1,1 "access_account_invoice_group_invoice","account.invoice group invoice","model_account_invoice","account.group_account_invoice",1,1,1,1 -"access_account_invoice_manager","account.invoice","model_account_invoice","account.group_account_manager",1,1,1,1 -"access_account_invoice_line_manager","account.invoice.line","model_account_invoice_line","account.group_account_manager",1,1,1,1 -"access_account_invoice_tax_manager","account.invoice.tax","model_account_invoice_tax","account.group_account_manager",1,1,1,1 "access_account_analytic_account_manager","account.analytic.account","model_account_analytic_account","account.group_account_manager",1,1,1,1 "access_account_analytic_journal_manager","account.analytic.journal","model_account_analytic_journal","account.group_account_manager",1,1,1,1 "access_account_fiscalyear","account.fiscalyear","model_account_fiscalyear","account.group_account_manager",1,1,1,1 @@ -76,6 +74,8 @@ "access_account_account_product_manager","account.account product manager","model_account_account","product.group_product_manager",1,0,0,0 "access_account_journal_product_manager","account.journal product manager","model_account_journal","product.group_product_manager",1,0,0,0 "access_account_fiscal_position_product_manager","account.fiscal.position account.manager","model_account_fiscal_position","account.group_account_manager",1,1,1,1 -"access_account_fiscal_position_account_product_manager","account.fiscal.position account.manager","model_account_fiscal_position_account","account.group_account_manager",1,1,1,1 "access_account_fiscal_position","account.fiscal.position all","model_account_fiscal_position","base.group_user",1,0,0,0 +"access_account_fiscal_position_tax_product_manager","account.fiscal.position.tax account.manager","model_account_fiscal_position_tax","account.group_account_manager",1,1,1,1 +"access_account_fiscal_position_tax","account.fiscal.position.tax all","model_account_fiscal_position_tax","base.group_user",1,0,0,0 +"access_account_fiscal_position_account_product_manager","account.fiscal.position account.manager","model_account_fiscal_position_account","account.group_account_manager",1,1,1,1 "access_account_fiscal_position_account","account.fiscal.position all","model_account_fiscal_position_account","base.group_user",1,0,0,0 diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py index 6ecd2040756..5a434c54cd2 100644 --- a/addons/account/wizard/__init__.py +++ b/addons/account/wizard/__init__.py @@ -64,6 +64,8 @@ import wizard_use_model import wizard_state_open import wizard_statement_from_invoice +import wizard_print_journal +import wizard_central_journal # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/wizard_central_journal.py b/addons/account/wizard/wizard_central_journal.py new file mode 100644 index 00000000000..2c41ad252a5 --- /dev/null +++ b/addons/account/wizard/wizard_central_journal.py @@ -0,0 +1,60 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import wizard +import pooler + +form = ''' +
+ + +''' + +fields = { + 'journal_id': {'string': 'Journal', 'type': 'many2many', 'relation': 'account.journal', 'required': True}, + 'period_id': {'string': 'Period', 'type': 'many2many', 'relation': 'account.period', 'required': True}, +} + + +class wizard_print_journal(wizard.interface): + states = { + 'init': { + 'actions': [], + 'result': {'type': 'form', 'arch': form, 'fields': fields, 'state': (('end', 'Cancel'), ('print', 'Print'))}, + }, + 'print': { + 'actions': [], + 'result': {'type':'print', 'report':'account.central.journal.wiz', 'state':'end'}, + }, + } +wizard_print_journal('account.central.journal.report') + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py index c4a2f2a7438..187ae1e45b2 100644 --- a/addons/account/wizard/wizard_general_ledger_report.py +++ b/addons/account/wizard/wizard_general_ledger_report.py @@ -29,31 +29,31 @@ import pooler import locale import time -report_type = ''' -
-
''' - -dates_form = ''' -
- - - - - - - -''' - -dates_fields = { - 'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')}, - 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, - 'sortbydate':{'string':"Sort by",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Mouvement')]}, - 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}, - 'landscape':{'string':"Print in Landscape Mode",'type':'boolean'}, - 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, - 'amount_currency':{'string':"with amount in currency",'type':'boolean'} - -} +#report_type = ''' +#
+#
''' +# +#dates_form = ''' +#
+# +# +# +# +# +# +# +#''' +# +#dates_fields = { +# 'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')}, +# 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, +# 'sortbydate':{'string':"Sort by",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Mouvement')]}, +# 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}, +# 'landscape':{'string':"Print in Landscape Mode",'type':'boolean'}, +# 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, +# 'amount_currency':{'string':"with amount in currency",'type':'boolean'} +# +#} account_form = '''
@@ -68,25 +68,59 @@ account_fields = { period_form = ''' - - - - - - - - + + + + + +