diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml
index 576b62470e6..8eefe75838f 100644
--- a/addons/account/report/account_entries_report_view.xml
+++ b/addons/account/report/account_entries_report_view.xml
@@ -94,7 +94,7 @@
-
+
diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py
index 4d2a417e52e..b904aba298f 100644
--- a/addons/account/report/account_general_ledger.py
+++ b/addons/account/report/account_general_ledger.py
@@ -179,20 +179,14 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
if res_lines and self.init_balance:
#FIXME: replace the label of lname with a string translatable
sql = """
- SELECT 0 AS lid, '' AS ldate, '' AS lcode, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
+ SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
'' AS move_name, '' AS mmove_id, '' AS period_code,
- sum(case when a.currency_id is not null then
- l.amount_currency
- else
- 0.0
- end) as amount_currency,
'' AS currency_code,
NULL AS currency_id,
'' AS invoice_id, '' AS invoice_type, '' AS invoice_number,
'' AS partner_name
FROM account_move_line l
LEFT JOIN account_move m on (l.move_id=m.id)
- LEFT JOIN account_account a ON (l.account_id=a.id)
LEFT JOIN res_currency c on (l.currency_id=c.id)
LEFT JOIN res_partner p on (l.partner_id=p.id)
LEFT JOIN account_invoice i on (m.id =i.move_id)
@@ -215,8 +209,6 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
l['amount_currency'] = abs(l['amount_currency']) * -1
if l['amount_currency'] != None:
self.tot_currency = self.tot_currency + l['amount_currency']
- self.cr.execute("select distinct currency_id from account_invoice")
- l['cur_id']=self.cr.fetchall()
return res
def _sum_debit_account(self, account):
diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml
index e0359249657..d3da592e085 100644
--- a/addons/account/report/account_general_ledger.rml
+++ b/addons/account/report/account_general_ledger.rml
@@ -518,7 +518,7 @@
[[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]
- [[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']]
+ [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]
- [[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']]
+ [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]
diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py
index 554b12aecfc..92d84e05c26 100644
--- a/addons/account/report/account_partner_ledger.py
+++ b/addons/account/report/account_partner_ledger.py
@@ -37,7 +37,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
# 'sum_debit': self._sum_debit,
# 'sum_credit': self._sum_credit,
'get_currency': self._get_currency,
- 'sum_currency_amount_account': self._sum_currency_amount_account,
'comma_me': self.comma_me,
'get_start_period': self.get_start_period,
'get_end_period': self.get_end_period,
@@ -161,10 +160,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
r['progress'] = sum
full_account.append(r)
return full_account
-
- def _get_currency(self):
- self.cr.execute("select distinct currency_id from account_invoice")
- return self.cr.fetchall()
def _get_intial_balance(self, partner):
move_state = ['draft','posted']
@@ -395,10 +390,16 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
return 'Receivable and Payable Accounts'
return ''
- def _sum_currency_amount_account(self, account):
- 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= %s" %(account.id))
+ 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= %s ", (account.id,))
total = self.cr.fetchone()
- return total[0] or 0.0
+ if self.account_currency:
+ return_field = str(total[0]) + self.account_currency
+ return return_field
+ else:
+ currency_total = self.tot_currency = 0.0
+ return currency_total
def _display_initial_balance(self, data):
if self.initial_balance:
diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml
index b6d4b216bbb..b3dec993cdb 100644
--- a/addons/account/report/account_partner_ledger_other.rml
+++ b/addons/account/report/account_partner_ledger_other.rml
@@ -470,7 +470,7 @@
[[ display_currency(data) == False or removeParentNode('section') ]]
-
+
- [[ len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]]
-
@@ -659,7 +653,7 @@
- [[ (len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']]
+ [[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]]
diff --git a/addons/account/wizard/account_report_account_balance.py b/addons/account/wizard/account_report_account_balance.py
index 6b8c4371dd2..1c3743bf3c7 100644
--- a/addons/account/wizard/account_report_account_balance.py
+++ b/addons/account/wizard/account_report_account_balance.py
@@ -32,17 +32,6 @@ class account_balance_report(osv.osv_memory):
'journal_ids': [],
}
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- mod_obj = self.pool.get('ir.model.data')
- res = super(account_balance_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
- doc = etree.XML(res['arch'])
- nodes = doc.xpath("//field[@name='journal_ids']")
- for node in nodes:
- node.set('readonly', '1')
- node.set('required', '0')
- res['arch'] = etree.tostring(doc)
- return res
-
def _print_report(self, cr, uid, ids, data, context=None):
data = self.pre_print_report(cr, uid, ids, data, context=context)
return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data}
diff --git a/addons/account/wizard/account_report_account_balance_view.xml b/addons/account/wizard/account_report_account_balance_view.xml
index 9438a6f9216..38f456f7d15 100644
--- a/addons/account/wizard/account_report_account_balance_view.xml
+++ b/addons/account/wizard/account_report_account_balance_view.xml
@@ -10,6 +10,9 @@
+
+
+
diff --git a/addons/account/wizard/account_report_aged_partner_balance.py b/addons/account/wizard/account_report_aged_partner_balance.py
index 5eb1f0f5a2e..f76beb6bee1 100644
--- a/addons/account/wizard/account_report_aged_partner_balance.py
+++ b/addons/account/wizard/account_report_aged_partner_balance.py
@@ -44,16 +44,6 @@ class account_aged_trial_balance(osv.osv_memory):
'direction_selection': 'past',
}
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- res = super(account_aged_trial_balance, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
- doc = etree.XML(res['arch'])
- nodes = doc.xpath("//field[@name='journal_ids']")
- for node in nodes:
- node.set('invisible', '1')
- node.set('required', '0')
- res['arch'] = etree.tostring(doc)
- return res
-
def _print_report(self, cr, uid, ids, data, context=None):
res = {}
if context is None:
diff --git a/addons/account/wizard/account_report_aged_partner_balance_view.xml b/addons/account/wizard/account_report_aged_partner_balance_view.xml
index aea2fba2528..195ccbef111 100644
--- a/addons/account/wizard/account_report_aged_partner_balance_view.xml
+++ b/addons/account/wizard/account_report_aged_partner_balance_view.xml
@@ -20,7 +20,7 @@
-
+
diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py
index 890b22421e4..174c172fdaa 100644
--- a/addons/account/wizard/account_report_balance_sheet.py
+++ b/addons/account/wizard/account_report_balance_sheet.py
@@ -32,36 +32,45 @@ class account_bs_report(osv.osv_memory):
_inherit = "account.common.account.report"
_description = 'Account Balance Sheet Report'
+ def _get_def_reserve_account(self, cr, uid, context=None):
+ chart_id = self._get_account(cr, uid, context=context)
+ res = self.onchange_chart_id(cr, uid, [], chart_id, context=context)
+ if not res:
+ return False
+ return res['value']['reserve_account_id']
+
_columns = {
'display_type': fields.boolean("Landscape Mode"),
- 'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',required = True,
- help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss : Amount will be duducted.), Which is calculated from Profilt & Loss Report', domain = [('type','=','payable')]),
+ 'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',
+ required=True,
+ help='This Account is used for transfering Profit/Loss ' \
+ '(Profit: Amount will be added, Loss: Amount will be duducted), ' \
+ 'which is calculated from Profilt & Loss Report',
+ domain = [('type','=','payable')]),
}
_defaults={
'display_type': True,
'journal_ids': [],
+ 'reserve_account_id': _get_def_reserve_account,
}
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- res = super(account_bs_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
- doc = etree.XML(res['arch'])
- nodes = doc.xpath("//field[@name='journal_ids']")
- for node in nodes:
- node.set('readonly', '1')
- node.set('required', '0')
- res['arch'] = etree.tostring(doc)
- return res
+ def onchange_chart_id(self, cr, uid, ids, chart_id, context=None):
+ if not chart_id:
+ return {}
+ account = self.pool.get('account.account').browse(cr, uid, chart_id , context=context)
+ if not account.company_id.property_reserve_and_surplus_account:
+ return {'value': {'reserve_account_id': False}}
+ return {'value': {'reserve_account_id': account.company_id.property_reserve_and_surplus_account.id}}
+
def _print_report(self, cr, uid, ids, data, context=None):
if context is None:
context = {}
- data = self.pre_print_report(cr, uid, ids, data, context=context)
- account = self.pool.get('account.account').browse(cr, uid, data['form']['chart_account_id'], context=context)
- if not account.company_id.property_reserve_and_surplus_account:
+ data['form'].update(self.read(cr, uid, ids, ['display_type','reserve_account_id'])[0])
+ if not data['form']['reserve_account_id']:
raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !'))
- data['form']['reserve_account_id'] = account.company_id.property_reserve_and_surplus_account.id
- data['form'].update(self.read(cr, uid, ids, ['display_type'])[0])
+ data = self.pre_print_report(cr, uid, ids, data, context=context)
if data['form']['display_type']:
return {
'type': 'ir.actions.report.xml',
@@ -77,4 +86,4 @@ class account_bs_report(osv.osv_memory):
account_bs_report()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/wizard/account_report_balance_sheet_view.xml b/addons/account/wizard/account_report_balance_sheet_view.xml
index 97b73784f43..22a6e0608b2 100644
--- a/addons/account/wizard/account_report_balance_sheet_view.xml
+++ b/addons/account/wizard/account_report_balance_sheet_view.xml
@@ -9,14 +9,20 @@
+
+
+
+
+
+
+
-
diff --git a/addons/account/wizard/account_report_profit_loss.py b/addons/account/wizard/account_report_profit_loss.py
index 94487c4f567..444d91fa8fd 100644
--- a/addons/account/wizard/account_report_profit_loss.py
+++ b/addons/account/wizard/account_report_profit_loss.py
@@ -40,21 +40,6 @@ class account_pl_report(osv.osv_memory):
'target_move': False
}
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- mod_obj = self.pool.get('ir.model.data')
- res = super(account_pl_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
- doc = etree.XML(res['arch'])
- nodes = doc.xpath("//field[@name='journal_ids']")
- for node in nodes:
- node.set('readonly', '1')
- node.set('required', '0')
- nodes = doc.xpath("//field[@name='target_move']")
- for node in nodes:
- node.set('readonly', '1')
- node.set('required', '0')
- res['arch'] = etree.tostring(doc)
- return res
-
def _print_report(self, cr, uid, ids, data, context=None):
if context is None:
context = {}
diff --git a/addons/account/wizard/account_report_profit_loss_view.xml b/addons/account/wizard/account_report_profit_loss_view.xml
index be0ced5c787..d9876f57454 100644
--- a/addons/account/wizard/account_report_profit_loss_view.xml
+++ b/addons/account/wizard/account_report_profit_loss_view.xml
@@ -9,6 +9,12 @@
+
+
+
+
+
+
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 700078efd2c..4e08ad9112b 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -847,7 +847,7 @@ class account_voucher_line(osv.osv):
'move_line_id': fields.many2one('account.move.line', 'Journal Item'),
'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly=1),
'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly=1),
- 'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Originial Amount', store=True),
+ 'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Original Amount', store=True),
'amount_unreconciled': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Open Balance', store=True),
'company_id': fields.related('voucher_id','company_id', relation='res.company', type='many2one', string='Company', store=True),
}
diff --git a/addons/association/profile_association.xml b/addons/association/profile_association.xml
index 7b9ddb4ebc3..95e46457cca 100644
--- a/addons/association/profile_association.xml
+++ b/addons/association/profile_association.xml
@@ -53,7 +53,14 @@
always
-
+
diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml
index e4b228e0bb9..b0a2ba01e4e 100644
--- a/addons/crm/res_partner_view.xml
+++ b/addons/crm/res_partner_view.xml
@@ -74,7 +74,7 @@
-
diff --git a/addons/l10n_it/report/__init__.py b/addons/l10n_it/report/__init__.py
new file mode 100644
index 00000000000..be32155c675
--- /dev/null
+++ b/addons/l10n_it/report/__init__.py
@@ -0,0 +1,2 @@
+import libroIVA_credito
+import libroIVA_debito
\ No newline at end of file
diff --git a/addons/l10n_it/report/libroIVA_credito.py b/addons/l10n_it/report/libroIVA_credito.py
new file mode 100644
index 00000000000..b48c81d2475
--- /dev/null
+++ b/addons/l10n_it/report/libroIVA_credito.py
@@ -0,0 +1,79 @@
+import datetime
+import time
+from report import report_sxw
+from osv import osv
+import pooler
+
+
+class l10n_chart_it_report_libroIVA_credito(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(l10n_chart_it_report_libroIVA_credito,self).__init__(cr,uid,name,context)
+ self.localcontext.update({
+ 'time' : time,
+ 'get_company' : self.get_company,
+ 'get_periods' : self.get_periods,
+ 'get_lines' : self.get_lines,
+ })
+
+
+ def get_company(self,fiscal_year):
+ #print 'COMP = ',fiscal_year
+ return ""
+
+ def get_periods(self,fiscal_year):
+ #print 'Fiscal year id:',fiscal_year.id
+ obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear')
+ fy=obj.browse(self.cr,self.uid,fiscal_year.id)
+ #print 'Periods = ',fy.period_ids
+ res=[rec for rec in fy.period_ids]
+ #return fy.periods => non funziona?!? bool object !?!?
+ return res
+
+ def get_invoices(self,period):
+ #print 'PERIOD = ',period.name
+ obj=pooler.get_pool(self.cr.dbname).get('account.invoice')
+ # Selezione tutte le fatture emesse nel periodo
+ self.cr.execute( """
+ SELECT id FROM account_invoice
+ WHERE (state='open' OR state='paid') AND
+ period_id="""+str(period.id)+"""
+ AND (type='out_invoice' OR type='out_refund')
+ """)
+ ids=self.cr.fetchall()
+ #print 'IDS = ',
+ if ids:
+ ids=[id[0] for id in ids ]
+ invoices=obj.browse(self.cr,self.uid,ids)
+ #print 'INVOICES = ',invoices
+ return invoices
+
+ def get_lines(self,fiscal_year):
+ res=[]
+ obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear')
+ fy=obj_fy.browse(self.cr,self.uid,fiscal_year.id)
+ for period in fy.period_ids:
+ invoices=self.get_invoices(period)
+ for invoice in invoices:
+ d={'periodo': period.name}
+ d['protocollo']=invoice.number
+ #print 'PARTNER ',invoice.partner_id.name
+ causale=invoice.partner_id.name
+ #print 'CAUSALE = ',causale
+ d['causale']=causale
+ d['numero']=invoice.reference
+ d['data_doc']=invoice.date_invoice
+ for tax in invoice.tax_line:
+ #print '\tTAX: ',tax
+ d['aliquota']=tax.tax_code_id.name
+ d['imponibile']=tax.base
+ d['imposta']=tax.amount
+ res.append(d)
+ d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', }
+ return res
+
+
+
+report_sxw.report_sxw('report.l10n_it.report.libroIVA_credito','account.report_libroiva',
+ 'l10n_it/report/libroIVA_credito.rml',
+ parser=l10n_chart_it_report_libroIVA_credito,header=False)
diff --git a/addons/l10n_it/report/libroIVA_credito.rml b/addons/l10n_it/report/libroIVA_credito.rml
new file mode 100644
index 00000000000..2b282f760b4
--- /dev/null
+++ b/addons/l10n_it/report/libroIVA_credito.rml
@@ -0,0 +1,203 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ repeatIn(objects, 'o') ]]
+
+