[REF] account

bzr revid: vth@tinyerp.com-20101008124922-h3rxefxmldl4300l
This commit is contained in:
vth 2010-10-08 18:19:22 +05:30
parent b2b4a5e6fc
commit b845e6557e
12 changed files with 152 additions and 151 deletions

View File

@ -343,7 +343,7 @@ class account_account(osv.osv):
accounts = self.browse(cr, uid, ids) accounts = self.browse(cr, uid, ids)
for account in accounts: for account in accounts:
level = 0 level = 0
if account.parent_id : if account.parent_id:
obj = self.browse(cr, uid, account.parent_id.id) obj = self.browse(cr, uid, account.parent_id.id)
level = obj.level + 1 level = obj.level + 1
res[account.id] = level res[account.id] = level
@ -463,7 +463,7 @@ class account_account(osv.osv):
return self.name_get(cr, user, ids, context=context) return self.name_get(cr, user, ids, context=context)
def name_get(self, cr, uid, ids, context=None): def name_get(self, cr, uid, ids, context=None):
if not len(ids): if not ids:
return [] return []
reads = self.read(cr, uid, ids, ['name', 'code'], context=context) reads = self.read(cr, uid, ids, ['name', 'code'], context=context)
res = [] res = []
@ -661,13 +661,13 @@ class account_journal(osv.osv):
def create(self, cr, uid, vals, context=None): def create(self, cr, uid, vals, context=None):
if not 'sequence_id' in vals or not vals['sequence_id']: if not 'sequence_id' in vals or not vals['sequence_id']:
vals.update({'sequence_id' : self.create_sequence(cr, uid, vals, context)}) vals.update({'sequence_id': self.create_sequence(cr, uid, vals, context)})
return super(account_journal, self).create(cr, uid, vals, context) return super(account_journal, self).create(cr, uid, vals, context)
def name_get(self, cr, user, ids, context=None): def name_get(self, cr, user, ids, context=None):
""" """
Returns a list of tupples containing id, name. Returns a list of tupples containing id, name.
result format : {[(id, name), (id, name), ...]} result format: {[(id, name), (id, name), ...]}
@param cr: A database cursor @param cr: A database cursor
@param user: ID of the user currently logged in @param user: ID of the user currently logged in
@ -1014,7 +1014,7 @@ class account_move(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
""" """
Returns a list of tupples containing id, name, as internally it is called {def name_get} Returns a list of tupples containing id, name, as internally it is called {def name_get}
result format : {[(id, name), (id, name), ...]} result format: {[(id, name), (id, name), ...]}
@param cr: A database cursor @param cr: A database cursor
@param user: ID of the user currently logged in @param user: ID of the user currently logged in
@ -1046,7 +1046,7 @@ class account_move(osv.osv):
def name_get(self, cursor, user, ids, context=None): def name_get(self, cursor, user, ids, context=None):
if isinstance(ids, (int, long)): if isinstance(ids, (int, long)):
ids = [ids] ids = [ids]
if not len(ids): if not ids:
return [] return []
res = [] res = []
data_move = self.pool.get('account.move').browse(cursor,user,ids) data_move = self.pool.get('account.move').browse(cursor,user,ids)
@ -1088,7 +1088,7 @@ class account_move(osv.osv):
if cond[1] in ['=like', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in', 'child_of']: if cond[1] in ['=like', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in', 'child_of']:
continue continue
cr.execute("select move_id from account_move_line group by move_id having sum(debit) %s %%s" % (cond[1]) ,(amount,)) cr.execute("select move_id from account_move_line group by move_id having sum(debit) %s %%s" % (cond[1]),(amount,))
res_ids = set(id[0] for id in cr.fetchall()) res_ids = set(id[0] for id in cr.fetchall())
ids = ids and (ids & res_ids) or res_ids ids = ids and (ids & res_ids) or res_ids
if ids: if ids:
@ -1199,7 +1199,7 @@ class account_move(osv.osv):
for line in self.browse(cr, uid, ids, context): for line in self.browse(cr, uid, ids, context):
if not line.journal_id.update_posted: if not line.journal_id.update_posted:
raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.')) raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.'))
if len(ids): if ids:
cr.execute('UPDATE account_move '\ cr.execute('UPDATE account_move '\
'SET state=%s '\ 'SET state=%s '\
'WHERE id IN %s', ('draft', tuple(ids),)) 'WHERE id IN %s', ('draft', tuple(ids),))
@ -1387,7 +1387,7 @@ class account_move(osv.osv):
# Check whether the move lines are confirmed # Check whether the move lines are confirmed
if not len(line_draft_ids): if not line_draft_ids:
continue continue
# Update the move lines (set them as valid) # Update the move lines (set them as valid)
@ -1473,7 +1473,7 @@ class account_move_reconcile(osv.osv):
return True return True
def name_get(self, cr, uid, ids, context=None): def name_get(self, cr, uid, ids, context=None):
if not len(ids): if not ids:
return [] return []
result = [] result = []
for r in self.browse(cr, uid, ids, context): for r in self.browse(cr, uid, ids, context):
@ -1564,7 +1564,7 @@ class account_tax_code(osv.osv):
period_id = context['period_id'] period_id = context['period_id']
else: else:
period_id = self.pool.get('account.period').find(cr, uid) period_id = self.pool.get('account.period').find(cr, uid)
if not len(period_id): if not period_id:
return dict.fromkeys(ids, 0.0) return dict.fromkeys(ids, 0.0)
period_id = period_id[0] period_id = period_id[0]
return self._sum(cr, uid, ids, name, args, context, return self._sum(cr, uid, ids, name, args, context,
@ -1600,7 +1600,7 @@ class account_tax_code(osv.osv):
def name_get(self, cr, uid, ids, context=None): def name_get(self, cr, uid, ids, context=None):
if isinstance(ids, (int, long)): if isinstance(ids, (int, long)):
ids = [ids] ids = [ids]
if not len(ids): if not ids:
return [] return []
if isinstance(ids, (int, long)): if isinstance(ids, (int, long)):
ids = [ids] ids = [ids]
@ -1691,7 +1691,7 @@ class account_tax(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
""" """
Returns a list of tupples containing id, name, as internally it is called {def name_get} Returns a list of tupples containing id, name, as internally it is called {def name_get}
result format : {[(id, name), (id, name), ...]} result format: {[(id, name), (id, name), ...]}
@param cr: A database cursor @param cr: A database cursor
@param user: ID of the user currently logged in @param user: ID of the user currently logged in
@ -1733,7 +1733,7 @@ class account_tax(osv.osv):
return super(account_tax, self).search(cr, uid, args, offset, limit, order, context, count) return super(account_tax, self).search(cr, uid, args, offset, limit, order, context, count)
def name_get(self, cr, uid, ids, context=None): def name_get(self, cr, uid, ids, context=None):
if not len(ids): if not ids:
return [] return []
res = [] res = []
for record in self.read(cr, uid, ids, ['description','name'], context=context): for record in self.read(cr, uid, ids, ['description','name'], context=context):
@ -1748,8 +1748,8 @@ class account_tax(osv.osv):
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
_defaults = { _defaults = {
'python_compute': '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or None\n# partner : res.partner object or None\n\nresult = price_unit * 0.10''', 'python_compute': '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or None\n# partner: res.partner object or None\n\nresult = price_unit * 0.10''',
'python_compute_inv': '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or False\n\nresult = price_unit * 0.10''', 'python_compute_inv': '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or False\n\nresult = price_unit * 0.10''',
'applicable_type': 'true', 'applicable_type': 'true',
'type': 'percent', 'type': 'percent',
'amount': 0, 'amount': 0,
@ -1822,7 +1822,7 @@ class account_tax(osv.osv):
data['balance'] = cur_price_unit data['balance'] = cur_price_unit
amount2 = data.get('amount', 0.0) amount2 = data.get('amount', 0.0)
if len(tax.child_ids): if tax.child_ids:
if tax.child_depend: if tax.child_depend:
latest = res.pop() latest = res.pop()
amount = amount2 amount = amount2
@ -1963,7 +1963,7 @@ class account_tax(osv.osv):
'tax_code_id': tax.tax_code_id.id, 'tax_code_id': tax.tax_code_id.id,
'ref_tax_code_id': tax.ref_tax_code_id.id, 'ref_tax_code_id': tax.ref_tax_code_id.id,
}) })
if len(tax.child_ids): if tax.child_ids:
if tax.child_depend: if tax.child_depend:
del res[-1] del res[-1]
amount = price_unit amount = price_unit
@ -2015,7 +2015,7 @@ class account_model(osv.osv):
'journal_id': fields.many2one('account.journal', 'Journal', required=True), 'journal_id': fields.many2one('account.journal', 'Journal', required=True),
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), 'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
'lines_id': fields.one2many('account.model.line', 'model_id', 'Model Entries'), 'lines_id': fields.one2many('account.model.line', 'model_id', 'Model Entries'),
'legend' :fields.text('Legend', readonly=True, size=100), 'legend': fields.text('Legend', readonly=True, size=100),
} }
_defaults = { _defaults = {
@ -2159,7 +2159,7 @@ class account_subscription(osv.osv):
break break
if ok: if ok:
todone.append(sub.id) todone.append(sub.id)
if len(todone): if todone:
self.write(cr, uid, todone, {'state':'done'}) self.write(cr, uid, todone, {'state':'done'})
return False return False
@ -2169,7 +2169,7 @@ class account_subscription(osv.osv):
for line in sub.lines_id: for line in sub.lines_id:
if not line.move_id.id: if not line.move_id.id:
toremove.append(line.id) toremove.append(line.id)
if len(toremove): if toremove:
self.pool.get('account.subscription.line').unlink(cr, uid, toremove) self.pool.get('account.subscription.line').unlink(cr, uid, toremove)
self.write(cr, uid, ids, {'state':'draft'}) self.write(cr, uid, ids, {'state':'draft'})
return False return False
@ -2263,7 +2263,7 @@ class account_account_template(osv.osv):
_defaults = { _defaults = {
'reconcile': False, 'reconcile': False,
'type' : 'view', 'type': 'view',
'nocreate': False, 'nocreate': False,
} }
@ -2274,7 +2274,7 @@ class account_account_template(osv.osv):
def name_get(self, cr, uid, ids, context={}): def name_get(self, cr, uid, ids, context={}):
if not len(ids): if not ids:
return [] return []
reads = self.read(cr, uid, ids, ['name','code'], context) reads = self.read(cr, uid, ids, ['name','code'], context)
res = [] res = []
@ -2362,7 +2362,7 @@ class account_tax_code_template(osv.osv):
} }
def name_get(self, cr, uid, ids, context=None): def name_get(self, cr, uid, ids, context=None):
if not len(ids): if not ids:
return [] return []
if isinstance(ids, (int, long)): if isinstance(ids, (int, long)):
ids = [ids] ids = [ids]
@ -2394,7 +2394,7 @@ class account_chart_template(osv.osv):
'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'), 'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'),
'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'), 'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),
'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'), 'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),
'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')] , help='This Account is used for transferring Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profilt & Loss Report'), 'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profilt & Loss Report'),
} }
account_chart_template() account_chart_template()
@ -2440,7 +2440,7 @@ class account_tax_template(osv.osv):
} }
def name_get(self, cr, uid, ids, context={}): def name_get(self, cr, uid, ids, context={}):
if not len(ids): if not ids:
return [] return []
res = [] res = []
for record in self.read(cr, uid, ids, ['description','name'], context): for record in self.read(cr, uid, ids, ['description','name'], context):
@ -2455,8 +2455,8 @@ class account_tax_template(osv.osv):
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
_defaults = { _defaults = {
'python_compute': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or None\n# partner : res.partner object or None\n\nresult = price_unit * 0.10''', 'python_compute': lambda *a: '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or None\n# partner: res.partner object or None\n\nresult = price_unit * 0.10''',
'python_compute_inv': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or False\n\nresult = price_unit * 0.10''', 'python_compute_inv': lambda *a: '''# price_unit\n# address: res.partner.address object or False\n# product: product.product object or False\n\nresult = price_unit * 0.10''',
'applicable_type': 'true', 'applicable_type': 'true',
'type': 'percent', 'type': 'percent',
'amount': 0, 'amount': 0,
@ -2822,24 +2822,24 @@ class wizard_multi_charts_accounts(osv.osv_memory):
for position in obj_fiscal_position_template.browse(cr, uid, fp_ids): for position in obj_fiscal_position_template.browse(cr, uid, fp_ids):
vals_fp = { vals_fp = {
'company_id' : company_id, 'company_id': company_id,
'name' : position.name, 'name': position.name,
} }
new_fp = obj_fiscal_position.create(cr, uid, vals_fp) new_fp = obj_fiscal_position.create(cr, uid, vals_fp)
for tax in position.tax_ids: for tax in position.tax_ids:
vals_tax = { vals_tax = {
'tax_src_id' : tax_template_ref[tax.tax_src_id.id], 'tax_src_id': tax_template_ref[tax.tax_src_id.id],
'tax_dest_id' : tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False, 'tax_dest_id': tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False,
'position_id' : new_fp, 'position_id': new_fp,
} }
obj_tax_fp.create(cr, uid, vals_tax) obj_tax_fp.create(cr, uid, vals_tax)
for acc in position.account_ids: for acc in position.account_ids:
vals_acc = { vals_acc = {
'account_src_id' : acc_template_ref[acc.account_src_id.id], 'account_src_id': acc_template_ref[acc.account_src_id.id],
'account_dest_id' : acc_template_ref[acc.account_dest_id.id], 'account_dest_id': acc_template_ref[acc.account_dest_id.id],
'position_id' : new_fp, 'position_id': new_fp,
} }
obj_ac_fp.create(cr, uid, vals_acc) obj_ac_fp.create(cr, uid, vals_acc)

View File

@ -284,7 +284,7 @@ class account_bank_statement(osv.osv):
account=acc_cur) account=acc_cur)
val['amount_currency'] = amount_cur val['amount_currency'] = amount_cur
move_line_id = account_move_line_obj.create(cr, uid, val , context=context) move_line_id = account_move_line_obj.create(cr, uid, val, context=context)
torec.append(move_line_id) torec.append(move_line_id)
# Fill the secondary amount/currency # Fill the secondary amount/currency

