[MERGE] merged with main trunk

bzr revid: qdp-launchpad@openerp.com-20120224091313-5m1e0lurrlvo0w1m
This commit is contained in:
Quentin (OpenERP) 2012-02-24 10:13:13 +01:00
commit d703252c52
5848 changed files with 712909 additions and 400771 deletions

View File

@ -151,7 +151,7 @@ module named account_voucher.
'test/account_fiscalyear_close_state.yml', #last test, as it will definitively close the demo fiscalyear
],
'installable': True,
'active': False,
'auto_install': False,
'certificate': '0080331923549',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -274,11 +274,11 @@ class account_account(osv.osv):
tuple
"""
mapping = {
'balance': "COALESCE(SUM(l.debit),0) " \
"- COALESCE(SUM(l.credit), 0) as balance",
'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance",
'debit': "COALESCE(SUM(l.debit), 0) as debit",
'credit': "COALESCE(SUM(l.credit), 0) as credit",
'foreign_balance': "COALESCE(SUM(l.amount_currency), 0) as foreign_balance",
# by convention, foreign_balance is 0 when the account has no secondary currency, because the amounts may be in different currencies
'foreign_balance': "(SELECT CASE WHEN currency_id IS NULL THEN 0 ELSE COALESCE(SUM(l.amount_currency), 0) END FROM account_account WHERE id IN (l.account_id)) as foreign_balance",
}
#get all the necessary accounts
children_and_consolidated = self._get_children_and_consol(cr, uid, ids, context=context)
@ -305,7 +305,7 @@ class account_account(osv.osv):
# ON l.account_id = tmp.id
# or make _get_children_and_consol return a query and join on that
request = ("SELECT l.account_id as id, " +\
', '.join(map(mapping.__getitem__, mapping.keys())) +
', '.join(mapping.values()) +
" FROM account_move_line l" \
" WHERE l.account_id IN %s " \
+ filters +
@ -381,8 +381,9 @@ class account_account(osv.osv):
def _get_level(self, cr, uid, ids, field_name, arg, context=None):
res = {}
accounts = self.browse(cr, uid, ids, context=context)
for account in accounts:
for account in self.browse(cr, uid, ids, context=context):
#we may not know the level of the parent at the time of computation, so we
# can't simply do res[account.id] = account.parent_id.level + 1
level = 0
parent = account.parent_id
while parent:
@ -660,7 +661,7 @@ class account_account(osv.osv):
# Allow the write if the value is the same
for i in [i['company_id'][0] for i in self.read(cr,uid,ids,['company_id'])]:
if vals['company_id']!=i:
raise osv.except_osv(_('Warning !'), _('You cannot modify the company as its related to existing journal items.'))
raise osv.except_osv(_('Warning !'), _('You cannot change the owner company of an account that already contains journal items.'))
if 'active' in vals and not vals['active']:
self._check_moves(cr, uid, ids, "write", context=context)
if 'type' in vals.keys():
@ -949,13 +950,13 @@ class account_fiscalyear(osv.osv):
def finds(self, cr, uid, dt=None, exception=True, context=None):
if context is None: context = {}
if not dt:
dt = time.strftime('%Y-%m-%d')
dt = fields.date.context_today(self,cr,uid,context=context)
args = [('date_start', '<=' ,dt), ('date_stop', '>=', dt)]
if context.get('company_id', False):
args.append(('company_id', '=', context['company_id']))
company_id = context['company_id']
else:
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
args.append(('company_id', '=', company_id))
args.append(('company_id', '=', company_id))
ids = self.search(cr, uid, args, context=context)
if not ids:
if exception:
@ -1038,7 +1039,7 @@ class account_period(osv.osv):
def find(self, cr, uid, dt=None, context=None):
if context is None: context = {}
if not dt:
dt = time.strftime('%Y-%m-%d')
dt = fields.date.context_today(self,cr,uid,context=context)
#CHECKME: shouldn't we check the state of the period?
args = [('date_start', '<=' ,dt), ('date_stop', '>=', dt)]
if context.get('company_id', False):
@ -1077,6 +1078,8 @@ class account_period(osv.osv):
return super(account_period, self).write(cr, uid, ids, vals, context=context)
def build_ctx_periods(self, cr, uid, period_from_id, period_to_id):
if period_from_id == period_to_id:
return period_from_id
period_from = self.browse(cr, uid, period_from_id)
period_date_start = period_from.date_start
company1_id = period_from.company_id.id
@ -1270,12 +1273,14 @@ class account_move(osv.osv):
'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}, select=True),
'narration':fields.text('Internal Note'),
'company_id': fields.related('journal_id','company_id',type='many2one',relation='res.company',string='Company', store=True, readonly=True),
'balance': fields.float('balance', digits_compute=dp.get_precision('Account'), help="This is a field only used for internal purpose and shouldn't be displayed"),
}
_defaults = {
'name': '/',
'state': 'draft',
'period_id': _get_period,
'date': lambda *a: time.strftime('%Y-%m-%d'),
'date': fields.date.context_today,
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
@ -1330,16 +1335,18 @@ class account_move(osv.osv):
def button_validate(self, cursor, user, ids, context=None):
for move in self.browse(cursor, user, ids, context=context):
top = None
# check that all accounts have the same topmost ancestor
top_common = None
for line in move.line_id:
account = line.account_id
while account:
account2 = account
account = account.parent_id
if not top:
top = account2.id
elif top<>account2.id:
raise osv.except_osv(_('Error !'), _('You can not validate a journal entry unless all journal items belongs to the same chart of accounts !'))
top_account = account
while top_account.parent_id:
top_account = top_account.parent_id
if not top_common:
top_common = top_account
elif top_account.id != top_common.id:
raise osv.except_osv(_('Error !'),
_('You cannot validate this journal entry because account "%s" does not belong to chart of accounts "%s"!') % (account.name, top_common.name))
return self.post(cursor, user, ids, context=context)
def button_cancel(self, cr, uid, ids, context=None):
@ -1352,6 +1359,13 @@ class account_move(osv.osv):
'WHERE id IN %s', ('draft', tuple(ids),))
return True
def onchange_line_id(self, cr, uid, ids, line_ids, context=None):
balance = 0.0
for line in line_ids:
if line[2]:
balance += (line[2]['debit'] or 0.00)- (line[2]['credit'] or 0.00)
return {'value': {'balance': balance}}
def write(self, cr, uid, ids, vals, context=None):
if context is None:
context = {}
@ -1771,6 +1785,7 @@ class account_tax_code(osv.osv):
'company_id': fields.many2one('res.company', 'Company', required=True),
'sign': fields.float('Coefficent for parent', required=True, help='You can specify here the coefficient that will be used when consolidating the amount of this case into its parent. For example, set 1/-1 if you want to add/substract it.'),
'notprintable':fields.boolean("Not Printable in Invoice", help="Check this box if you don't want any VAT related to this Tax Code to appear on invoices"),
'sequence': fields.integer('Sequence', help="Determine the display order in the report 'Accounting \ Reporting \ Generic Reporting \ Taxes \ Taxes Report'"),
}
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
@ -2254,7 +2269,7 @@ class account_model(osv.osv):
'ref': entry['name'],
'period_id': period_id,
'journal_id': model.journal_id.id,
'date': context.get('date',time.strftime('%Y-%m-%d'))
'date': context.get('date', fields.date.context_today(self,cr,uid,context=context))
})
move_ids.append(move_id)
for line in model.lines_id:
@ -2291,7 +2306,7 @@ class account_model(osv.osv):
'account_id': line.account_id.id,
'move_id': move_id,
'partner_id': line.partner_id.id,
'date': context.get('date',time.strftime('%Y-%m-%d')),
'date': context.get('date', fields.date.context_today(self,cr,uid,context=context)),
'date_maturity': date_maturity
})
account_move_line_obj.create(cr, uid, val, context=ctx)
@ -2344,7 +2359,7 @@ class account_subscription(osv.osv):
'lines_id': fields.one2many('account.subscription.line', 'subscription_id', 'Subscription Lines')
}
_defaults = {
'date_start': lambda *a: time.strftime('%Y-%m-%d'),
'date_start': fields.date.context_today,
'period_type': 'month',
'period_total': 12,
'period_nbr': 1,
@ -2524,7 +2539,11 @@ class account_account_template(osv.osv):
#deactivate the parent_store functionnality on account_account for rapidity purpose
ctx = context.copy()
ctx.update({'defer_parent_store_computation': True})
children_acc_template = self.search(cr, uid, ['|', ('chart_template_id','=', chart_template_id),'&',('parent_id','child_of', [template.account_root_id.id]),('chart_template_id','=', False), ('nocreate','!=',True)], order='id')
level_ref = {}
children_acc_criteria = [('chart_template_id','=', chart_template_id)]
if template.account_root_id.id:
children_acc_criteria = ['|'] + children_acc_criteria + ['&',('parent_id','child_of', [template.account_root_id.id]),('chart_template_id','=', False)]
children_acc_template = self.search(cr, uid, [('nocreate','!=',True)] + children_acc_criteria, order='id')
for account_template in self.browse(cr, uid, children_acc_template, context=context):
# skip the root of COA if it's not the main one
if (template.account_root_id.id == account_template.id) and template.parent_id:
@ -2537,6 +2556,14 @@ class account_account_template(osv.osv):
code_acc = account_template.code or ''
if code_main > 0 and code_main <= code_digits and account_template.type != 'view':
code_acc = str(code_acc) + (str('0'*(code_digits-code_main)))
parent_id = account_template.parent_id and ((account_template.parent_id.id in acc_template_ref) and acc_template_ref[account_template.parent_id.id]) or False
#the level as to be given as well at the creation time, because of the defer_parent_store_computation in
#context. Indeed because of this, the parent_left and parent_right are not computed and thus the child_of
#operator does not return the expected values, with result of having the level field not computed at all.
if parent_id:
level = parent_id in level_ref and level_ref[parent_id] + 1 or obj_acc._get_level(cr, uid, [parent_id], 'level', None, context=context)[parent_id] + 1
else:
level = 0
vals={
'name': (template.account_root_id.id == account_template.id) and company_name or account_template.name,
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
@ -2547,12 +2574,14 @@ class account_account_template(osv.osv):
'shortcut': account_template.shortcut,
'note': account_template.note,
'financial_report_ids': account_template.financial_report_ids and [(6,0,[x.id for x in account_template.financial_report_ids])] or False,
'parent_id': account_template.parent_id and ((account_template.parent_id.id in acc_template_ref) and acc_template_ref[account_template.parent_id.id]) or False,
'parent_id': parent_id,
'tax_ids': [(6,0,tax_ids)],
'company_id': company_id,
'level': level,
}
new_account = obj_acc.create(cr, uid, vals, context=ctx)
acc_template_ref[account_template.id] = new_account
level_ref[new_account] = level
#reactivate the parent_store functionnality on account_account
obj_acc._parent_store_compute(cr)
@ -2982,7 +3011,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
tax_templ_obj = self.pool.get('account.tax.template')
if 'bank_accounts_id' in fields:
res.update({'bank_accounts_id': [{'acc_name': _('Cash'), 'account_type': 'cash'}]})
res.update({'bank_accounts_id': [{'acc_name': _('Cash'), 'account_type': 'cash'},{'acc_name': _('Bank'), 'account_type': 'bank'}]})
if 'company_id' in fields:
res.update({'company_id': self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0].company_id.id})
if 'seq_journal' in fields:
@ -3340,13 +3369,14 @@ class wizard_multi_charts_accounts(osv.osv_memory):
# because we can't rely on the value current_num as,
# its possible that we already have bank journals created (e.g. by the creation of res.partner.bank)
# and the next number for account code might have been already used before for journal
journal_count = 0
while True:
journal_code = _('BNK') + str(current_num + journal_count)
for num in xrange(current_num, 100):
# journal_code has a maximal size of 5, hence we can enforce the boundary num < 100
journal_code = _('BNK')[:3] + str(num)
ids = obj_journal.search(cr, uid, [('code', '=', journal_code), ('company_id', '=', company_id)], context=context)
if not ids:
break
journal_count += 1
else:
raise osv.except_osv(_('Error'), _('Cannot generate an unused journal code.'))
vals = {
'name': line['acc_name'],

View File

@ -19,8 +19,6 @@
#
##############################################################################
import time
from osv import fields
from osv import osv
from tools.translate import _
@ -41,7 +39,7 @@ class account_analytic_line(osv.osv):
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d'),
'date': fields.date.context_today,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
}
_order = 'date desc'

View File

@ -26,6 +26,8 @@ class bank(osv.osv):
_inherit = "res.partner.bank"
_columns = {
'journal_id': fields.many2one('account.journal', 'Account Journal', help="This journal will be created automatically for this bank account when you save the record"),
'currency_id': fields.related('journal_id', 'currency', type="many2one", relation='res.currency', readonly=True,
string="Currency", help="Currency of the related account journal."),
}
def create(self, cr, uid, data, context={}):
result = super(bank, self).create(cr, uid, data, context=context)

View File

@ -52,8 +52,9 @@ class account_bank_statement(osv.osv):
journal_pool = self.pool.get('account.journal')
journal_type = context.get('journal_type', False)
journal_id = False
company_id = self.pool.get('res.company')._company_default_get(cr, uid, 'account.bank.statement',context=context)
if journal_type:
ids = journal_pool.search(cr, uid, [('type', '=', journal_type)])
ids = journal_pool.search(cr, uid, [('type', '=', journal_type),('company_id','=',company_id)])
if ids:
journal_id = ids[0]
return journal_id
@ -162,37 +163,38 @@ class account_bank_statement(osv.osv):
_defaults = {
'name': "/",
'date': lambda *a: time.strftime('%Y-%m-%d'),
'date': fields.date.context_today,
'state': 'draft',
'journal_id': _default_journal_id,
'period_id': _get_period,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.bank.statement',context=c),
}
def onchange_date(self, cr, user, ids, date, context=None):
def _check_company_id(self, cr, uid, ids, context=None):
for statement in self.browse(cr, uid, ids, context=context):
if statement.company_id.id != statement.period_id.company_id.id:
return False
return True
_constraints = [
(_check_company_id, 'The journal and period chosen have to belong to the same company.', ['journal_id','period_id']),
]
def onchange_date(self, cr, uid, ids, date, company_id, context=None):
"""
Returns a dict that contains new values and context
@param cr: A database cursor
@param user: ID of the user currently logged in
@param date: latest value from user input for field date
@param args: other arguments
@param context: context arguments, like lang, time zone
@return: Returns a dict which contains new values, and context
Find the correct period to use for the given date and company_id, return it and set it in the context
"""
res = {}
period_pool = self.pool.get('account.period')
if context is None:
context = {}
pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
ctx = context.copy()
ctx.update({'company_id': company_id})
pids = period_pool.find(cr, uid, dt=date, context=ctx)
if pids:
res.update({
'period_id':pids[0]
})
context.update({
'period_id':pids[0]
})
res.update({'period_id': pids[0]})
context.update({'period_id': pids[0]})
return {
'value':res,
@ -385,8 +387,10 @@ class account_bank_statement(osv.osv):
ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft'))
res = cr.fetchone()
balance_start = res and res[0] or 0.0
account_id = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id'], context=context)['default_debit_account_id']
return {'value': {'balance_start': balance_start, 'account_id': account_id}}
journal_data = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id', 'company_id'], context=context)
account_id = journal_data['default_debit_account_id']
company_id = journal_data['company_id']
return {'value': {'balance_start': balance_start, 'account_id': account_id, 'company_id': company_id}}
def unlink(self, cr, uid, ids, context=None):
stat = self.read(cr, uid, ids, ['state'], context=context)
@ -468,6 +472,7 @@ class account_bank_statement_line(osv.osv):
required=True),
'statement_id': fields.many2one('account.bank.statement', 'Statement',
select=True, required=True, ondelete='cascade'),
'journal_id': fields.related('statement_id', 'journal_id', type='many2one', relation='account.journal', string='Journal', store=True, readonly=True),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'),
'move_ids': fields.many2many('account.move',
'account_bank_statement_line_move_rel', 'statement_line_id','move_id',
@ -479,7 +484,7 @@ class account_bank_statement_line(osv.osv):
}
_defaults = {
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
'date': lambda self,cr,uid,context={}: context.get('date', time.strftime('%Y-%m-%d')),
'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(self,cr,uid,context=context)),
'type': 'general',
}

View File

@ -16,12 +16,26 @@
<group name="accounting" col="2" colspan="2" attrs="{'invisible': [('company_id','=', False)]}" groups="base.group_extended">
<separator string="Accounting Information" colspan="2"/>
<field name="journal_id"/>
<field name="currency_id"/>
</group>
</group>
</field>
</record>
<record id="view_partner_bank_tree_add_currency" model="ir.ui.view">
<field name="name">Partner Bank Accounts - Add currency on tree</field>
<field name="model">res.partner.bank</field>
<field name="type">tree</field>
<field name="inherit_id" ref="base.view_partner_bank_tree"/>
<field name="arch" type="xml">
<field name="acc_number" position="after">
<field name="currency_id"/>
</field>
</field>
</record>
<record id="action_bank_tree" model="ir.actions.act_window">
<field name="name">Setup your Bank Accounts</field>
<field name="res_model">res.partner.bank</field>

View File

@ -212,25 +212,12 @@ class account_cash_statement(osv.osv):
def create(self, cr, uid, vals, context=None):
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context).type == 'cash':
open_close = self._get_cash_open_close_box_lines(cr, uid, context)
if vals.get('starting_details_ids', False):
for start in vals.get('starting_details_ids'):
dict_val = start[2]
for end in open_close['end']:
if end[2]['pieces'] == dict_val['pieces']:
end[2]['number'] += dict_val['number']
vals.update({
# 'ending_details_ids': open_close['start'],
'starting_details_ids': open_close['end']
})
else:
vals.update({
'ending_details_ids': False,
'starting_details_ids': False
})
res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
self.write(cr, uid, [res_id], {})
return res_id
amount_total = 0.0
for line in vals.get('starting_details_ids',[]):
if line and len(line)==3 and line[2]:
amount_total+= line[2]['pieces'] * line[2]['number']
vals.update(balance_start= amount_total)
return super(account_cash_statement, self).create(cr, uid, vals, context=context)
def write(self, cr, uid, ids, vals, context=None):
"""

