@@ -231,9 +219,11 @@
[[ repeatIn(get_lines(data), 'a') ]]
[[ (a.get('level') <> 0) or removeParentNode('tr') ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]]
- [[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.get('level')))+'_name'}) ]][[ a.get('name') ]] |
- [[ (a.get('level') <>2) or removeParentNode('td') ]][[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] |
- [[ a.get('level') == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] |
+ [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]] |
+ [[ a.get('account_type') =='view' or removeParentNode('td') ]]
+ [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] |
+ [[ a.get('account_type') <>'view' or removeParentNode('td') ]]
+ [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] |
@@ -256,11 +246,15 @@
[[ repeatIn(get_lines(data), 'a') ]]
[[ (a.get('level') <> 0) or removeParentNode('tr') ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]]
- [[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.get('level')))+'_name'}) ]][[ a.get('name') ]] |
- [[ (a.get('level') <>2) or removeParentNode('td') ]][[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] |
- [[ a.get('level') == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] |
- [[ (a.get('level') <>2) or removeParentNode('td') ]][[ (a.get('account_type') =='view' and a.get('level') >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]] |
- [[ a.get('level') == 2 or removeParentNode('td') ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]] |
+ [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]] |
+ [[ a.get('account_type') =='view' or removeParentNode('td') ]]
+ [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] |
+ [[ a.get('account_type') <>'view' or removeParentNode('td') ]]
+ [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]] |
+ [[ a.get('account_type') =='view' or removeParentNode('td') ]]
+ [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]] |
+ [[ a.get('account_type') <>'view' or removeParentNode('td') ]]
+ [[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]] |
diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py
index d2295b5bbf2..849a7a9f514 100644
--- a/addons/account/wizard/account_fiscalyear_close.py
+++ b/addons/account/wizard/account_fiscalyear_close.py
@@ -105,6 +105,7 @@ class account_fiscalyear_close(osv.osv_memory):
'name': '/',
'ref': '',
'period_id': period.id,
+ 'date': period.date_start,
'journal_id': new_journal.id,
}
move_id = obj_acc_move.create(cr, uid, vals, context=context)
@@ -118,7 +119,6 @@ class account_fiscalyear_close(osv.osv_memory):
AND a.type != 'view'
AND t.close_method = %s''', ('unreconciled', ))
account_ids = map(lambda x: x[0], cr.fetchall())
-
if account_ids:
cr.execute('''
INSERT INTO account_move_line (
@@ -130,11 +130,11 @@ class account_fiscalyear_close(osv.osv_memory):
(SELECT name, create_uid, create_date, write_uid, write_date,
statement_id, %s,currency_id, date_maturity, partner_id,
blocked, credit, 'draft', debit, ref, account_id,
- %s, date, %s, amount_currency, quantity, product_id, company_id
+ %s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id
FROM account_move_line
WHERE account_id IN %s
AND ''' + query_line + '''
- AND reconcile_id IS NULL)''', (new_journal.id, period.id, move_id, tuple(account_ids),))
+ AND reconcile_id IS NULL)''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
#We have also to consider all move_lines that were reconciled
#on another fiscal year, and report them too
@@ -149,7 +149,7 @@ class account_fiscalyear_close(osv.osv_memory):
b.name, b.create_uid, b.create_date, b.write_uid, b.write_date,
b.statement_id, %s, b.currency_id, b.date_maturity,
b.partner_id, b.blocked, b.credit, 'draft', b.debit,
- b.ref, b.account_id, %s, b.date, %s, b.amount_currency,
+ b.ref, b.account_id, %s, (%s) AS date, %s, b.amount_currency,
b.quantity, b.product_id, b.company_id
FROM account_move_line b
WHERE b.account_id IN %s
@@ -157,7 +157,7 @@ class account_fiscalyear_close(osv.osv_memory):
AND b.period_id IN ('''+fy_period_set+''')
AND b.reconcile_id IN (SELECT DISTINCT(reconcile_id)
FROM account_move_line a
- WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, move_id, tuple(account_ids),))
+ WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
#2. report of the accounts with defferal method == 'detail'
cr.execute('''
@@ -180,11 +180,11 @@ class account_fiscalyear_close(osv.osv_memory):
(SELECT name, create_uid, create_date, write_uid, write_date,
statement_id, %s,currency_id, date_maturity, partner_id,
blocked, credit, 'draft', debit, ref, account_id,
- %s, date, %s, amount_currency, quantity, product_id, company_id
+ %s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id
FROM account_move_line
WHERE account_id IN %s
AND ''' + query_line + ''')
- ''', (new_journal.id, period.id, move_id, tuple(account_ids),))
+ ''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
#3. report of the accounts with defferal method == 'balance'
diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py
index 8ae425e0b15..50c5d4adbae 100644
--- a/addons/account/wizard/account_report_common.py
+++ b/addons/account/wizard/account_report_common.py
@@ -29,8 +29,14 @@ class account_common_report(osv.osv_memory):
_name = "account.common.report"
_description = "Account Common Report"
+ def onchange_chart_id(self, cr, uid, ids, chart_account_id=False, context=None):
+ if chart_account_id:
+ company_id = self.pool.get('account.account').browse(cr, uid, chart_account_id, context=context).company_id.id
+ return {'value': {'company_id': company_id}}
+
_columns = {
'chart_account_id': fields.many2one('account.account', 'Chart of Account', help='Select Charts of Accounts', required=True, domain = [('parent_id','=',False)]),
+ 'company_id': fields.related('chart_account_id', 'company_id', type='many2one', relation='res.company', string='Company', readonly=True),
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', help='Keep empty for all open fiscal year'),
'filter': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods')], "Filter by", required=True),
'period_from': fields.many2one('account.period', 'Start Period'),
@@ -44,6 +50,22 @@ class account_common_report(osv.osv_memory):
}
+ def _check_company_id(self, cr, uid, ids, context=None):
+ for wiz in self.browse(cr, uid, ids, context=context):
+ company_id = wiz.company_id.id
+ if wiz.fiscalyear_id and company_id != wiz.fiscalyear_id.company_id.id:
+ return False
+ if wiz.period_from and company_id != wiz.period_from.company_id.id:
+ return False
+ if wiz.period_to and company_id != wiz.period_to.company_id.id:
+ return False
+ return True
+
+ _constraints = [
+ (_check_company_id, 'The fiscalyear, periods or chart of account chosen have to belong to the same company.', ['chart_account_id','fiscalyear_id','period_from','period_to']),
+ ]
+
+
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(account_common_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
if context.get('active_model', False) == 'account.account' and view_id:
diff --git a/addons/account/wizard/account_report_common_view.xml b/addons/account/wizard/account_report_common_view.xml
index 30d90a55245..db1da8223d5 100644
--- a/addons/account/wizard/account_report_common_view.xml
+++ b/addons/account/wizard/account_report_common_view.xml
@@ -10,8 +10,9 @@