View File

@ -519,7 +519,6 @@
res_model="account.move.line" res_model="account.move.line"
src_model="account.invoice"/> src_model="account.invoice"/>
<act_window <act_window
context="{'search_default_move_id':move_id, 'search_default_unreconciled':False,}" context="{'search_default_move_id':move_id, 'search_default_unreconciled':False,}"
id="act_account_invoice_account_move_invoice_link" id="act_account_invoice_account_move_invoice_link"

View File

@ -124,6 +124,8 @@ class account_installer(osv.osv_memory):
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id'] id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
obj_multi = self.pool.get('account.chart.template').browse(cr, uid, id) obj_multi = self.pool.get('account.chart.template').browse(cr, uid, id)
record = self.browse(cr, uid, ids, context=context)[0]
if context is None: if context is None:
context = {} context = {}
company_id = self.browse(cr, uid, ids, context)[0].company_id company_id = self.browse(cr, uid, ids, context)[0].company_id
@ -250,7 +252,7 @@ class account_installer(osv.osv_memory):
check_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_chk') check_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_chk')
check_type_id = mod_obj.read(cr, uid, [check_result], ['res_id'])[0]['res_id'] check_type_id = mod_obj.read(cr, uid, [check_result], ['res_id'])[0]['res_id']
record = self.browse(cr, uid, ids, context=context)[0] # record = self.browse(cr, uid, ids, context=context)[0]
code_cnt = 1 code_cnt = 1
vals_seq = { vals_seq = {
'name': _('Bank Journal '), 'name': _('Bank Journal '),
@ -485,8 +487,8 @@ class account_installer(osv.osv_memory):
for position in obj_fiscal_position_template.browse(cr, uid, fp_ids): for position in obj_fiscal_position_template.browse(cr, uid, fp_ids):
vals_fp = { vals_fp = {
'company_id' : company_id.id, 'company_id': company_id.id,
'name' : position.name, 'name': position.name,
} }
new_fp = obj_fiscal_position.create(cr, uid, vals_fp) new_fp = obj_fiscal_position.create(cr, uid, vals_fp)
@ -495,17 +497,17 @@ class account_installer(osv.osv_memory):
for tax in position.tax_ids: for tax in position.tax_ids:
vals_tax = { vals_tax = {
'tax_src_id' : tax_template_ref[tax.tax_src_id.id], 'tax_src_id': tax_template_ref[tax.tax_src_id.id],
'tax_dest_id' : tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False, 'tax_dest_id': tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False,
'position_id' : new_fp, 'position_id': new_fp,
} }
obj_tax_fp.create(cr, uid, vals_tax) obj_tax_fp.create(cr, uid, vals_tax)
for acc in position.account_ids: for acc in position.account_ids:
vals_acc = { vals_acc = {
'account_src_id' : acc_template_ref[acc.account_src_id.id], 'account_src_id': acc_template_ref[acc.account_src_id.id],
'account_dest_id' : acc_template_ref[acc.account_dest_id.id], 'account_dest_id': acc_template_ref[acc.account_dest_id.id],
'position_id' : new_fp, 'position_id': new_fp,
} }
obj_ac_fp.create(cr, uid, vals_acc) obj_ac_fp.create(cr, uid, vals_acc)
@ -646,7 +648,7 @@ class account_installer(osv.osv_memory):
obj_acc.write(cr, uid, default_account_ids, {'tax_ids':[(6,0,[purchase_tax])]}) obj_acc.write(cr, uid, default_account_ids, {'tax_ids':[(6,0,[purchase_tax])]})
tax_val.update({'supplier_taxes_id':[(6,0,[purchase_tax])]}) tax_val.update({'supplier_taxes_id':[(6,0,[purchase_tax])]})
default_tax.append(('supplier_taxes_id',purchase_tax)) default_tax.append(('supplier_taxes_id',purchase_tax))
if len(tax_val): if tax_val:
product_ids = obj_product.search(cr, uid, []) product_ids = obj_product.search(cr, uid, [])
for product in obj_product.browse(cr, uid, product_ids): for product in obj_product.browse(cr, uid, product_ids):
obj_product.write(cr, uid, product.id, tax_val) obj_product.write(cr, uid, product.id, tax_val)

View File

@ -100,14 +100,14 @@ class account_analytic_balance(report_sxw.rml_parse):
ids = self.acc_data_dict[account_id] ids = self.acc_data_dict[account_id]
query_params = (tuple(ids), date1, date2) query_params = (tuple(ids), date1, date2)
if option == "credit" : if option == "credit":
self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \ self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params) WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
elif option == "debit" : elif option == "debit":
self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \ self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \
WHERE account_id IN %s\ WHERE account_id IN %s\
AND date>=%s AND date<=%s AND amount>0",query_params) AND date>=%s AND date<=%s AND amount>0",query_params)
elif option == "quantity" : elif option == "quantity":
self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \ self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \
WHERE account_id IN %s\ WHERE account_id IN %s\
AND date>=%s AND date<=%s",query_params) AND date>=%s AND date<=%s",query_params)
@ -120,7 +120,7 @@ class account_analytic_balance(report_sxw.rml_parse):
def _sum_all(self, accounts, date1, date2, option): def _sum_all(self, accounts, date1, date2, option):
ids = map(lambda x: x['id'], accounts) ids = map(lambda x: x['id'], accounts)
if not len(ids): if not ids:
return 0.0 return 0.0
if not self.acc_sum_list: if not self.acc_sum_list:
@ -129,15 +129,15 @@ class account_analytic_balance(report_sxw.rml_parse):
self.acc_sum_list = ids2 self.acc_sum_list = ids2
else: else:
ids2 = self.acc_sum_list ids2 = self.acc_sum_list
query_params = (tuple(ids2), date1, date2) query_params = (tuple(ids2), date1, date2)
if option == "debit" : if option == "debit":
self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \ self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",query_params) WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",query_params)
elif option == "credit" : elif option == "credit":
self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \ self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params) WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
elif option == "quantity" : elif option == "quantity":
self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \ self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \
WHERE account_id IN %s AND date>=%s AND date<=%s",query_params) WHERE account_id IN %s AND date>=%s AND date<=%s",query_params)
return self.cr.fetchone()[0] or 0.0 return self.cr.fetchone()[0] or 0.0