View File

@ -55,39 +55,37 @@ class account_financial_report(osv.osv):
res += self._get_children_by_order(cr, uid, ids2, context=context)
return res
def _get_balance(self, cr, uid, ids, name, args, context=None):
def _get_balance(self, cr, uid, ids, field_names, args, context=None):
account_obj = self.pool.get('account.account')
res = {}
res_all = {}
for report in self.browse(cr, uid, ids, context=context):
balance = 0.0
if report.id in res_all:
balance = res_all[report.id]
elif report.type == 'accounts':
# it's the sum of balance of the linked accounts
if report.id in res:
continue
res[report.id] = dict((fn, 0.0) for fn in field_names)
if report.type == 'accounts':
# it's the sum of the linked accounts
for a in report.account_ids:
balance += a.balance
for field in field_names:
res[report.id][field] += getattr(a, field)
elif report.type == 'account_type':
# it's the sum of balance of the leaf accounts with such an account type
# it's the sum the leaf accounts with such an account type
report_types = [x.id for x in report.account_type_ids]
account_ids = account_obj.search(cr, uid, [('user_type','in', report_types), ('type','!=','view')], context=context)
for a in account_obj.browse(cr, uid, account_ids, context=context):
balance += a.balance
for field in field_names:
res[report.id][field] += getattr(a, field)
elif report.type == 'account_report' and report.account_report_id:
# it's the amount of the linked report
res2 = self._get_balance(cr, uid, [report.account_report_id.id], 'balance', False, context=context)
res_all.update(res2)
res2 = self._get_balance(cr, uid, [report.account_report_id.id], field_names, False, context=context)
for key, value in res2.items():
balance += value
for field in field_names:
res[report.id][field] += value[field]
elif report.type == 'sum':
# it's the sum of balance of the children of this account.report
#for child in report.children_ids:
res2 = self._get_balance(cr, uid, [rec.id for rec in report.children_ids], 'balance', False, context=context)
res_all.update(res2)
# it's the sum of the children of this account.report
res2 = self._get_balance(cr, uid, [rec.id for rec in report.children_ids], field_names, False, context=context)
for key, value in res2.items():
balance += value
res[report.id] = balance
res_all[report.id] = balance
for field in field_names:
res[report.id][field] += value[field]
return res
_columns = {
@ -95,7 +93,9 @@ class account_financial_report(osv.osv):
'parent_id': fields.many2one('account.financial.report', 'Parent'),
'children_ids': fields.one2many('account.financial.report', 'parent_id', 'Account Report'),
'sequence': fields.integer('Sequence'),
'balance': fields.function(_get_balance, 'Balance'),
'balance': fields.function(_get_balance, 'Balance', multi='balance'),
'debit': fields.function(_get_balance, 'Debit', multi='balance'),
'credit': fields.function(_get_balance, 'Credit', multi="balance"),
'level': fields.function(_get_level, string='Level', store=True, type='integer'),
'type': fields.selection([
('sum','View'),
@ -104,20 +104,30 @@ class account_financial_report(osv.osv):
('account_report','Report Value'),
],'Type'),
'account_ids': fields.many2many('account.account', 'account_account_financial_report', 'report_line_id', 'account_id', 'Accounts'),
'account_report_id': fields.many2one('account.financial.report', 'Report Value'),
'account_type_ids': fields.many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types'),
'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'),
'display_detail': fields.selection([
('no_detail','No detail'),
('detail_flat','Display children flat'),
('detail_with_hierarchy','Display children with hierarchy')
], 'Display details'),
'account_report_id': fields.many2one('account.financial.report', 'Report Value'),
'account_type_ids': fields.many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types'),
'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'),
'style_overwrite': fields.selection([
(0, 'Automatic formatting'),
(1,'Main Title 1 (bold, underlined)'),
(2,'Title 2 (bold)'),
(3,'Title 3 (bold, smaller)'),
(4,'Normal Text'),
(5,'Italic Text (smaller)'),
(6,'Smallest Text'),
],'Financial Report Style', help="You can set up here the format you want this record to be displayed. If you leave the automatic formatting, it will be computed based on the financial reports hierarchy (auto-computed field 'level')."),
}
_defaults = {
'type': 'sum',
'display_detail': 'detail_flat',
'sign': 1,
'style_overwrite': 0,
}
account_financial_report()

