[MERGE] from trunk

bzr revid: rco@openerp.com-20120209092258-34b70pu6547la8hq
This commit is contained in:
Raphael Collet 2012-02-09 10:22:58 +01:00
commit cb24ebd4b1
5492 changed files with 662486 additions and 326911 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():
@ -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
@ -1330,16 +1333,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):
@ -1771,6 +1776,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):
@ -2524,7 +2530,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 +2547,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 +2565,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 +3002,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 +3360,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

@ -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
@ -169,30 +170,31 @@ class account_bank_statement(osv.osv):
'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)

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

@ -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']"):
@ -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

View File

@ -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

@ -1064,6 +1064,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

@ -594,7 +594,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 +655,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"/>
@ -2620,7 +2621,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 +2694,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 +2786,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,11 +10,13 @@
<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>
@ -25,6 +27,7 @@
<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

12038
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

@ -58,18 +58,25 @@ 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']['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,7 +84,7 @@ 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 not currency_obj.is_zero(self.cr, self.uid, account.company_id.currency_id, vals['balance']):

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"/>
</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>
@ -231,9 +219,11 @@
[[ 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' 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 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">
@ -256,11 +246,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' 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 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' 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 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

@ -105,6 +105,7 @@ class account_fiscalyear_close(osv.osv_memory):
'name': '/',
'ref': '',
'period_id': period.id,
'date': period.date_start,
'journal_id': new_journal.id,
}
move_id = obj_acc_move.create(cr, uid, vals, context=context)
@ -118,7 +119,6 @@ class account_fiscalyear_close(osv.osv_memory):
AND a.type != 'view'
AND t.close_method = %s''', ('unreconciled', ))
account_ids = map(lambda x: x[0], cr.fetchall())
if account_ids:
cr.execute('''
INSERT INTO account_move_line (
@ -130,11 +130,11 @@ class account_fiscalyear_close(osv.osv_memory):
(SELECT name, create_uid, create_date, write_uid, write_date,
statement_id, %s,currency_id, date_maturity, partner_id,
blocked, credit, 'draft', debit, ref, account_id,
%s, date, %s, amount_currency, quantity, product_id, company_id
%s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id
FROM account_move_line
WHERE account_id IN %s
AND ''' + query_line + '''
AND reconcile_id IS NULL)''', (new_journal.id, period.id, move_id, tuple(account_ids),))
AND reconcile_id IS NULL)''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
#We have also to consider all move_lines that were reconciled
#on another fiscal year, and report them too
@ -149,7 +149,7 @@ class account_fiscalyear_close(osv.osv_memory):
b.name, b.create_uid, b.create_date, b.write_uid, b.write_date,
b.statement_id, %s, b.currency_id, b.date_maturity,
b.partner_id, b.blocked, b.credit, 'draft', b.debit,
b.ref, b.account_id, %s, b.date, %s, b.amount_currency,
b.ref, b.account_id, %s, (%s) AS date, %s, b.amount_currency,
b.quantity, b.product_id, b.company_id
FROM account_move_line b
WHERE b.account_id IN %s
@ -157,7 +157,7 @@ class account_fiscalyear_close(osv.osv_memory):
AND b.period_id IN ('''+fy_period_set+''')
AND b.reconcile_id IN (SELECT DISTINCT(reconcile_id)
FROM account_move_line a
WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, move_id, tuple(account_ids),))
WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
#2. report of the accounts with defferal method == 'detail'
cr.execute('''
@ -180,11 +180,11 @@ class account_fiscalyear_close(osv.osv_memory):
(SELECT name, create_uid, create_date, write_uid, write_date,
statement_id, %s,currency_id, date_maturity, partner_id,
blocked, credit, 'draft', debit, ref, account_id,
%s, date, %s, amount_currency, quantity, product_id, company_id
%s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id
FROM account_move_line
WHERE account_id IN %s
AND ''' + query_line + ''')
''', (new_journal.id, period.id, move_id, tuple(account_ids),))
''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),))
#3. report of the accounts with defferal method == 'balance'

View File

@ -29,8 +29,14 @@ class account_common_report(osv.osv_memory):
_name = "account.common.report"
_description = "Account Common Report"
def onchange_chart_id(self, cr, uid, ids, chart_account_id=False, context=None):
if chart_account_id:
company_id = self.pool.get('account.account').browse(cr, uid, chart_account_id, context=context).company_id.id
return {'value': {'company_id': company_id}}
_columns = {
'chart_account_id': fields.many2one('account.account', 'Chart of Account', help='Select Charts of Accounts', required=True, domain = [('parent_id','=',False)]),
'company_id': fields.related('chart_account_id', 'company_id', type='many2one', relation='res.company', string='Company', readonly=True),
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', help='Keep empty for all open fiscal year'),
'filter': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods')], "Filter by", required=True),
'period_from': fields.many2one('account.period', 'Start Period'),
@ -44,6 +50,22 @@ class account_common_report(osv.osv_memory):
}
def _check_company_id(self, cr, uid, ids, context=None):
for wiz in self.browse(cr, uid, ids, context=context):
company_id = wiz.company_id.id
if wiz.fiscalyear_id and company_id != wiz.fiscalyear_id.company_id.id:
return False
if wiz.period_from and company_id != wiz.period_from.company_id.id:
return False
if wiz.period_to and company_id != wiz.period_to.company_id.id:
return False
return True
_constraints = [
(_check_company_id, 'The fiscalyear, periods or chart of account chosen have to belong to the same company.', ['chart_account_id','fiscalyear_id','period_from','period_to']),
]
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(account_common_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
if context.get('active_model', False) == 'account.account' and view_id:

View File

@ -29,13 +29,16 @@ class account_common_journal_report(osv.osv_memory):
'amount_currency': fields.boolean("With Currency", help="Print Report with the currency column if the currency is different then the company currency"),
}
def _build_context(self, cr, uid, ids, data, context=None):
def _build_contexts(self, cr, uid, ids, data, context=None):
if context is None:
context = {}
result = super(account_common_journal_report, self)._build_context(cr, uid, ids, data, context=context)
result = super(account_common_journal_report, self)._build_contexts(cr, uid, ids, data, context=context)
if data['form']['filter'] == 'filter_date':
cr.execute('SELECT period_id FROM account_move_line WHERE date >= %s AND date <= %s', (data['form']['date_from'], data['form']['date_to']))
result['periods'] = map(lambda x: x[0], cr.fetchall())
elif data['form']['filter'] == 'filter_period':
result['periods'] = self.pool.get('account.period').build_ctx_periods(cr, uid, data['form']['period_from'], data['form']['period_to'])
return result
def pre_print_report(self, cr, uid, ids, data, context=None):

View File

@ -10,8 +10,9 @@
<form string="Report Options">
<label nolabel="1" string=""/>
<newline/>
<field name="chart_account_id" widget='selection'/>
<field name="fiscalyear_id"/>
<field name="chart_account_id" widget='selection' on_change="onchange_chart_id(chart_account_id, context)"/>
<field name="company_id" invisible="1"/>
<field name="fiscalyear_id" domain="[('company_id','=',company_id)]"/>
<field name="target_move"/>
<notebook tabpos="up" colspan="4">
<page string="Filters" name="filters">
@ -20,7 +21,7 @@
<field name="date_from" attrs="{'readonly':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}" colspan="4"/>
<field name="date_to" attrs="{'readonly':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}" colspan="4"/>
<separator string="Periods" colspan="4"/>
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" colspan="4"/>
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" colspan="4"/>
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" colspan="4"/>
</page>
<page string="Journals" name="journal_ids">

View File

@ -20,6 +20,7 @@
##############################################################################
from osv import osv, fields
from lxml import etree
class account_print_journal(osv.osv_memory):
_inherit = "account.common.journal.report"
@ -27,21 +28,49 @@ class account_print_journal(osv.osv_memory):
_description = 'Account Print Journal'
_columns = {
'sort_selection': fields.selection([('date', 'Date'),
('ref', 'Reference Number'),],
'sort_selection': fields.selection([('l.date', 'Date'),
('am.name', 'Journal Entry Number'),],
'Entries Sorted by', required=True),
'journal_ids': fields.many2many('account.journal', 'account_print_journal_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
}
_defaults = {
'sort_selection': 'date',
'sort_selection': 'am.name',
'filter': 'filter_period',
'journal_ids': False,
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
'''
used to set the domain on 'journal_ids' field: we exclude or only propose the journals of type
sale/purchase (+refund) accordingly to the presence of the key 'sale_purchase_only' in the context.
'''
if context is None:
context = {}
res = super(account_print_journal, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
doc = etree.XML(res['arch'])
if context.get('sale_purchase_only'):
domain ="[('type', 'in', ('sale','purchase','sale_refund','purchase_refund'))]"
else:
domain ="[('type', 'not in', ('sale','purchase','sale_refund','purchase_refund'))]"
nodes = doc.xpath("//field[@name='journal_ids']")
for node in nodes:
node.set('domain', domain)
res['arch'] = etree.tostring(doc)
return res
def _print_report(self, cr, uid, ids, data, context=None):
if context is None:
context = {}
data = self.pre_print_report(cr, uid, ids, data, context=context)
data['form'].update(self.read(cr, uid, ids, ['sort_selection'], context=context)[0])
return {'type': 'ir.actions.report.xml', 'report_name': 'account.journal.period.print', 'datas': data}
if context.get('sale_purchase_only'):
report_name = 'account.journal.period.print.sale.purchase'
else:
report_name = 'account.journal.period.print'
return {'type': 'ir.actions.report.xml', 'report_name': report_name, 'datas': data}
account_print_journal()

View File

@ -17,6 +17,16 @@
<field name="sort_selection"/>
<field name="amount_currency"/>
<newline/>
<field name="filter" on_change="onchange_filter(filter, fiscalyear_id)" colspan="4" invisible="1"/>
<separator string="Periods" colspan="4"/>
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" required="1" colspan="4"/>
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" required="1" colspan="4"/>
<separator string="Journals" colspan="4"/>
<field name="journal_ids" colspan="4" nolabel="1"/>
</xpath>
<xpath expr="//page[@name='filters']" position="replace">
</xpath>
<xpath expr="//page[@name='journal_ids']" position="replace">
</xpath>
</data>
</field>
@ -31,7 +41,6 @@
<field name="target">new</field>
<field name="view_id" ref="account_report_print_journal"/>
</record>
<menuitem
name="Journals"
parent="account.menu_journals_report"
@ -39,5 +48,24 @@
id="menu_account_print_journal"
icon="STOCK_PRINT"/>
<record id="action_account_print_sale_purchase_journal" model="ir.actions.act_window">
<field name="name">Print Sale/Purchase Journal</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.print.journal</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="context">{'sale_purchase_only':True}</field>
<field name="view_id" ref="account_report_print_journal"/>
</record>
<menuitem
name="Sale/Purchase Journals"
parent="account.menu_journals_report"
action="action_account_print_sale_purchase_journal"
id="menu_account_print_sale_purchase_journal"
icon="STOCK_PRINT"
sequence="1"/>
</data>
</openerp>

View File

@ -30,6 +30,7 @@ class account_vat_declaration(osv.osv_memory):
('payments', 'Payments'),],
'Based on', required=True),
'chart_tax_id': fields.many2one('account.tax.code', 'Chart of Tax', help='Select Charts of Taxes', required=True, domain = [('parent_id','=', False)]),
'display_detail': fields.boolean('Display Detail'),
}
def _get_tax(self, cr, uid, context=None):

View File

@ -13,10 +13,11 @@
<newline/>
<field name="chart_tax_id" widget='selection'/>
<field name="fiscalyear_id"/>
<field name="display_detail"/>
<!--- <field name="based_on"/>--> <!-- the option based_on 'payment' is probably not fully compliant with what the users understand with that term. So, currently, it's seems better to remove it from the view to avoid further problems -->
<separator string="Periods" colspan="4"/>
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" />
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]" attrs="{'readonly':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}" />
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]"/>
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel" string="Cancel" />
<button name="create_vat" string="Print Tax Statement" colspan="1" type="object" icon="gtk-ok"/>

View File

@ -45,7 +45,7 @@ user rights to Demo user.
'demo_xml': ['account_accountant_demo.xml'],
'test': [],
'installable': True,
'active': False,
'auto_install': False,
'application': True,
'certificate': '00395091383933390541',
}

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