View File

@ -40,9 +40,9 @@ class account_analytic_chart(osv.osv_memory):
result = act_obj.read(cr, uid, [id], context=context)[0] result = act_obj.read(cr, uid, [id], context=context)[0]
data = self.read(cr, uid, ids, [])[0] data = self.read(cr, uid, ids, [])[0]
if data['from_date']: if data['from_date']:
result_context.update({'from_date' : data['from_date']}) result_context.update({'from_date': data['from_date']})
if data['to_date']: if data['to_date']:
result_context.update({'to_date' : data['to_date']}) result_context.update({'to_date': data['to_date']})
result['context'] = str(result_context) result['context'] = str(result_context)
return result return result

View File

@ -38,12 +38,12 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
self.result_temp = [] self.result_temp = []
self.localcontext.update({ self.localcontext.update({
'time': time, 'time': time,
'get_lines' : self.get_lines, 'get_lines': self.get_lines,
'get_lines_another' : self.get_lines_another, 'get_lines_another': self.get_lines_another,
'get_company': self._get_company, 'get_company': self._get_company,
'get_currency': self._get_currency, 'get_currency': self._get_currency,
'sum_dr' : self.sum_dr, 'sum_dr': self.sum_dr,
'sum_cr' : self.sum_cr, 'sum_cr': self.sum_cr,
'get_data':self.get_data, 'get_data':self.get_data,
'get_pl_balance':self.get_pl_balance, 'get_pl_balance':self.get_pl_balance,
'get_fiscalyear': self._get_fiscalyear, 'get_fiscalyear': self._get_fiscalyear,
@ -92,7 +92,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
ctx = self.context.copy() ctx = self.context.copy()
ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)
if data['form']['filter'] == 'filter_period' : if data['form']['filter'] == 'filter_period':
ctx['periods'] = data['form'].get('periods', False) ctx['periods'] = data['form'].get('periods', False)
elif data['form']['filter'] == 'filter_date': elif data['form']['filter'] == 'filter_date':
ctx['date_from'] = data['form'].get('date_from', False) ctx['date_from'] = data['form'].get('date_from', False)
@ -110,8 +110,8 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
else: else:
self.res_bl['type'] = 'Net Loss' self.res_bl['type'] = 'Net Loss'
pl_dict = { pl_dict = {
'code' : False, 'code': False,
'name' : self.res_bl['type'], 'name': self.res_bl['type'],
'level': False, 'level': False,
'balance':self.res_bl['balance'], 'balance':self.res_bl['balance'],
} }
@ -120,9 +120,9 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
for account in accounts: for account in accounts:
if (account.user_type.report_type) and (account.user_type.report_type == typ): if (account.user_type.report_type) and (account.user_type.report_type == typ):
account_dict = { account_dict = {
'id' : account.id, 'id': account.id,
'code' : account.code, 'code': account.code,
'name' : account.name, 'name': account.name,
'level': account.level, 'level': account.level,
'balance':account.balance, 'balance':account.balance,
} }
@ -131,7 +131,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit): if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += account.balance self.result_sum_cr += account.balance
if data['form']['display_account'] == 'bal_movement': if data['form']['display_account'] == 'bal_movement':
if account.credit > 0 or account.debit > 0 or account.balance > 0 : if account.credit > 0 or account.debit > 0 or account.balance > 0:
accounts_temp.append(account_dict) accounts_temp.append(account_dict)
elif data['form']['display_account'] == 'bal_solde': elif data['form']['display_account'] == 'bal_solde':
if account.balance != 0: if account.balance != 0:
@ -150,12 +150,12 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))): for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))):
if i < len(cal_list['liability']) and i < len(cal_list['asset']): if i < len(cal_list['liability']) and i < len(cal_list['asset']):
temp={ temp={
'code' : cal_list['liability'][i]['code'], 'code': cal_list['liability'][i]['code'],
'name' : cal_list['liability'][i]['name'], 'name': cal_list['liability'][i]['name'],
'level': cal_list['liability'][i]['level'], 'level': cal_list['liability'][i]['level'],
'balance':cal_list['liability'][i]['balance'], 'balance':cal_list['liability'][i]['balance'],
'code1' : cal_list['asset'][i]['code'], 'code1': cal_list['asset'][i]['code'],
'name1' : cal_list['asset'][i]['name'], 'name1': cal_list['asset'][i]['name'],
'level1': cal_list['asset'][i]['level'], 'level1': cal_list['asset'][i]['level'],
'balance1':cal_list['asset'][i]['balance'], 'balance1':cal_list['asset'][i]['balance'],
} }
@ -163,24 +163,24 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
else: else:
if i < len(cal_list['asset']): if i < len(cal_list['asset']):
temp={ temp={
'code' : '', 'code': '',
'name' : '', 'name': '',
'level': False, 'level': False,
'balance':False, 'balance':False,
'code1' : cal_list['asset'][i]['code'], 'code1': cal_list['asset'][i]['code'],
'name1' : cal_list['asset'][i]['name'], 'name1': cal_list['asset'][i]['name'],
'level1': cal_list['asset'][i]['level'], 'level1': cal_list['asset'][i]['level'],
'balance1':cal_list['asset'][i]['balance'], 'balance1':cal_list['asset'][i]['balance'],
} }
self.result_temp.append(temp) self.result_temp.append(temp)
if i < len(cal_list['liability']): if i < len(cal_list['liability']):
temp={ temp={
'code' : cal_list['liability'][i]['code'], 'code': cal_list['liability'][i]['code'],
'name' : cal_list['liability'][i]['name'], 'name': cal_list['liability'][i]['name'],
'level': cal_list['liability'][i]['level'], 'level': cal_list['liability'][i]['level'],
'balance':cal_list['liability'][i]['balance'], 'balance':cal_list['liability'][i]['balance'],
'code1' : '', 'code1': '',
'name1' : '', 'name1': '',
'level1': False, 'level1': False,
'balance1':False, 'balance1':False,
} }