View File

@ -4,23 +4,6 @@
<!--
Financial Reports
-->
<record id="account_financial_report_balancesheet0" model="account.financial.report">
<field name="name">Balance Sheet</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_assets0" model="account.financial.report">
<field name="name">Assets</field>
<field name="parent_id" ref="account_financial_report_balancesheet0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_liability0" model="account.financial.report">
<field name="name">Liability</field>
<field name="parent_id" ref="account_financial_report_balancesheet0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_profitandloss0" model="account.financial.report">
<field name="name">Profit and Loss</field>
<field name="type">sum</field>
@ -38,6 +21,35 @@
<field name="type">account_type</field>
</record>
<record id="account_financial_report_balancesheet0" model="account.financial.report">
<field name="name">Balance Sheet</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_assets0" model="account.financial.report">
<field name="name">Assets</field>
<field name="parent_id" ref="account_financial_report_balancesheet0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_liabilitysum0" model="account.financial.report">
<field name="name">Liability</field>
<field name="parent_id" ref="account_financial_report_balancesheet0"/>
<field name="display_detail">no_detail</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_liability0" model="account.financial.report">
<field name="name">Liability</field>
<field name="parent_id" ref="account_financial_report_liabilitysum0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
</record>
<record id="account_financial_report_profitloss_toreport0" model="account.financial.report">
<field name="name">Profit (Loss) to report</field>
<field name="parent_id" ref="account_financial_report_liabilitysum0"/>
<field name="display_detail">no_detail</field>
<field name="type">account_report</field>
<field name="account_report_id" ref="account_financial_report_profitandloss0"/>
</record>
</data>
</openerp>

View File

@ -58,10 +58,12 @@ class account_invoice(osv.osv):
return res and res[0] or False
def _get_currency(self, cr, uid, context=None):
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid], context=context)[0]
if user.company_id:
return user.company_id.currency_id.id
return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=', 1.0)])[0]
res = False
journal_id = self._get_journal(cr, uid, context=context)
if journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
res = journal.currency and journal.currency.id or journal.company_id.currency_id.id
return res
def _get_journal_analytic(self, cr, uid, type_inv, context=None):
type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale', 'in_refund': 'purchase'}
@ -287,7 +289,7 @@ class account_invoice(osv.osv):
'user_id': lambda s, cr, u, c: u,
}
_sql_constraints = [
('number_uniq', 'unique(number, company_id)', 'Invoice Number must be unique per Company!'),
('number_uniq', 'unique(number, company_id, journal_id, type)', 'Invoice Number must be unique per Company!'),
]
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
@ -316,6 +318,15 @@ class account_invoice(osv.osv):
res['fields'][field]['selection'] = journal_select
doc = etree.XML(res['arch'])
if context.get('type', False):
for node in doc.xpath("//field[@name='partner_bank_id']"):
if context['type'] == 'in_refund':
node.set('domain', "[('partner_id.ref_companies', 'in', [company_id])]")
elif context['type'] == 'out_refund':
node.set('domain', "[('partner_id', '=', partner_id)]")
res['arch'] = etree.tostring(doc)
if view_type == 'search':
if context.get('type', 'in_invoice') in ('out_invoice', 'out_refund'):
for node in doc.xpath("//group[@name='extended filter']"):
@ -338,7 +349,7 @@ class account_invoice(osv.osv):
context = {}
res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form')
view_id = res and res[1] or False
context.update({'view_id': view_id})
context['view_id'] = view_id
return context
def create(self, cr, uid, vals, context=None):
@ -455,10 +466,10 @@ class account_invoice(osv.osv):
result['value'].update(to_update['value'])
return result
def onchange_journal_id(self, cr, uid, ids, journal_id=False):
def onchange_journal_id(self, cr, uid, ids, journal_id=False, context=None):
result = {}
if journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
currency_id = journal.currency and journal.currency.id or journal.company_id.currency_id.id
result = {'value': {
'currency_id': currency_id,
@ -563,18 +574,6 @@ class account_invoice(osv.osv):
else:
journal_ids = obj_journal.search(cr, uid, [])
if currency_id and company_id:
currency = self.pool.get('res.currency').browse(cr, uid, currency_id)
if currency.company_id and currency.company_id.id != company_id:
val['currency_id'] = False
else:
val['currency_id'] = currency.id
if company_id:
company = self.pool.get('res.company').browse(cr, uid, company_id)
if company.currency_id.company_id and company.currency_id.company_id.id != company_id:
val['currency_id'] = False
else:
val['currency_id'] = company.currency_id.id
return {'value': val, 'domain': dom}
# go from canceled state to draft state
@ -815,7 +814,7 @@ class account_invoice(osv.osv):
ctx = context.copy()
ctx.update({'lang': inv.partner_id.lang})
if not inv.date_invoice:
self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')}, context=ctx)
self.write(cr, uid, [inv.id], {'date_invoice': fields.date.context_today(self,cr,uid,context=context)}, context=ctx)
company_currency = inv.company_id.currency_id.id
# create the analytical lines
# one move line per invoice line
@ -1363,17 +1362,6 @@ class account_invoice_line(osv.osv):
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False)
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
if type in ('in_invoice','in_refund') and tax_id and price_unit:
tax_pool = self.pool.get('account.tax')
tax_browse = tax_pool.browse(cr, uid, tax_id)
if not isinstance(tax_browse, list):
tax_browse = [tax_browse]
taxes = tax_pool.compute_inv(cr, uid, tax_browse, price_unit, 1)
tax_amount = reduce(lambda total, tax_dict: total + tax_dict.get('amount', 0.0), taxes, 0.0)
price_unit = price_unit - tax_amount
if qty != 0:
price_unit = price_unit / float(qty)
if type in ('in_invoice', 'in_refund'):
result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} )
else:
@ -1489,13 +1477,19 @@ class account_invoice_line(osv.osv):
#
# Set the tax field according to the account and the fiscal position
#
def onchange_account_id(self, cr, uid, ids, fposition_id, account_id):
def onchange_account_id(self, cr, uid, ids, product_id, partner_id, inv_type, fposition_id, account_id):
if not account_id:
return {}
taxes = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
res = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
return {'value':{'invoice_line_tax_id': res}}
tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
product_change_result = self.product_id_change(cr, uid, ids, product_id, False, type=inv_type,
partner_id=partner_id, fposition_id=fposition_id)
unique_tax_ids = set(tax_ids)
if product_change_result and 'value' in product_change_result and 'invoice_line_tax_id' in product_change_result['value']:
unique_tax_ids |= set(product_change_result['value']['invoice_line_tax_id'])
return {'value':{'invoice_line_tax_id': list(unique_tax_ids)}}
account_invoice_line()

View File

@ -59,7 +59,7 @@
<field name="uos_id" on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, context, parent.company_id)" nolabel="1"/>
</group>
<field name="price_unit"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(parent.fiscal_position,account_id)"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
<field name="discount" groups="base.group_extended"/>
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
@ -171,7 +171,7 @@
<field colspan="4" context="{'address_invoice_id': address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False, 'type': type}" name="invoice_line" nolabel="1">
<tree string="Invoice lines">
<field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, context, parent.company_id)"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(parent.fiscal_position,account_id)"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(product_id,parent.partner_id,parent.type,parent.fiscal_position,account_id)"/>
<field name="invoice_line_tax_id" view_mode="2" context="{'type':parent.type}" domain="[('parent_id','=',False)]"/>
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<field name="quantity"/>
@ -256,7 +256,7 @@
<field name="arch" type="xml">
<form string="Invoice">
<group colspan="4" col="8">
<field name="journal_id" groups="base.group_user" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<field name="journal_id" groups="base.group_user" on_change="onchange_journal_id(journal_id, context)" widget="selection"/>
<field name="number"/>
<field name="type" invisible="1"/>
<field name="currency_id" width="50"/>
@ -291,7 +291,9 @@
</field>
</group>
<group col="4" colspan="2">
<button colspan="2" name="button_reset_taxes" states="draft,proforma2" string="Compute Taxes" type="object" groups="base.group_user" icon="terp-stock_format-scientific" help="This action will erase taxes"/>
<group colspan="2" col="1">
<button name="button_reset_taxes" states="draft,proforma2" string="Compute Taxes" type="object" groups="base.group_user" icon="terp-stock_format-scientific" help="This action will erase taxes"/>
</group>
<field name="amount_untaxed"/>
<label string="" colspan="2"/>
<field name="amount_tax"/>

View File

@ -228,13 +228,8 @@ class account_move_line(osv.osv):
# Compute simple values
data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
# Starts: Manual entry from account.move form
if context.get('lines',[]):
total_new = 0.00
for i in context['lines']:
if i[2]:
total_new += (i[2]['debit'] or 0.00)- (i[2]['credit'] or 0.00)
for item in i[2]:
data[item] = i[2][item]
if context.get('lines'):
total_new = context.get('balance', 0.00)
if context['journal']:
journal_data = journal_obj.browse(cr, uid, context['journal'], context=context)
if journal_data.type == 'purchase':
@ -555,7 +550,7 @@ class account_move_line(osv.osv):
'blocked': False,
'centralisation': 'normal',
'date': _get_date,
'date_created': lambda *a: time.strftime('%Y-%m-%d'),
'date_created': fields.date.context_today,
'state': 'draft',
'currency_id': _get_currency,
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),
@ -826,13 +821,9 @@ class account_move_line(osv.osv):
(tuple(ids), ))
r = cr.fetchall()
#TODO: move this check to a constraint in the account_move_reconcile object
if (len(r) != 1) and not context.get('fy_closing', False):
raise osv.except_osv(_('Error'), _('Entries are not of the same account or already reconciled ! '))
if not unrec_lines:
raise osv.except_osv(_('Error'), _('Entry is already reconciled'))
account = account_obj.browse(cr, uid, account_id, context=context)
if not context.get('fy_closing', False) and not account.reconcile:
raise osv.except_osv(_('Error'), _('This account does not allow reconciliation! You should update the account definition to change this.'))
if r[0][1] != None:
raise osv.except_osv(_('Error'), _('Some entries are already reconciled !'))
@ -1064,6 +1055,7 @@ class account_move_line(osv.osv):
elif field == 'statement_id':
f.set('domain', "[('state', '!=', 'confirm'),('journal_id.type', '=', 'bank')]")
f.set('invisible', 'True')
elif field == 'date':
f.set('on_change', 'onchange_date(date)')

View File

@ -10,6 +10,7 @@
<report auto="False" id="account_central_journal" model="account.journal.period" name="account.central.journal" rml="account/report/account_central_journal.rml" string="Central Journal" header="False"/>
<report auto="False" id="account_general_journal" model="account.journal.period" name="account.general.journal" rml="account/report/account_general_journal.rml" string="General Journal" header="False"/>
<report auto="False" id="account_journal" model="account.journal.period" name="account.journal.period.print" rml="account/report/account_journal.rml" string="Journal" header="False"/>
<report auto="False" id="account_journal_sale_purchase" model="account.journal.period" name="account.journal.period.print.sale.purchase" rml="account/report/account_journal_sale_purchase.rml" string="Sale/Purchase Journal" header="False"/>
<report auto="False" id="account_overdue" model="res.partner" name="account.overdue" rml="account/report/account_print_overdue.rml" string="Overdue Payments"/>
<report
auto="False"

View File

@ -524,8 +524,9 @@
<field name="arch" type="xml">
<search string="Search Bank Statements">
<group>
<filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
<filter string="Confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<filter string="Draft" name="state_draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
<filter string="Open" name="state_open" domain="[('state','=','open')]" icon="terp-check"/>
<filter string="Confirmed" name="state_confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<separator orientation="vertical"/>
<field name="date"/>
<field name="name"/>
@ -594,7 +595,7 @@
<form string="Bank Statement">
<group col="7" colspan="4">
<field name="name" select="1"/>
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="date" select="1" on_change="onchange_date(date, company_id)"/>
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" select="1" widget="selection"/>
<newline/>
<field name="period_id"/>
@ -655,7 +656,8 @@
<form string="Bank Statement">
<group col="7" colspan="4">
<field name="name" select="1"/>
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="date" select="1" on_change="onchange_date(date, company_id)"/>
<field name='company_id' widget="selection" groups="base.group_multi_company" />
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" widget="selection"/>
<newline/>
<field name="period_id"/>
@ -1274,14 +1276,6 @@
groups="group_account_user"
/>
<record id="action_move_line_select" model="ir.actions.act_window">
<field name="name">Journal Items</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_account_move_line_filter"/>
</record>
<record id="action_view_move_line" model="ir.actions.act_window">
<field name="name">Lines to reconcile</field>
<field name="res_model">account.move.line</field>
@ -1300,7 +1294,6 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_move_line_tree"/>
<field name="search_view_id" ref="view_account_move_line_filter"/>
<field name="domain">[]</field>
<field name="context">{'search_default_account_id': [active_id]}</field>
</record>
@ -1363,7 +1356,10 @@
</group>
<notebook colspan="4">
<page string="Journal Items">
<field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list" context="{'lines':line_id ,'journal':journal_id }">
<field name="balance" invisible="1"/>
<field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list"
on_change="onchange_line_id(line_id)"
context="{'balance': balance , 'journal': journal_id }">
<form string="Journal Item">
<group col="6" colspan="4">
<field name="name"/>
@ -2489,11 +2485,20 @@
<field name="model_id" ref="base.model_ir_actions_todo"/>
<field eval="5" name="sequence"/>
<field name="code">
act_window_ids = pool.get('ir.actions.act_window').search(cr, uid,[('name', 'in', ('Accounting Chart Configuration', 'Generate Chart of Accounts from a Chart Template'))], context=context)
# check for unconfigured companies
account_installer_obj = self.pool.get('account.installer')
account_installer_obj.check_unconfigured_cmp(cr, uid, context=context)
action_ids = []
# fetch the act_window actions related to chart of account configuration
# we use ir.actions.todo to enable the possibility for other modules to insert their own
# wizards during the configuration process
ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_wizard_multi_chart')
if ref:
action_ids += [ref[1]]
ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'action_account_configuration_installer')
if ref:
act_window_ids += [ref[1]]
todo_ids = pool.get('ir.actions.todo').search(cr, uid, [('action_id', 'in', act_window_ids)], context=context)
action_ids += [ref[1]]
todo_ids = pool.get('ir.actions.todo').search(cr, uid, [('action_id', 'in', action_ids)], context=context)
pool.get('ir.actions.todo').write(cr, uid, todo_ids, {'state':'open'}, context=context)
action = pool.get('res.config').next(cr, uid, [], context)
</field>
@ -2620,7 +2625,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
<form string="Statement">
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<field name='company_id' widget="selection" groups="base.group_multi_company" />
<field name="journal_id" on_change="onchange_journal_id(journal_id)" select="1" widget="selection"/>
<field name="user_id" select="1" readonly="1"/>
<field name="period_id" select="1"/>
@ -2693,7 +2698,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
<group col="6" colspan="4">
<group col="2" colspan="2">
<separator string="Dates" colspan="4"/>
<field name="date" select="1" attrs="{'readonly':[('state','!=','draft')]}" on_change="onchange_date(date)"/>
<field name="date" select="1" attrs="{'readonly':[('state','!=','draft')]}" on_change="onchange_date(date, company_id)"/>
<field name="closing_date" select="1" readonly="1"/>
</group>
<group col="2" colspan="2">
@ -2785,6 +2790,7 @@ action = pool.get('res.config').next(cr, uid, [], context)
<field name="sequence"/>
<field name="type"/>
<field name="sign"/>
<field name="style_overwrite"/>
</group>
<notebook colspan="6">
<page string="Report">

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="1">
<record model="account.account.type" id="data_account_type_view">
<field name="name">View</field>
<field name="name">Root/View</field>
<field name="code">view</field>
<field name="close_method">none</field>
</record>
@ -10,21 +10,25 @@
<field name="name">Receivable</field>
<field name="code">receivable</field>
<field name="close_method">unreconciled</field>
<field name="report_type">asset</field>
</record>
<record model="account.account.type" id="data_account_type_payable">
<field name="name">Payable</field>
<field name="code">payable</field>
<field name="close_method">unreconciled</field>
<field name="report_type">liability</field>
</record>
<record model="account.account.type" id="data_account_type_bank">
<field name="name">Bank</field>
<field name="code">bank</field>
<field name="close_method">balance</field>
<field name="report_type">asset</field>
</record>
<record model="account.account.type" id="data_account_type_cash">
<field name="name">Cash</field>
<field name="code">cash</field>
<field name="close_method">balance</field>
<field name="report_type">asset</field>
</record>
<record model="account.account.type" id="data_account_type_asset">
<field name="name">Asset</field>

View File

@ -33,7 +33,8 @@
<field eval="True" name="special"/>
<field name="fiscalyear_id" ref="data_fiscalyear"/>
<field eval="time.strftime('%Y')+'-02-01'" name="date_start"/>
<field eval="time.strftime('%Y')+'-02-28'" name="date_stop"/>
<!-- for the last day of February, we have to compute the day before March 1st -->
<field eval="(DateTime.today().replace(month=3, day=1) - timedelta(days=1)).strftime('%Y-%m-%d')" name="date_stop"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="period_3" model="account.period">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