View File

@ -38,7 +38,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
# 'sum_debit': self._sum_debit, # 'sum_debit': self._sum_debit,
# 'sum_credit': self._sum_credit, # 'sum_credit': self._sum_credit,
'get_currency': self._get_currency, 'get_currency': self._get_currency,
'comma_me' : self.comma_me, 'comma_me': self.comma_me,
'get_start_period': self.get_start_period, 'get_start_period': self.get_start_period,
'get_end_period': self.get_end_period, 'get_end_period': self.get_end_period,
'get_account': self._get_account, 'get_account': self._get_account,
@ -103,7 +103,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
"AND " + self.query +" " \ "AND " + self.query +" " \
"AND l.account_id IN %s " \ "AND l.account_id IN %s " \
" " + PARTNER_REQUEST + " " \ " " + PARTNER_REQUEST + " " \
"AND account.active " , "AND account.active ",
(tuple(move_state), tuple(self.account_ids),)) (tuple(move_state), tuple(self.account_ids),))
res = self.cr.dictfetchall() res = self.cr.dictfetchall()
@ -115,9 +115,9 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
return super(third_party_ledger, self).set_context(objects, data, new_ids, report_type) return super(third_party_ledger, self).set_context(objects, data, new_ids, report_type)
def comma_me(self, amount): def comma_me(self, amount):
if type(amount) is float : if type(amount) is float:
amount = str('%.2f'%amount) amount = str('%.2f'%amount)
else : else:
amount = str(amount) amount = str(amount)
if (amount == '0'): if (amount == '0'):
return ' ' return ' '
@ -186,7 +186,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
result_tmp = 0.0 result_tmp = 0.0
result_init = 0.0 result_init = 0.0
if self.reconcil : if self.reconcil:
RECONCILE_TAG = " " RECONCILE_TAG = " "
else: else:
RECONCILE_TAG = "AND reconcile_id IS NULL" RECONCILE_TAG = "AND reconcile_id IS NULL"
@ -217,7 +217,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
"AND m.state IN %s " "AND m.state IN %s "
"AND account_id IN %s" \ "AND account_id IN %s" \
" " + RECONCILE_TAG + " " \ " " + RECONCILE_TAG + " " \
"AND " + self.query + " " , "AND " + self.query + " ",
(partner.id, tuple(move_state), tuple(self.account_ids),)) (partner.id, tuple(move_state), tuple(self.account_ids),))
contemp = self.cr.fetchone() contemp = self.cr.fetchone()
@ -235,7 +235,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
result_tmp = 0.0 result_tmp = 0.0
result_init = 0.0 result_init = 0.0
if self.reconcil : if self.reconcil:
RECONCILE_TAG = " " RECONCILE_TAG = " "
else: else:
RECONCILE_TAG = "AND reconcile_id IS NULL" RECONCILE_TAG = "AND reconcile_id IS NULL"
@ -266,7 +266,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
"AND m.state IN %s " "AND m.state IN %s "
"AND account_id IN %s" \ "AND account_id IN %s" \
" " + RECONCILE_TAG + " " \ " " + RECONCILE_TAG + " " \
"AND " + self.query + " " , "AND " + self.query + " ",
(partner.id, tuple(move_state), tuple(self.account_ids),)) (partner.id, tuple(move_state), tuple(self.account_ids),))
contemp = self.cr.fetchone() contemp = self.cr.fetchone()
@ -401,7 +401,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
return False return False
def _display_currency(self, data): def _display_currency(self, data):
if self.amount_currency : if self.amount_currency:
return True return True
return False return False