13350
addons/account/i18n/es_CR.po Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -78,15 +78,26 @@ class account_installer(osv.osv_memory):
'has_default_company': _default_has_default_company,
'charts': 'configurable'
}
def get_unconfigured_cmp(self, cr, uid, context=None):
""" get the list of companies that have not been configured yet
but don't care about the demo chart of accounts """
cmp_select = []
company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
cr.execute("SELECT company_id FROM account_account WHERE active = 't' AND account_account.parent_id IS NULL AND name != %s", ("Chart For Automated Tests",))
configured_cmp = [r[0] for r in cr.fetchall()]
return list(set(company_ids)-set(configured_cmp))
def check_unconfigured_cmp(self, cr, uid, context=None):
""" check if there are still unconfigured companies """
if not self.get_unconfigured_cmp(cr, uid, context=context):
raise osv.except_osv(_('No unconfigured company !'), _("There are currently no company without chart of account. The wizard will therefore not be executed."))
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(account_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
cmp_select = []
company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
#display in the widget selection of companies, only the companies that haven't been configured yet (but don't care about the demo chart of accounts)
cr.execute("SELECT company_id FROM account_account WHERE active = 't' AND account_account.parent_id IS NULL AND name != %s", ("Chart For Automated Tests",))
configured_cmp = [r[0] for r in cr.fetchall()]
unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
# display in the widget selection only the companies that haven't been configured yet
unconfigured_cmp = self.get_unconfigured_cmp(cr, uid, context=context)
for field in res['fields']:
if field == 'company_id':
res['fields'][field]['domain'] = [('id','in',unconfigured_cmp)]

View File

@ -13,6 +13,7 @@
<field name="code" groups="base.group_extended"/>
<field name="quantity"/>
<field name="date"/>
<field name="date_start" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
<field name="partner_id" invisible="1"/>

View File

@ -58,18 +58,28 @@ class report_account_common(report_sxw.rml_parse, common_report_header):
'name': report.name,
'balance': report.balance,
'type': 'report',
'level': report.level,
'level': bool(report.style_overwrite) and report.style_overwrite or report.level,
'account_type': report.type =='sum' and 'view' or False, #used to underline the financial report balances
}
if data['form']['debit_credit']:
vals['debit'] = report.debit
vals['credit'] = report.credit
if data['form']['enable_filter']:
vals['balance_cmp'] = self.pool.get('account.financial.report').browse(self.cr, self.uid, report.id, context=data['form']['comparison_context']).balance
lines.append(vals)
account_ids = []
if report.display_detail == 'no_detail':
#the rest of the loop is used to display the details of the financial report, so it's not needed here.
continue
if report.type == 'accounts' and report.account_ids:
account_ids = account_obj._get_children_and_consol(self.cr, self.uid, [x.id for x in report.account_ids])
elif report.type == 'account_type' and report.account_type_ids:
account_ids = account_obj.search(self.cr, self.uid, [('user_type','in', [x.id for x in report.account_type_ids])])
if account_ids:
for account in account_obj.browse(self.cr, self.uid, account_ids, context=data['form']['used_context']):
#if there are accounts to display, we add them to the lines with a level equals to their level in
#the COA + 1 (to avoid having them with a too low level that would conflicts with the level of data
#financial reports for Assets, liabilities...)
if report.display_detail == 'detail_flat' and account.type == 'view':
continue
flag = False
@ -77,9 +87,13 @@ class report_account_common(report_sxw.rml_parse, common_report_header):
'name': account.code + ' ' + account.name,
'balance': account.balance != 0 and account.balance * report.sign or account.balance,
'type': 'account',
'level': report.display_detail == 'detail_with_hierarchy' and min(account.level,6) or 6,
'level': report.display_detail == 'detail_with_hierarchy' and min(account.level + 1,6) or 6, #account.level + 1
'account_type': account.type,
}
if data['form']['debit_credit']:
vals['debit'] = account.debit
vals['credit'] = account.credit
if not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance']):
flag = True
if data['form']['enable_filter']:

View File