View File

@ -36,13 +36,13 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
self.result_temp = [] self.result_temp = []
self.localcontext.update( { self.localcontext.update( {
'time': time, 'time': time,
'get_lines' : self.get_lines, 'get_lines': self.get_lines,
'get_lines_another' : self.get_lines_another, 'get_lines_another': self.get_lines_another,
'get_currency': self._get_currency, 'get_currency': self._get_currency,
'get_data': self.get_data, 'get_data': self.get_data,
'sum_dr' : self.sum_dr, 'sum_dr': self.sum_dr,
'sum_cr' : self.sum_cr, 'sum_cr': self.sum_cr,
'final_result' : self.final_result, 'final_result': self.final_result,
'get_fiscalyear': self._get_fiscalyear, 'get_fiscalyear': self._get_fiscalyear,
'get_account': self._get_account, 'get_account': self._get_account,
'get_start_period': self.get_start_period, 'get_start_period': self.get_start_period,
@ -86,7 +86,7 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
ctx = self.context.copy() ctx = self.context.copy()
ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)
if data['form']['filter'] == 'filter_period' : if data['form']['filter'] == 'filter_period':
ctx['periods'] = data['form'].get('periods', False) ctx['periods'] = data['form'].get('periods', False)
elif data['form']['filter'] == 'filter_date': elif data['form']['filter'] == 'filter_date':
ctx['date_from'] = data['form'].get('date_from', False) ctx['date_from'] = data['form'].get('date_from', False)
@ -106,7 +106,7 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit): if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += abs(account.debit - account.credit) self.result_sum_cr += abs(account.debit - account.credit)
if data['form']['display_account'] == 'bal_movement': if data['form']['display_account'] == 'bal_movement':
if account.credit > 0 or account.debit > 0 or account.balance > 0 : if account.credit > 0 or account.debit > 0 or account.balance > 0:
accounts_temp.append(account) accounts_temp.append(account)
elif data['form']['display_account'] == 'bal_solde': elif data['form']['display_account'] == 'bal_solde':
if account.balance != 0: if account.balance != 0:
@ -126,12 +126,12 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
for i in range(0,max(len(cal_list['expense']),len(cal_list['income']))): for i in range(0,max(len(cal_list['expense']),len(cal_list['income']))):
if i < len(cal_list['expense']) and i < len(cal_list['income']): if i < len(cal_list['expense']) and i < len(cal_list['income']):
temp={ temp={
'code' : cal_list['expense'][i].code, 'code': cal_list['expense'][i].code,
'name' : cal_list['expense'][i].name, 'name': cal_list['expense'][i].name,
'level': cal_list['expense'][i].level, 'level': cal_list['expense'][i].level,
'balance':cal_list['expense'][i].balance, 'balance':cal_list['expense'][i].balance,
'code1' : cal_list['income'][i].code, 'code1': cal_list['income'][i].code,
'name1' : cal_list['income'][i].name, 'name1': cal_list['income'][i].name,
'level1': cal_list['income'][i].level, 'level1': cal_list['income'][i].level,
'balance1':cal_list['income'][i].balance, 'balance1':cal_list['income'][i].balance,
} }
@ -139,24 +139,24 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
else: else:
if i < len(cal_list['income']): if i < len(cal_list['income']):
temp={ temp={
'code' : '', 'code': '',
'name' : '', 'name': '',
'level': False, 'level': False,
'balance':False, 'balance':False,
'code1' : cal_list['income'][i].code, 'code1': cal_list['income'][i].code,
'name1' : cal_list['income'][i].name, 'name1': cal_list['income'][i].name,
'level1': cal_list['income'][i].level, 'level1': cal_list['income'][i].level,
'balance1':cal_list['income'][i].balance, 'balance1':cal_list['income'][i].balance,
} }
self.result_temp.append(temp) self.result_temp.append(temp)
if i < len(cal_list['expense']): if i < len(cal_list['expense']):
temp={ temp={
'code' : cal_list['expense'][i].code, 'code': cal_list['expense'][i].code,
'name' : cal_list['expense'][i].name, 'name': cal_list['expense'][i].name,
'level': cal_list['expense'][i].level, 'level': cal_list['expense'][i].level,
'balance':cal_list['expense'][i].balance, 'balance':cal_list['expense'][i].balance,
'code1' : '', 'code1': '',
'name1' : '', 'name1': '',
'level1': False, 'level1': False,
'balance1':False, 'balance1':False,
} }

View File

@ -36,7 +36,7 @@ class tax_report(rml_parse.rml_parse):
'get_general': self._get_general, 'get_general': self._get_general,
'get_company': self._get_company, 'get_company': self._get_company,
'get_currency': self._get_currency, 'get_currency': self._get_currency,
'get_lines' : self._get_lines, 'get_lines': self._get_lines,
}) })
@ -45,12 +45,12 @@ class tax_report(rml_parse.rml_parse):
if period_list: if period_list:
res = self._add_codes(based_on, res, period_list, context=context) res = self._add_codes(based_on, res, period_list, context=context)
else : else:
self.cr.execute ("select id from account_fiscalyear") self.cr.execute ("select id from account_fiscalyear")
fy = self.cr.fetchall() fy = self.cr.fetchall()
self.cr.execute ("select id from account_period where fiscalyear_id = %s",(fy[0][0],)) self.cr.execute ("select id from account_period where fiscalyear_id = %s",(fy[0][0],))
periods = self.cr.fetchall() periods = self.cr.fetchall()
for p in periods : for p in periods:
period_list.append(p[0]) period_list.append(p[0])
res = self._add_codes(based_on, res, period_list, context=context) res = self._add_codes(based_on, res, period_list, context=context)
@ -58,20 +58,20 @@ class tax_report(rml_parse.rml_parse):
top_result = [] top_result = []
while i < len(res): while i < len(res):
res_dict = { 'code' : res[i][1].code, res_dict = { 'code': res[i][1].code,
'name' : res[i][1].name, 'name': res[i][1].name,
'debit' : 0, 'debit': 0,
'credit' : 0, 'credit': 0,
'tax_amount' : res[i][1].sum_period, 'tax_amount': res[i][1].sum_period,
'type' : 1, 'type': 1,
'level' : res[i][0], 'level': res[i][0],
'pos' : 0 'pos': 0
} }
top_result.append(res_dict) top_result.append(res_dict)
res_general = self._get_general(res[i][1].id, period_list, company_id, based_on, context=context) res_general = self._get_general(res[i][1].id, period_list, company_id, based_on, context=context)
ind_general = 0 ind_general = 0
while ind_general < len(res_general) : while ind_general < len(res_general):
res_general[ind_general]['type'] = 2 res_general[ind_general]['type'] = 2
res_general[ind_general]['pos'] = 0 res_general[ind_general]['pos'] = 0
res_general[ind_general]['level'] = res_dict['level'] res_general[ind_general]['level'] = res_dict['level']
@ -84,7 +84,7 @@ class tax_report(rml_parse.rml_parse):
def _get_period(self, period_id, context={}): def _get_period(self, period_id, context={}):
return self.pool.get('account.period').browse(self.cr, self.uid, period_id, context=context).name return self.pool.get('account.period').browse(self.cr, self.uid, period_id, context=context).name
def _get_general(self, tax_code_id, period_list ,company_id, based_on, context={}): def _get_general(self, tax_code_id, period_list,company_id, based_on, context={}):
res=[] res=[]
obj_account = self.pool.get('account.account') obj_account = self.pool.get('account.account')
periods_ids = tuple(period_list) periods_ids = tuple(period_list)
@ -112,7 +112,7 @@ class tax_report(rml_parse.rml_parse):
GROUP BY account.id,account.name,account.code', ('draft', tax_code_id, GROUP BY account.id,account.name,account.code', ('draft', tax_code_id,
company_id, periods_ids, 'paid',)) company_id, periods_ids, 'paid',))
else : else:
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \ self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
SUM(line.debit) AS debit, \ SUM(line.debit) AS debit, \
SUM(line.credit) AS credit, \ SUM(line.credit) AS credit, \
@ -191,14 +191,14 @@ class tax_report(rml_parse.rml_parse):
while (bcl_current_level >= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ): while (bcl_current_level >= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ):
tot_elem = copy.copy(accounts[bcl_rup_ind], context=context) tot_elem = copy.copy(accounts[bcl_rup_ind], context=context)
res_tot = { 'code' : accounts[bcl_rup_ind]['code'], res_tot = { 'code': accounts[bcl_rup_ind]['code'],
'name' : '', 'name': '',
'debit' : 0, 'debit': 0,
'credit' : 0, 'credit': 0,
'tax_amount' : accounts[bcl_rup_ind]['tax_amount'], 'tax_amount': accounts[bcl_rup_ind]['tax_amount'],
'type' : accounts[bcl_rup_ind]['type'], 'type': accounts[bcl_rup_ind]['type'],
'level' : 0, 'level': 0,
'pos' : 0 'pos': 0
} }
if res_tot['type'] == 1: if res_tot['type'] == 1:

View File

@ -43,7 +43,7 @@ class account_move_journal(osv.osv_memory):
""" """
journal_id = False journal_id = False
journal_pool = self.pool.get('account.journal') journal_pool = self.pool.get('account.journal')
if context.get('journal_type', False): if context.get('journal_type', False):
jids = journal_pool.search(cr, uid, [('type','=', context.get('journal_type'))]) jids = journal_pool.search(cr, uid, [('type','=', context.get('journal_type'))])
@ -52,7 +52,7 @@ class account_move_journal(osv.osv_memory):
journal_id = jids[0] journal_id = jids[0]
return journal_id return journal_id
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
""" """
Returns views and fields for current model where view will depend on {view_type}. Returns views and fields for current model where view will depend on {view_type}.
@ -62,7 +62,7 @@ class account_move_journal(osv.osv_memory):
@param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
@param context: context arguments, like lang, time zone @param context: context arguments, like lang, time zone
@param toolbar: contains a list of reports, wizards, and links related to current model @param toolbar: contains a list of reports, wizards, and links related to current model
@return: Returns a dict that contains definition for fields, views, and toolbars @return: Returns a dict that contains definition for fields, views, and toolbars
""" """
@ -115,47 +115,47 @@ class account_move_journal(osv.osv_memory):
@param ids: account move journals ID or list of IDs @param ids: account move journals ID or list of IDs
@return: dictionary of Open action move line window on given period and Journal/Payment Mode @return: dictionary of Open action move line window on given period and Journal/Payment Mode
""" """
period_pool = self.pool.get('account.journal.period') period_pool = self.pool.get('account.journal.period')
data_pool = self.pool.get('ir.model.data') data_pool = self.pool.get('ir.model.data')
journal_pool = self.pool.get('account.journal') journal_pool = self.pool.get('account.journal')
if context is None: if context is None:
context = {} context = {}
journal_id = self._get_journal(cr, uid, context) journal_id = self._get_journal(cr, uid, context)
period_id = self._get_period(cr, uid, context) period_id = self._get_period(cr, uid, context)
name = _("Journal Items") name = _("Journal Items")
if journal_id: if journal_id:
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context) ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context)
if not len(ids): if not ids:
journal = journal_pool.browse(cr, uid, journal_id) journal = journal_pool.browse(cr, uid, journal_id)
period = self.pool.get('account.period').browse(cr, uid, period_id) period = self.pool.get('account.period').browse(cr, uid, period_id)
name = journal.name name = journal.name
state = period.state state = period.state
if state == 'done': if state == 'done':
raise osv.except_osv(_('UserError'), _('This period is already closed !')) raise osv.except_osv(_('UserError'), _('This period is already closed !'))
company = period.company_id.id company = period.company_id.id
res = { res = {
'name': name, 'name': name,
'period_id': period_id, 'period_id': period_id,
'journal_id': journal_id, 'journal_id': journal_id,
'company_id': company 'company_id': company
} }
period_pool.create(cr, uid, res,context=context) period_pool.create(cr, uid, res,context=context)
ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)],context=context) ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)],context=context)
period = period_pool.browse(cr, uid, ids[0], context=context) period = period_pool.browse(cr, uid, ids[0], context=context)
name = (period.journal_id.code or '') + ':' + (period.period_id.code or '') name = (period.journal_id.code or '') + ':' + (period.period_id.code or '')
result = data_pool._get_id(cr, uid, 'account', 'view_account_move_line_filter') result = data_pool._get_id(cr, uid, 'account', 'view_account_move_line_filter')
res_id = data_pool.browse(cr, uid, result, context=context).res_id res_id = data_pool.browse(cr, uid, result, context=context).res_id
return { return {
'name': name, 'name': name,
'view_type': 'form', 'view_type': 'form',
@ -166,7 +166,7 @@ class account_move_journal(osv.osv_memory):
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'search_view_id': res_id 'search_view_id': res_id
} }
account_move_journal() account_move_journal()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -40,7 +40,7 @@ class account_aged_trial_balance(osv.osv_memory):
} }
_defaults = { _defaults = {
'period_length': 30, 'period_length': 30,
'date_from' : time.strftime('%Y-%m-%d'), 'date_from': time.strftime('%Y-%m-%d'),
'direction_selection': 'past', 'direction_selection': 'past',
} }
@ -84,7 +84,7 @@ class account_aged_trial_balance(osv.osv_memory):
for i in range(5): for i in range(5):
stop = start + relativedelta(days=period_length) stop = start + relativedelta(days=period_length)
res[str(5-(i+1))] = { res[str(5-(i+1))] = {
'name' : (i!=4 and str((i) * period_length)+'-' + str((i+1) * period_length) or ('+'+str(4 * period_length))), 'name': (i!=4 and str((i) * period_length)+'-' + str((i+1) * period_length) or ('+'+str(4 * period_length))),
'start': start.strftime('%Y-%m-%d'), 'start': start.strftime('%Y-%m-%d'),
'stop': (i!=4 and stop.strftime('%Y-%m-%d') or False), 'stop': (i!=4 and stop.strftime('%Y-%m-%d') or False),
} }