@ -127,43 +127,31 @@
<paraStyle name="terp_level_0_name" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_0_balance" fontName="Helvetica-Bold" fontSize="9.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_name" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_balance" fontName="Helvetica-Bold" fontSize="9.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_name" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_balance" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_name" fontName="Helvetica" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_name_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_name" fontName="Helvetica" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_name_bold" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_name" fontName="Helvetica-Bold" fontSize="10.0" alignment="LEFT" leading="20" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_1_balance" fontName="Helvetica-Bold" fontSize="10.0" alignment="RIGHT" leading="20" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_name" fontName="Helvetica-Bold" fontSize="9.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_2_balance" fontName="Helvetica-Bold" fontSize="9.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_name" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_3_balance" fontName="Helvetica-Bold" fontSize="8.0" leftIndent="10.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_name" fontName="Helvetica" fontSize="8.0" leftIndent="20.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_4_balance" fontName="Helvetica" fontSize="8.0" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_5_name" fontName="Helvetica-Oblique" fontSize="7.5" leftIndent="30.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_5_balance" fontName="Helvetica-Oblique" fontSize="7.5" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_6_name" fontName="Helvetica" fontSize="6.5" leftIndent="40.0" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_level_6_balance" fontName="Helvetica" fontSize="6.5" leftIndent="0.0" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<blockTableStyle id="Table1">
<blockTopPadding start="0,0" stop="-1,0" length="15"/>
<blockFont name="Helvetica-Bold" size="10.0" />
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,1" thickness="1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockTopPadding start="0,0" stop="-1,0" length="10"/>
<blockAlignment value="LEFT"/>
<lineStyle kind="LINEBELOW" colorName="#666666" start="1,1" stop="1,1"/>
<lineStyle kind="LINEBELOW" colorName="#666666" start="1,1" stop="-1,1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table2_Report">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="GRID" colorName="#cccccc"/>
</blockTableStyle>
<blockTableStyle id="Table1_main">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
</stylesheet>
<images/>
<story>
@ -217,8 +205,40 @@
<para style="Standard">
<font color="white"> </font>
</para>
<!-- table with debit/credit displayed -->
<blockTable colWidths="210.0,90.0,90.0,100.0" style="Table_Account_Line_Title">
[[ data['form']['debit_credit'] == 1 or removeParentNode('blockTable') ]]
<tr>
<td>
<para style="terp_default_Bold_9">Name</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Debit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Credit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
</tr>
<tr style="Table3">
[[ repeatIn(get_lines(data), 'a') ]]
[[ (a.get('level') &lt;&gt; 0) or removeParentNode('tr') ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]]
<td><para style="terp_level_3_name">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]]</para></td>
<td><para style="terp_level_3_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('debit',0.0), currency_obj = company.currency_id) ]]</para></td>
<td><para style="terp_level_3_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('credit',0.0), currency_obj = company.currency_id) ]]</para></td>
<td>[[ (a.get('account_type') =='view' and a.get('level') &lt;&gt; 1) or removeParentNode('td') ]]
<para style="terp_level_3_balance"><u>[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</u></para></td>
<td>[[ (a.get('account_type') &lt;&gt;'view' or a.get('level') == 1) or removeParentNode('td') ]]
<para style="terp_level_3_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</para></td>
</tr>
</blockTable>
<!-- table with no comparison, no debit/credit displayed -->
<blockTable colWidths="390.0,100.0" style="Table_Account_Line_Title">
[[ data['form']['enable_filter'] == 0 or removeParentNode('blockTable') ]]
[[ (not data['form']['enable_filter'] and not data['form']['debit_credit']) or removeParentNode('blockTable') ]]
<tr>
<td>
<para style="terp_default_Bold_9">Name</para>
@ -231,16 +251,20 @@
[[ repeatIn(get_lines(data), 'a') ]]
[[ (a.get('level') &lt;&gt; 0) or removeParentNode('tr') ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]]
<td><para style="terp_level_3_name">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 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') ]]</para></td>
<td>[[ (a.get('level') &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 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) ]]</para></td>
<td>[[ a.get('level') == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</u></para></td>
<td><para style="terp_level_3_name">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]]</para></td>
<td>[[ (a.get('account_type') =='view' and a.get('level') &lt;&gt; 1) or removeParentNode('td') ]]
<para style="terp_level_3_balance"><u>[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</u></para></td>
<td>[[ (a.get('account_type') &lt;&gt;'view' or a.get('level') == 1) or removeParentNode('td') ]]
<para style="terp_level_3_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</para></td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<!-- table with comparison -->
<blockTable colWidths="263.0,100.0,100" style="Table_Account_Line_Title">
[[ data['form']['enable_filter'] == 1 or removeParentNode('blockTable') ]]
[[ (data['form']['enable_filter'] == 1 and not data['form']['debit_credit']) or removeParentNode('blockTable') ]]
<tr>
<td>
<para style="terp_default_Bold_9">Name</para>
@ -256,11 +280,15 @@
[[ repeatIn(get_lines(data), 'a') ]]
[[ (a.get('level') &lt;&gt; 0) or removeParentNode('tr') ]]
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,'level' in a and a.get('level') or 1))}) ]]
<td><para style="terp_level_3_name">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 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') ]]</para></td>
<td>[[ (a.get('level') &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 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) ]]</para></td>
<td>[[ a.get('level') == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</u></para></td>
<td>[[ (a.get('level') &lt;&gt;2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.get('account_type') =='view' and a.get('level') &gt;= 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) ]]</para></td>
<td>[[ a.get('level') == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]]</u></para></td>
<td><para style="terp_level_3_name">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_name'}) ]][[ a.get('name') ]]</para></td>
<td>[[ (a.get('account_type') =='view' and a.get('level') &lt;&gt; 1) or removeParentNode('td') ]]
<para style="terp_level_3_balance"><u>[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</u></para></td>
<td>[[ (a.get('account_type') &lt;&gt;'view' or a.get('level') == 1) or removeParentNode('td') ]]
<para style="terp_level_3_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance'), currency_obj = company.currency_id) ]]</para></td>
<td>[[ (a.get('account_type') =='view' and a.get('level') &lt;&gt; 1) or removeParentNode('td') ]]
<para style="terp_level_3_balance"><u>[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]]</u></para></td>
<td>[[ (a.get('account_type') &lt;&gt;'view' or a.get('level') == 1) or removeParentNode('td') ]]
<para style="terp_level_3_balance">[[ setTag('para','para',{'style': 'terp_level_'+str(min(6,a.get('level')))+'_balance'}) ]][[ formatLang(a.get('balance_cmp'), currency_obj = company.currency_id) ]]</para></td>
</tr>
</blockTable>
<para style="Standard">

View File

@ -30,8 +30,9 @@ class journal_print(report_sxw.rml_parse, common_report_header):
context = {}
super(journal_print, self).__init__(cr, uid, name, context=context)
self.period_ids = []
self.last_move_id = False
self.journal_ids = []
self.sort_selection = 'date'
self.sort_selection = 'am.name'
self.localcontext.update({
'time': time,
'lines': self.lines,
@ -47,6 +48,10 @@ class journal_print(report_sxw.rml_parse, common_report_header):
'display_currency':self._display_currency,
'get_sortby': self._get_sortby,
'get_target_move': self._get_target_move,
'check_last_move_id': self.check_last_move_id,
'set_last_move_id': self.set_last_move_id,
'tax_codes': self.tax_codes,
'sum_vat': self._sum_vat,
})
def set_context(self, objects, data, ids, report_type=None):
@ -55,17 +60,53 @@ class journal_print(report_sxw.rml_parse, common_report_header):
self.query_get_clause = ''
self.target_move = data['form'].get('target_move', 'all')
if (data['model'] == 'ir.ui.menu'):
self.period_ids = tuple(data['form']['periods'])
self.journal_ids = tuple(data['form']['journal_ids'])
new_ids = data['form'].get('active_ids', [])
self.query_get_clause = 'AND '
self.query_get_clause += obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context', {}))
self.sort_selection = data['form'].get('sort_selection', 'date')
objects = self.pool.get('account.journal.period').browse(self.cr, self.uid, new_ids)
if new_ids:
elif new_ids:
#in case of direct access from account.journal.period object, we need to set the journal_ids and periods_ids
self.cr.execute('SELECT period_id, journal_id FROM account_journal_period WHERE id IN %s', (tuple(new_ids),))
res = self.cr.fetchall()
self.period_ids, self.journal_ids = zip(*res)
return super(journal_print, self).set_context(objects, data, ids, report_type=report_type)
def set_last_move_id(self, move_id):
self.last_move_id = move_id
def check_last_move_id(self, move_id):
'''
return True if we need to draw a gray line above this line, used to separate moves
'''
if self.last_move_id:
return not(self.last_move_id == move_id)
return False
def tax_codes(self, period_id, journal_id):
ids_journal_period = self.pool.get('account.journal.period').search(self.cr, self.uid,
[('journal_id', '=', journal_id), ('period_id', '=', period_id)])
self.cr.execute(
'select distinct tax_code_id from account_move_line ' \
'where period_id=%s and journal_id=%s and tax_code_id is not null and state<>\'draft\'',
(period_id, journal_id)
)
ids = map(lambda x: x[0], self.cr.fetchall())
tax_code_ids = []
if ids:
self.cr.execute('select id from account_tax_code where id in %s order by code', (tuple(ids),))
tax_code_ids = map(lambda x: x[0], self.cr.fetchall())
tax_codes = self.pool.get('account.tax.code').browse(self.cr, self.uid, tax_code_ids)
return tax_codes
def _sum_vat(self, period_id, journal_id, tax_code_id):
self.cr.execute('select sum(tax_amount) from account_move_line where ' \
'period_id=%s and journal_id=%s and tax_code_id=%s and state<>\'draft\'',
(period_id, journal_id, tax_code_id))
return self.cr.fetchone()[0] or 0.0
def _sum_debit(self, period_id=False, journal_id=False):
if journal_id and isinstance(journal_id, int):
journal_id = [journal_id]
@ -118,7 +159,7 @@ class journal_print(report_sxw.rml_parse, common_report_header):
if self.target_move == 'posted':
move_state = ['posted']
self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + ', l.move_id',(tuple(move_state), period_id, tuple(journal_id) ))
self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY '+ self.sort_selection + ', l.move_id',(tuple(move_state), period_id, tuple(journal_id) ))
ids = map(lambda x: x[0], self.cr.fetchall())
return obj_mline.browse(self.cr, self.uid, ids)
@ -155,5 +196,6 @@ class journal_print(report_sxw.rml_parse, common_report_header):
return 'Date'
report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print, header='internal')
report_sxw.report_sxw('report.account.journal.period.print.sale.purchase', 'account.journal.period', 'addons/account/report/account_journal_sale_purchase.rml', parser=journal_print, header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -18,10 +18,7 @@
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
@ -119,11 +116,17 @@
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<blockTableStyle id="Table_no_lines">
</blockTableStyle>
<blockTableStyle id="Table_Company_Name">
<blockTableStyle id="Table4NewMove">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
</blockTableStyle>
<blockTableStyle id="Table4Total">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="8,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
@ -173,101 +176,92 @@
<story>
<para style="Table Contents">[[ repeatIn(objects, 'o') ]]</para>
<blockTable colWidths="539.0" style="Table_Company_Name">
<blockTable colWidths="539.0" style="Table_no_lines">
<tr>
<td>
<para style="terp_header_Centre">Journal</para>
</td>
<td><para style="terp_header_Centre">Journal</para></td>
</tr>
</blockTable>
<para style="P9">
<font color="white"> </font>
</para>
<blockTable colWidths="85.0,80.0,80.0,120.0,70.0,100.0" style="Table2">
<tr>
<td><para style="terp_tblheader_General_Centre"> [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">[[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Journal</para></td>
<td><para style="terp_tblheader_General_Centre">Filters By </para></td>
<td><para style="terp_tblheader_General_Centre">Entries Sorted By</para></td>
<td><para style="terp_tblheader_General_Centre">Target Moves</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_account(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[o.journal_id.name ]]</para></td>
<td><para style="terp_default_Centre_8">[[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] </para>
<blockTable colWidths="60.0,60.0" style="Table3">[[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_Details_Centre">Start Date</para></td>
<td><para style="terp_tblheader_Details_Centre">End Date</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ formatLang(get_start_date(data),date=True) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ formatLang(get_end_date(data),date=True) ]]</para></td>
</tr>
</blockTable>
<blockTable colWidths="60.0,60.0" style="Table3">[[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]]
<tr>
<td><para style="terp_tblheader_Details_Centre">Start Period</para></td>
<td><para style="terp_tblheader_Details_Centre">End Period</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_start_period(data) or removeParentNode('para') ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_end_period(data) or removeParentNode('para') ]]</para></td>
</tr>
</blockTable>
</td>
<td><para style="terp_default_Centre_8">[[ get_sortby(data) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_target_move(data) ]] </para></td>
</tr>
</blockTable>
<para style="P9">
<font color="white"> </font>
</para>
<para style="P9">
<font color="white"> </font>
</para>
<blockTable rowHeights="0.55cm" colWidths="45.0,55.0,55.0,50.0,80.0,120.0,70.0,70.0" style="Table1" repeatRows="1">[[ display_currency(data) == False or removeParentNode('blockTable') ]]
<blockTable colWidths="85.0,80.0,80.0,120.0,70.0,100.0" style="Table2">
<tr>
<td><para style="P10a">Date</para></td>
<td><para style="P10a">Ref</para></td>
<td><para style="P10a">Move</para></td>
<td><para style="P10a">Account</para></td>
<td><para style="P10a">Partner</para></td>
<td><para style="P10a">Label</para></td>
<td><para style="P10b">Debit</para></td>
<td><para style="P10b">Credit</para></td>
<td><para style="terp_tblheader_General_Centre"> [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">[[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Journal</para></td>
<td><para style="terp_tblheader_General_Centre">Period</para></td>
<td><para style="terp_tblheader_General_Centre">Entries Sorted By</para></td>
<td><para style="terp_tblheader_General_Centre">Target Moves</para></td>
</tr>
<tr>
<td><para style="P11">[[o.period_id.name ]]</para></td>
<td><para style="P11">[[ o.journal_id.code ]]</para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P12">[[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<td><para style="P12">[[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
</tr>
<para style="Standard"><font color="white">[[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]]</font></para>
<tr>
<td><para style="terp_default_8">[[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]]</para><para style="terp_default_8">[[ formatLang(line.date,date=True) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.ref,20) ]]</para></td>
<td><para style="terp_default_8">[[ line.move_id.name &lt;&gt; '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]]</para></td>
<td><para style="terp_default_8">[[ line.account_id.code ]]</para></td>
<td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,17) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.name,27) ]]</para></td>
<td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_account(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ o.journal_id.name ]]</para></td>
<td><para style="terp_default_Centre_8">[[ o.period_id.name ]] </para></td>
<td><para style="terp_default_Centre_8">[[ get_sortby(data) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_target_move(data) ]] </para></td>
</tr>
</blockTable>
<para style="P9">
<font color="white"> </font>
</para>
<para style="P9">
<font color="white"> </font>
</para>
<para style="Standard"><font color="white">[[ set_last_move_id(False)]]</font></para>
<section>
[[ display_currency(data) == False or removeParentNode('section') ]]
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,95.0,160.0,70.0,70.0" style="Table1">
<tr>
<td><para style="P10a">Move</para></td>
<td><para style="P10a">Date</para></td>
<td><para style="P10a">Account</para></td>
<td><para style="P10a">Partner</para></td>
<td><para style="P10a">Label</para></td>
<td><para style="P10b">Debit</para></td>
<td><para style="P10b">Credit</para></td>
</tr>
</blockTable>
<section>
<para style="terp_default_8">[[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]]</para>
<blockTable colWidths="545.0" style="Table4NewMove">
<tr>
<td><para style="P8">[[ not check_last_move_id(line.move_id.id) and removeParentNode('blockTable') ]]</para></td>
</tr>
</blockTable>
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,95.0,160.0,70.0,70.0" style="Table_no_lines">
<tr>
<td><para style="terp_default_8">[[ line.move_id.name &lt;&gt; '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]]</para></td>
<td><para style="terp_default_8">[[ formatLang(line.date,date=True) ]]</para></td>
<td><para style="terp_default_8">[[ line.account_id.code ]]</para></td>
<td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,23) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.name,35) ]]</para></td>
<td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td>
</tr>
</blockTable>
<para style="terp_default_8">[[ set_last_move_id(line.move_id.id) ]]</para>
</section>
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,95.0,160.0,70.0,70.0" style="Table4Total">
<tr>
<td><para style="P11"></para></td>
<td><para style="P11"></para></td>
<td><para style="P11"></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P12">Total:</para></td>
<td><para style="P12">[[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<td><para style="P12">[[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
</tr>
</blockTable>
</section>
<blockTable rowHeights="0.55cm" colWidths="45.0,50.0,52.0,50.0,70.0,80.0,70.0,70.0,70.0" style="Table1" repeatRows="1">[[ display_currency(data) or removeParentNode('blockTable') ]]
<section>
[[ display_currency(data) or removeParentNode('section') ]]
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,70.0,130.0,70.0,70.0,70.0" style="Table1">
<tr>
<td><para style="P10a">Date</para></td>
<td><para style="P10a">Ref</para></td>
<td><para style="P10a">Move</para></td>
<td><para style="P10a">Date</para></td>
<td><para style="P10a">Account</para></td>
<td><para style="P10a">Partner</para></td>
<td><para style="P10a">Label</para></td>
@ -275,30 +269,41 @@
<td><para style="P10b">Credit</para></td>
<td><para style="P10b">Currency</para></td>
</tr>
<tr>
<td><para style="P11">[[o.period_id.name ]]</para></td>
<td><para style="P11">[[ o.journal_id.code ]]</para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P12">[[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<td><para style="P12">[[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<!-- given a period and a journal, the sum of debit will always be equal to the sum of credit, so there is no point to display it-->
<td><para style="P12"> <!--o.journal_id.currency and formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ o.journal_id.currency and o.journal_id.currency.symbol --></para></td>
</tr>
<para style="Standard"><font color="white">[[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]]</font></para>
<tr>
<td><para style="terp_default_8">[[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]]</para><para style="terp_default_8">[[ formatLang(line.date,date=True) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.ref,20) ]]</para></td>
<td><para style="terp_default_8">[[ line.move_id.name &lt;&gt; '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]]</para></td>
<td><para style="terp_default_8">[[ line.account_id.code ]]</para></td>
<td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,15) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.name,17) ]]</para></td>
<td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or '' ]]</para></td>
</tr>
</blockTable>
</blockTable>
<section>
<para style="terp_default_8">[[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]]</para>
<blockTable colWidths="545.0" style="Table4NewMove">
<tr>
<td><para style="P8">[[ not check_last_move_id(line.move_id.id) and removeParentNode('blockTable') ]]</para></td>
</tr>
</blockTable>
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,70.0,130.0,70.0,70.0,70.0" style="Table_no_lines">
<tr>
<td><para style="terp_default_8">[[ line.move_id.name &lt;&gt; '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]]</para></td>
<td><para style="terp_default_8">[[ formatLang(line.date,date=True) ]]</para></td>
<td><para style="terp_default_8">[[ line.account_id.code ]]</para></td>
<td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,17) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.name,28) ]]</para></td>
<td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or '' ]]</para></td>
</tr>
</blockTable>
<para style="terp_default_8">[[ set_last_move_id(line.move_id.id) ]]</para>
</section>
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,70.0,130.0,70.0,70.0,70.0" style="Table4Total">
<tr>
<td><para style="P11"></para></td>
<td><para style="P11"></para></td>
<td><para style="P11"></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P12">Total:</para></td>
<td><para style="P12">[[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<td><para style="P12">[[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<!-- given a period and a journal, the sum of debit will always be equal to the sum of credit, so there is no point to display it-->
<td><para style="P12"> <!--o.journal_id.currency and formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ o.journal_id.currency and o.journal_id.currency.symbol --></para></td>
</tr>
</blockTable>
</section>
</story>
</document>

View File

@ -0,0 +1,346 @@
<?xml version="1.0"?>
<document filename="Journal.pdf">
<template title="Journal" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Table_Print_Current_datetime">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
</blockTableStyle>
<blockTableStyle id="Table_Sub_Header_Content">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_Subheader_Content_detail">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="7,0" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="7,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_no_lines">
</blockTableStyle>
<blockTableStyle id="Table4NewMove">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
</blockTableStyle>
<blockTableStyle id="Table4Total">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="12,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P8" fontName="Helvetica" fontSize="7.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P9" fontName="Helvetica" fontSize="7.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10" fontName="Helvetica-Bold" fontSize="8.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10a" fontName="Helvetica-Bold" fontSize="7.5" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P10b" fontName="Helvetica-Bold" fontSize="8.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11" fontName="Helvetica-Bold" fontSize="8.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P11a" fontName="Helvetica-Bold" fontSize="8.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P12" fontName="Helvetica-Bold" fontSize="7.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="7.0" leading="10" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="7.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="7.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="7.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="7.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="7.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="7.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="7.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="7.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="7.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="7.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_left" fontName="Helvetica-Bold" fontSize="7.0" leading="8" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
</stylesheet>
<images/>
<story>
<para style="Table Contents">[[ repeatIn(objects, 'o') ]]</para>
<blockTable colWidths="539.0" style="Table_no_lines">
<tr>
<td><para style="terp_header_Centre">Journal</para></td>
</tr>
</blockTable>
<para style="P9">
<font color="white"> </font>
</para>
<blockTable colWidths="85.0,80.0,80.0,120.0,70.0,100.0" style="Table2">
<tr>
<td><para style="terp_tblheader_General_Centre"> [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]]</para>
<para style="terp_tblheader_General_Centre">[[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]]</para></td>
<td><para style="terp_tblheader_General_Centre">Fiscal Year</para></td>
<td><para style="terp_tblheader_General_Centre">Journal</para></td>
<td><para style="terp_tblheader_General_Centre">Period</para></td>
<td><para style="terp_tblheader_General_Centre">Entries Sorted By</para></td>
<td><para style="terp_tblheader_General_Centre">Target Moves</para></td>
</tr>
<tr>
<td><para style="terp_default_Centre_8">[[ get_account(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_fiscalyear(data) or '' ]]</para></td>
<td><para style="terp_default_Centre_8">[[ o.journal_id.name ]]</para></td>
<td><para style="terp_default_Centre_8">[[ o.period_id.name ]] </para></td>
<td><para style="terp_default_Centre_8">[[ get_sortby(data) ]]</para></td>
<td><para style="terp_default_Centre_8">[[ get_target_move(data) ]] </para></td>
</tr>
</blockTable>
<para style="P9">
<font color="white"> </font>
</para>
<para style="P9">
<font color="white"> </font>
</para>
<para style="Standard"><font color="white">[[ set_last_move_id(False) ]]</font></para>
<section>
[[ display_currency(data) == False or removeParentNode('section') ]]
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,60.0,110.0,15.0,70.0,70.0,70.0" style="Table1">
<tr>
<td><para style="P10a">Move</para></td>
<td><para style="P10a">Date</para></td>
<td><para style="P10a">Account</para></td>
<td><para style="P10a">Partner</para></td>
<td><para style="P10a">Label</para></td>
<td><para style="P10a">VAT</para></td>
<td><para style="P11"></para></td>
<td><para style="P10b">Debit</para></td>
<td><para style="P10b">Credit</para></td>
</tr>
</blockTable>
<section>
<para style="terp_default_8">[[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]]</para>
<blockTable colWidths="545.0" style="Table4NewMove">
<tr>
<td><para style="P8">[[ not check_last_move_id(line.move_id.id) and removeParentNode('blockTable') ]]</para></td>
</tr>
</blockTable>
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,60.0,110.0,15.0,70.0,70.0,70.0" style="Table_no_lines">
<tr>
<td><para style="terp_default_8">[[ line.move_id.name &lt;&gt; '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]]</para></td>
<td><para style="terp_default_8">[[ formatLang(line.date,date=True) ]]</para></td>
<td><para style="terp_default_8">[[ line.account_id.code ]]</para></td>
<td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,15) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.name,25) ]]</para></td>
<td><para style="P8">[[ line.tax_code_id and (line.tax_code_id.code + ':') ]]</para></td>
<td><para style="terp_default_8">[[ line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td>
</tr>
</blockTable>
<para style="terp_default_8">[[ set_last_move_id(line.move_id.id) ]]</para>
</section>
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,60.0,110.0,15.0,70.0,70.0,70.0" style="Table4Total">
<tr>
<td><para style="P11"></para></td>
<td><para style="P11"></para></td>
<td><para style="P11"></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P12">Total:</para></td>
<td><para style="P12">[[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<td><para style="P12">[[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
</tr>
</blockTable>
</section>
<section>
[[ display_currency(data) or removeParentNode('section') ]]
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,50.0,70.0,10.0,70.0,70.0,70.0,70.0" style="Table1">
<tr>
<td><para style="P10a">Move</para></td>
<td><para style="P10a">Date</para></td>
<td><para style="P10a">Account</para></td>
<td><para style="P10a">Partner</para></td>
<td><para style="P10a">Label</para></td>
<td><para style="P10a">VAT</para></td>
<td><para style="P11"></para></td>
<td><para style="P10b">Debit</para></td>
<td><para style="P10b">Credit</para></td>
<td><para style="P10b">Currency</para></td>
</tr>
</blockTable>
<section>
<para style="terp_default_8">[[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]]</para>
<blockTable colWidths="545.0" style="Table4NewMove">
<tr>
<td><para style="P8">[[ not check_last_move_id(line.move_id.id) and removeParentNode('blockTable') ]]</para></td>
</tr>
</blockTable>
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,50.0,70.0,10.0,70.0,70.0,70.0,70.0" style="Table_no_lines">
<tr>
<td><para style="terp_default_8">[[ line.move_id.name &lt;&gt; '/' and line.move_id.name or ('*'+str(line.move_id.id)) ]]</para></td>
<td><para style="terp_default_8">[[ formatLang(line.date,date=True) ]]</para></td>
<td><para style="terp_default_8">[[ line.account_id.code ]]</para></td>
<td><para style="terp_default_8">[[ line.partner_id and strip_name(line.partner_id.name,12) ]]</para></td>
<td><para style="terp_default_8">[[ strip_name(line.name,16) ]]</para></td>
<td><para style="terp_default_8">[[ line.tax_code_id and (line.tax_code_id.code + ':') ]]</para></td>
<td><para style="P8">[[ line.tax_amount and formatLang(line.tax_amount, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.debit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ formatLang(line.credit, currency_obj=company.currency_id) ]]</para></td>
<td><para style="P8">[[ line.currency_id and formatLang(line.amount_currency, currency_obj=line.currency_id) or '' ]]</para></td>
</tr>
</blockTable>
<para style="terp_default_8">[[ set_last_move_id(line.move_id.id) ]]</para>
</section>
<blockTable rowHeights="0.55cm" colWidths="55.0,45.0,50.0,50.0,70.0,10.0,70.0,70.0,70.0,70.0" style="Table4Total">
<tr>
<td><para style="P11"></para></td>
<td><para style="P11"></para></td>
<td><para style="P11"></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P11"><font color="white"></font></para></td>
<td><para style="P12">Total:</para></td>
<td><para style="P12">[[ formatLang(sum_debit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<td><para style="P12">[[ formatLang(sum_credit(o.period_id.id, o.journal_id.id), currency_obj=company.currency_id) ]]</para></td>
<!-- given a period and a journal, the sum of debit will always be equal to the sum of credit, so there is no point to display it-->
<td><para style="P12"> <!--o.journal_id.currency and formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ o.journal_id.currency and o.journal_id.currency.symbol --></para></td>
</tr>
</blockTable>
</section>
<para style="P9">
<font color="white"> </font>
</para>
<para style="P9">
<font color="white"> </font>
</para>
<section>
<para alignment="LEFT">
</para>
<blockTable colWidths="15.0,80.0,20.0,182.0" style="Table1" repeatRows="1">
<tr>
<td><para style="P12"></para></td>
<td><para style="P12">VAT Declaration</para></td>
<td><para style="P12"></para></td>
<td><para style="P12"></para></td>
</tr>
<tr>
<td><para style="terp_default_8">[[ repeatIn(tax_codes(o.period_id.id,o.journal_id.id), 't') ]][[ t.code + ': ' ]]</para></td>
<td><para style="P8">[[ formatLang(sum_vat( o.period_id.id, o.journal_id.id, t.id)) ]]</para></td>
<td><para style="P11"><font color="white"> </font></para></td>
<td><para style="terp_default_8">[[ t.name ]]</para></td>
</tr>
</blockTable>
</section>
</story>
</document>

View File

@ -32,6 +32,7 @@ class tax_report(report_sxw.rml_parse, common_report_header):
res = {}
self.period_ids = []
period_obj = self.pool.get('account.period')
self.display_detail = data['form']['display_detail']
res['periods'] = ''
res['fiscalyear'] = data['form'].get('fiscalyear_id', False)
@ -104,6 +105,8 @@ class tax_report(report_sxw.rml_parse, common_report_header):
return top_result
def _get_general(self, tax_code_id, period_list, company_id, based_on, context=None):
if not self.display_detail:
return []
res = []
obj_account = self.pool.get('account.account')
periods_ids = tuple(period_list)
@ -159,7 +162,7 @@ class tax_report(report_sxw.rml_parse, common_report_header):
def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=[], context=None):
obj_tc = self.pool.get('account.tax.code')
ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], context=context)
ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], order='sequence', context=context)
res = []
for code in obj_tc.browse(self.cr, self.uid, ids, {'based_on': based_on}):
@ -229,4 +232,4 @@ class tax_report(report_sxw.rml_parse, common_report_header):
report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code',
'addons/account/report/account_tax_report.rml', parser=tax_report, header="internal")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -102,7 +102,7 @@
journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
ctx={}
ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
data_dict = {'chart_account_id':ref('account.chart0')}
data_dict = {'chart_account_id':ref('account.chart0'), 'period_from':ref('period_1'), 'period_to':ref('period_12')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account')
-

View File

@ -35,8 +35,6 @@ class account_automatic_reconcile(osv.osv_memory):
'period_id': fields.many2one('account.period', 'Period'),
'max_amount': fields.float('Maximum write-off amount'),
'power': fields.selection([(p, str(p)) for p in range(2, 5)], 'Power', required=True, help='Number of partial amounts that can be combined to find a balance point can be chosen as the power of the automatic reconciliation'),
'date1': fields.date('Starting Date', required=True),
'date2': fields.date('Ending Date', required=True),
'reconciled': fields.integer('Reconciled transactions', readonly=True),
'unreconciled': fields.integer('Not reconciled transactions', readonly=True),
'allow_write_off': fields.boolean('Allow write off')
@ -53,8 +51,6 @@ class account_automatic_reconcile(osv.osv_memory):
return context.get('unreconciled', 0)
_defaults = {
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d'),
'reconciled': _get_reconciled,
'unreconciled': _get_unreconciled,
'power': 2

View File

@ -13,8 +13,6 @@
<newline/>
<group>
<field name="account_ids" colspan="4" domain="[('reconcile','=',1)]"/>
<field name="date1"/>
<field name="date2"/>
<field name="power"/>
<field name="allow_write_off"/>
</group>

View File

@ -36,6 +36,7 @@ class accounting_report(osv.osv_memory):
'period_to_cmp': fields.many2one('account.period', 'End Period'),
'date_from_cmp': fields.date("Start Date"),
'date_to_cmp': fields.date("End Date"),
'debit_credit': fields.boolean('Display Debit/Credit Columns', help="This option allow you to get more details about your the way your balances are computed. Because it is space consumming, we do not allow to use it while doing a comparison"),
}
def _get_account_report(self, cr, uid, context=None):
@ -85,7 +86,7 @@ class accounting_report(osv.osv_memory):
return res
def _print_report(self, cr, uid, ids, data, context=None):
data['form'].update(self.read(cr, uid, ids, ['date_from_cmp', 'date_to_cmp', 'fiscalyear_id_cmp', 'period_from_cmp', 'period_to_cmp', 'filter_cmp', 'account_report_id', 'enable_filter', 'label_filter'], context=context)[0])
data['form'].update(self.read(cr, uid, ids, ['date_from_cmp', 'debit_credit', 'date_to_cmp', 'fiscalyear_id_cmp', 'period_from_cmp', 'period_to_cmp', 'filter_cmp', 'account_report_id', 'enable_filter', 'label_filter'], context=context)[0])
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.financial.report',

View File

@ -11,6 +11,7 @@
<xpath expr="//field[@name='target_move']" position="after">
<field name="account_report_id" domain="[('parent_id','=',False)]"/>
<field name="enable_filter"/>
<field name="debit_credit" attrs="{'invisible': [('enable_filter','=',True)]}"/>
</xpath>
<xpath expr="//notebook/page[@string='Filters']" position="after">
<page string="Comparison" attrs="{'invisible': [('enable_filter','=',False)]}">
@ -33,7 +34,7 @@
<menuitem parent="account.menu_finance_legal_statement" id="final_accounting_reports" name="Accounting Reports"/>
<record id="action_account_report_bs" model="ir.actions.act_window">
<field name="name">Financial Reports</field>
<field name="name">Balance Sheet</field>
<field name="res_model">accounting.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -45,7 +46,7 @@
<menuitem icon="STOCK_PRINT" name="Balance Sheet" action="action_account_report_bs" id="menu_account_report_bs" parent="final_accounting_reports"/>
<record id="action_account_report_pl" model="ir.actions.act_window">
<field name="name">Financial Reports</field>
<field name="name">Profit and Loss</field>
<field name="res_model">accounting.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>

View File

@ -49,6 +49,21 @@ class account_fiscalyear_close(osv.osv_memory):
@param ids: List of Account fiscalyear close states IDs
"""
def _reconcile_fy_closing(cr, uid, ids, context=None):
"""
This private function manually do the reconciliation on the account_move_line given as `ids´, and directly
through psql. It's necessary to do it this way because the usual `reconcile()´ function on account.move.line
object is really resource greedy (not supposed to work on reconciliation between thousands of records) and
it does a lot of different computation that are useless in this particular case.
"""
#check that the reconcilation concern journal entries from only one company
cr.execute('select distinct(company_id) from account_move_line where id in %s',(tuple(ids),))
if len(cr.fetchall()) > 1:
raise osv.except_osv(_('Warning !'), _('The entries to reconcile should belong to the same company'))
r_id = self.pool.get('account.move.reconcile').create(cr, uid, {'type': 'auto'})
cr.execute('update account_move_line set reconcile_id = %s where id in %s',(r_id, tuple(ids),))
return r_id
obj_acc_period = self.pool.get('account.period')
obj_acc_fiscalyear = self.pool.get('account.fiscalyear')
obj_acc_journal = self.pool.get('account.journal')
@ -78,6 +93,7 @@ class account_fiscalyear_close(osv.osv_memory):
new_journal = data[0].journal_id.id
new_journal = obj_acc_journal.browse(cr, uid, new_journal, context=context)
company_id = new_journal.company_id.id
if not new_journal.default_credit_account_id or not new_journal.default_debit_account_id:
raise osv.except_osv(_('UserError'),
@ -105,6 +121,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)
@ -116,9 +133,9 @@ class account_fiscalyear_close(osv.osv_memory):
LEFT JOIN account_account_type t ON (a.user_type = t.id)
WHERE a.active
AND a.type != 'view'
AND t.close_method = %s''', ('unreconciled', ))
AND a.company_id = %s
AND t.close_method = %s''', (company_id, 'unreconciled', ))
account_ids = map(lambda x: x[0], cr.fetchall())
if account_ids:
cr.execute('''
INSERT INTO account_move_line (
@ -130,11 +147,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 +166,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 +174,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('''
@ -166,7 +183,8 @@ class account_fiscalyear_close(osv.osv_memory):
LEFT JOIN account_account_type t ON (a.user_type = t.id)
WHERE a.active
AND a.type != 'view'
AND t.close_method = %s''', ('detail', ))
AND a.company_id = %s
AND t.close_method = %s''', (company_id, 'detail', ))
account_ids = map(lambda x: x[0], cr.fetchall())
if account_ids:
@ -180,11 +198,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'
@ -194,7 +212,8 @@ class account_fiscalyear_close(osv.osv_memory):
LEFT JOIN account_account_type t ON (a.user_type = t.id)
WHERE a.active
AND a.type != 'view'
AND t.close_method = %s''', ('balance', ))
AND a.company_id = %s
AND t.close_method = %s''', (company_id, 'balance', ))
account_ids = map(lambda x: x[0], cr.fetchall())
query_1st_part = """
@ -239,9 +258,8 @@ class account_fiscalyear_close(osv.osv_memory):
#reconcile all the move.line of the opening move
ids = obj_acc_move_line.search(cr, uid, [('journal_id', '=', new_journal.id),
('period_id.fiscalyear_id','=',new_fyear.id)])
context['fy_closing'] = True
if ids:
reconcile_id = obj_acc_move_line.reconcile(cr, uid, ids, context=context)
reconcile_id = _reconcile_fy_closing(cr, uid, ids, context=context)
#set the creation date of the reconcilation at the first day of the new fiscalyear, in order to have good figures in the aged trial balance
self.pool.get('account.move.reconcile').write(cr, uid, [reconcile_id], {'create_date': new_fyear.date_start}, context=context)

Some files were not shown because too many files have changed in this diff Show More