[MERGE] merged addons 3 branch

bzr revid: qdp-launchpad@tinyerp.com-20100927095046-awj548smuwsti04l
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-09-27 11:50:46 +02:00
commit f11a5f19ff
56 changed files with 778 additions and 1763 deletions

View File

@ -49,7 +49,6 @@ module named account_voucher.
'security/ir.model.access.csv',
'account_menuitem.xml',
'account_wizard.xml',
'wizard/account_statement_from_invoice_view.xml',
'wizard/account_move_bank_reconcile_view.xml',
'wizard/account_use_model_view.xml',
'account_installer.xml',
@ -81,7 +80,6 @@ module named account_voucher.
'wizard/account_report_partner_balance_view.xml',
'wizard/account_report_account_balance_view.xml',
'wizard/account_report_aged_partner_balance_view.xml',
'wizard/account_compare_account_balance_report_view.xml',
'wizard/account_report_partner_ledger_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_reconcile_partner_process_view.xml',

View File

@ -65,10 +65,10 @@ class account_payment_term(osv.osv):
}
_order = "name"
def compute(self, cr, uid, id, value, date_ref=False, context={}):
def compute(self, cr, uid, id, value, date_ref=False, context=None):
if not date_ref:
date_ref = datetime.now().strftime('%Y-%m-%d')
pt = self.browse(cr, uid, id, context)
pt = self.browse(cr, uid, id, context=context)
amount = value
result = []
for line in pt.line_ids:
@ -125,7 +125,7 @@ class account_payment_term_line(osv.osv):
}
_order = "sequence"
def _check_percent(self, cr, uid, ids, context={}):
def _check_percent(self, cr, uid, ids, context=None):
obj = self.browse(cr, uid, ids[0])
if obj.value == 'procent' and ( obj.value_amount < 0.0 or obj.value_amount > 1.0):
return False
@ -156,21 +156,22 @@ class account_account_type(osv.osv):
('expense','Profit & Loss (Expense Accounts)'),
('asset','Balance Sheet (Assets Accounts)'),
('liability','Balance Sheet (Liability Accounts)')
],'Type Heads', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)"),
],'Type Heads', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)", required=True),
'note': fields.text('Description'),
}
_defaults = {
'close_method': 'none',
'sign': 1,
'report_type': 'none',
}
_order = "code"
account_account_type()
def _code_get(self, cr, uid, context={}):
def _code_get(self, cr, uid, context=None):
acc_type_obj = self.pool.get('account.account.type')
ids = acc_type_obj.search(cr, uid, [])
res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context=context)
return [(r['code'], r['name']) for r in res]
#----------------------------------------------------------
@ -463,10 +464,10 @@ class account_account(osv.osv):
ids = self.search(cr, user, args, context=context, limit=limit)
return self.name_get(cr, user, ids, context=context)
def name_get(self, cr, uid, ids, context={}):
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
reads = self.read(cr, uid, ids, ['name', 'code'], context)
reads = self.read(cr, uid, ids, ['name', 'code'], context=context)
res = []
for record in reads:
name = record['name']
@ -475,7 +476,7 @@ class account_account(osv.osv):
res.append((record['id'], name))
return res
def copy(self, cr, uid, id, default={}, context={}, done_list=[], local=False):
def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False):
account = self.browse(cr, uid, id, context=context)
new_child_ids = []
if not default:
@ -562,16 +563,17 @@ account_journal_view()
class account_journal_column(osv.osv):
def _col_get(self, cr, user, context={}):
def _col_get(self, cr, user, context=None):
result = []
cols = self.pool.get('account.move.line')._columns
for col in cols:
if col in ('period_id', 'journal_id'):
continue
result.append( (col, cols[col].string) )
result.sort()
return result
_name = "account.journal.column"
_description = "Journal Column"
_columns = {
@ -629,7 +631,7 @@ class account_journal(osv.osv):
raise osv.except_osv(_('Warning !'), _('You cannot modify company of this journal as its related record exist in Entry Lines'))
return super(account_journal, self).write(cr, uid, ids, vals, context=context)
def create_sequence(self, cr, uid, vals, context={}):
def create_sequence(self, cr, uid, vals, context=None):
"""
Create new entry sequence for every new Joural
@param cr: cursor to database
@ -671,12 +673,12 @@ class account_journal(osv.osv):
}
return seq_pool.create(cr, uid, seq)
def create(self, cr, uid, vals, context={}):
def create(self, cr, uid, vals, context=None):
if not 'sequence_id' in vals or not vals['sequence_id']:
vals.update({'sequence_id' : self.create_sequence(cr, uid, vals, context)})
return super(account_journal, self).create(cr, uid, vals, context)
def name_get(self, cr, user, ids, context={}):
def name_get(self, cr, user, ids, context=None):
"""
Returns a list of tupples containing id, name.
result format : {[(id, name), (id, name), ...]}
@ -1701,6 +1703,11 @@ class account_tax(osv.osv):
ids = self.search(cr, user, args, limit=limit, context=context)
return self.name_get(cr, user, ids, context=context)
def write(self, cr, uid, ids, vals, context=None):
if vals.get('type', False) and vals['type'] in ('none', 'code'):
vals.update({'amount': 0.0})
return super(account_tax, self).write(cr, uid, ids, vals, context=context)
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
journal_pool = self.pool.get('account.journal')
@ -1996,32 +2003,34 @@ class account_model(osv.osv):
_columns = {
'name': fields.char('Model Name', size=64, required=True, help="This is a model for recurring accounting entries"),
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
'company_id': fields.many2one('res.company', 'Company', required=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'),
'legend' :fields.text('Legend', readonly=True, size=100),
}
_defaults = {
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s : To Specify Year \n%(month)s : To Specify Month \n%(date)s : Current Date\n\ne.g. My model on %(date)s'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
def generate(self, cr, uid, ids, datas={}, context={}):
def generate(self, cr, uid, ids, datas={}, context=None):
move_ids = []
entry = {}
account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
pt_obj = self.pool.get('account.payment.term')
if datas.get('date', False):
context.update({'date':datas['date']})
period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date', False))
if context is None:
context = {}
if datas.get('date', False):
context.update({'date': datas['date']})
period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date', False))
if not period_id:
raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
period_id = period_id[0]
for model in self.browse(cr, uid, ids, context):
entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%d')}
entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
move_id = account_move_obj.create(cr, uid, {
'ref': entry['name'],
'period_id': period_id,
@ -2069,7 +2078,9 @@ class account_model(osv.osv):
c = context.copy()
c.update({'journal_id': model.journal_id.id,'period_id': period_id})
account_move_line_obj.create(cr, uid, val, context=c)
return move_ids
account_model()
class account_model_line(osv.osv):
@ -2541,6 +2552,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
obj_fiscal_position = self.pool.get('account.fiscal.position')
data_pool = self.pool.get('ir.model.data')
analytic_journal_obj = self.pool.get('account.analytic.journal')
# Creating Account
obj_acc_root = obj_multi.chart_template_id.account_root_id
@ -2666,11 +2678,15 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['view_id'] = view_id
#Sales Journal
analitical_sale_ids = analytic_journal_obj.search(cr,uid,[('type','=','sale')])
analitical_journal_sale = analitical_sale_ids and analitical_sale_ids[0] or False
vals_journal['name'] = _('Sales Journal')
vals_journal['type'] = 'sale'
vals_journal['code'] = _('SAJ')
vals_journal['sequence_id'] = seq_id_sale
vals_journal['company_id'] = company_id
vals_journal['analytic_journal_id'] = analitical_journal_sale
if obj_multi.chart_template_id.property_account_receivable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id]
@ -2679,12 +2695,16 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_journal.create(cr,uid,vals_journal)
# Purchase Journal
analitical_purchase_ids = analytic_journal_obj.search(cr,uid,[('type','=','purchase')])
analitical_journal_purchase = analitical_purchase_ids and analitical_purchase_ids[0] or False
vals_journal['name'] = _('Purchase Journal')
vals_journal['type'] = 'purchase'
vals_journal['code'] = _('EXJ')
vals_journal['sequence_id'] = seq_id_purchase
vals_journal['view_id'] = view_id
vals_journal['company_id'] = company_id
vals_journal['analytic_journal_id'] = analitical_journal_purchase
if obj_multi.chart_template_id.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]
@ -2732,11 +2752,15 @@ class wizard_multi_charts_accounts(osv.osv_memory):
seq_id = obj_sequence.create(cr,uid,vals_seq)
#create the bank journal
analitical_bank_ids = analytic_journal_obj.search(cr,uid,[('type','=','situation')])
analitical_journal_bank = analitical_bank_ids and analitical_bank_ids[0] or False
vals_journal['name']= vals['name']
vals_journal['code']= _('BNK') + str(current_num)
vals_journal['sequence_id'] = seq_id
vals_journal['type'] = 'cash'
vals_journal['company_id'] = company_id
vals_journal['analytic_journal_id'] = analitical_journal_bank
if line.currency_id:
vals_journal['view_id'] = view_id_cur
@ -2745,8 +2769,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['view_id'] = view_id_cash
vals_journal['default_credit_account_id'] = acc_cash_id
vals_journal['default_debit_account_id'] = acc_cash_id
obj_journal.create(cr,uid,vals_journal)
obj_journal.create(cr, uid, vals_journal)
current_num += 1
#create the properties
@ -2811,14 +2834,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
}
obj_ac_fp.create(cr, uid, vals_acc)
#fially inactive the demo chart of accounts
data_id = data_pool.search(cr, uid, [('model','=','account.account'), ('name','=','chart0')])
if data_id:
data = data_pool.browse(cr, uid, data_id[0])
account_id = data.res_id
acc_ids = obj_acc._get_children_and_consol(cr, uid, [account_id])
if acc_ids:
cr.execute("update account_account set active='f' where id in " + str(tuple(acc_ids)))
wizard_multi_charts_accounts()
class account_bank_accounts_wizard(osv.osv_memory):

View File

@ -71,18 +71,22 @@ class account_analytic_line(osv.osv):
# Compute the cost based on the price type define into company
# property_valuation_price_type property
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id,
def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id,
unit=False, journal_id=False, context=None):
if context==None:
context={}
uom_obj = self.pool.get('product.uom')
if not journal_id or not prod_id:
return {}
product_obj = self.pool.get('product.product')
company_obj=self.pool.get('res.company')
analytic_journal_obj=self.pool.get('account.analytic.journal')
product_price_type_obj = self.pool.get('product.price.type')
if prod_id:
result = 0.0
prod = product_obj.browse(cr, uid, prod_id)
analytic_journal_obj =self.pool.get('account.analytic.journal')
j_id = analytic_journal_obj.browse(cr, uid, journal_id, context=context)
prod = product_obj.browse(cr, uid, prod_id)
if not company_id:
company_id = j_id.company_id.id
result = 0.0
is_purchase = False
if j_id.type == 'purchase':
a = prod.product_tmpl_id.property_account_expense.id
if not a:
a = prod.categ_id.property_account_expense_categ.id
@ -91,32 +95,31 @@ class account_analytic_line(osv.osv):
_('There is no expense account defined ' \
'for this product: "%s" (id:%d)') % \
(prod.name, prod.id,))
if not company_id:
company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context)
flag = False
# Compute based on pricetype
pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id)
if journal_id:
journal = analytic_journal_obj.browse(cr, uid, journal_id)
if journal.type == 'sale':
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context)
if product_price_type_ids:
pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0]
# Take the company currency as the reference one
if pricetype.field == 'list_price':
flag = True
amount_unit = prod.price_get(pricetype.field, context)[prod.id]
amount = amount_unit*unit_amount or 1.0
prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
amount = amount_unit*unit_amount or 1.0
result = round(amount, prec)
if not flag:
result *= -1
return {'value': {
amount_unit = prod.price_get('standard_price', context)[prod.id]
is_purchase = True
else:
a = prod.product_tmpl_id.property_account_income.id
if not a:
a = prod.categ_id.property_account_income_categ.id
if not a:
raise osv.except_osv(_('Error !'),
_('There is no income account defined ' \
'for this product: "%s" (id:%d)') % \
(prod.name, prod_id,))
amount_unit = prod.price_get('list_price', context)[prod_id]
prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
amount = amount_unit * quantity or 1.0
result = round(amount, prec)
if is_purchase:
result *= -1
return {
'value': {
'amount': result,
'general_account_id': a,
}}
return {}
}
}
def view_header_get(self, cr, user, view_id, view_type, context):
if context.get('account_id', False):

View File

@ -71,12 +71,10 @@ class account_bank_statement(osv.osv):
journal_pool = self.pool.get('account.journal')
journal_type = context.get('journal_type', False)
journal_id = False
if journal_type:
ids = journal_pool.search(cr, uid, [('type', '=', journal_type)])
if ids:
journal_id = ids[0]
return journal_id
def _default_balance_start(self, cr, uid, context={}):
@ -152,7 +150,7 @@ class account_bank_statement(osv.osv):
'name': fields.char('Name', size=64, required=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself', states={'confirm': [('readonly', True)]}),
'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True,
states={'confirm': [('readonly', True)]}, domain=[('type', '=', 'bank')]),
readonly=True, states={'draft':[('readonly',False)]}),
'period_id': fields.many2one('account.period', 'Period', required=True,
states={'confirm':[('readonly', True)]}),
'balance_start': fields.float('Starting Balance', digits_compute=dp.get_precision('Account'),
@ -176,15 +174,15 @@ class account_bank_statement(osv.osv):
}
_defaults = {
'name': lambda *a: "/",
'date': lambda *a: time.strftime('%Y-%m-%d'),
'state': lambda *a: 'draft',
'name': "/",
'date': time.strftime('%Y-%m-%d'),
'state': 'draft',
'balance_start': _default_balance_start,
'journal_id': _default_journal_id,
'period_id': _get_period,
}
def onchange_date(self, cr, user, ids, date, context={}):
def onchange_date(self, cr, user, ids, date, context=None):
"""
Returns a dict that contains new values and context
@param cr: A database cursor
@ -196,6 +194,10 @@ class account_bank_statement(osv.osv):
"""
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)])
if pids:
res.update({
@ -210,10 +212,8 @@ class account_bank_statement(osv.osv):
'context':context,
}
def button_dummy(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {}, context)
return True
def button_dummy(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {}, context=context)
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
res_currency_obj = self.pool.get('res.currency')
@ -222,10 +222,10 @@ class account_bank_statement(osv.osv):
account_move_line_obj = self.pool.get('account.move.line')
account_analytic_line_obj = self.pool.get('account.analytic.line')
account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context)
st = st_line.statement_id
context.update({'date': st_line.date})
move_id = account_move_obj.create(cr, uid, {
'journal_id': st.journal_id.id,
@ -284,7 +284,7 @@ class account_bank_statement(osv.osv):
move_line_id = account_move_line_obj.create(cr, uid, val , context=context)
torec.append(move_line_id)
# Fill the secondary amount/currency
# if currency is not the same than the company
amount_currency = False
@ -323,22 +323,33 @@ class account_bank_statement(osv.osv):
def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None):
return st_number + ' - ' + str(st_line.sequence)
def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
st = self.browse(cr, uid, st_id, context)
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
raise osv.except_osv(_('Error !'),
_('The statement balance is incorrect !\n') +
_('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
return True
def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
def check_status_condition(self, cr, uid, state, journal_type='bank'):
return state=='draft'
def button_confirm_bank(self, cr, uid, ids, context=None):
done = []
obj_seq = self.pool.get('ir.sequence')
if context is None:
context = {}
for st in self.browse(cr, uid, ids, context):
j_type = st.journal_id.type
company_currency_id = st.journal_id.company_id.currency_id.id
if not st.state=='draft':
if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
continue
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
raise osv.except_osv(_('Error !'),
_('The statement balance is incorrect !\n') +
_('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
if (not st.journal_id.default_credit_account_id) \
or (not st.journal_id.default_debit_account_id):
raise osv.except_osv(_('Configuration Error !'),
@ -369,11 +380,9 @@ class account_bank_statement(osv.osv):
self.write(cr, uid, [st.id], {'name': st_number}, context=context)
self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st_number)
done.append(st.id)
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
self.write(cr, uid, done, {'state':'confirm'}, context=context)
return True
def button_cancel(self, cr, uid, ids, context={}):
def button_cancel(self, cr, uid, ids, context=None):
done = []
for st in self.browse(cr, uid, ids, context):
if st.state=='draft':
@ -383,8 +392,7 @@ class account_bank_statement(osv.osv):
ids += [x.id for x in line.move_ids]
self.pool.get('account.move').unlink(cr, uid, ids, context)
done.append(st.id)
self.write(cr, uid, done, {'state':'draft'}, context=context)
return True
return self.write(cr, uid, done, {'state':'draft'}, context=context)
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None):
account_journal_obj = self.pool.get('account.journal')
@ -415,7 +423,7 @@ class account_bank_statement(osv.osv):
context = {}
default = default.copy()
default['move_line_ids'] = []
return super(account_bank_statement, self).copy(cr, uid, id, default, context)
return super(account_bank_statement, self).copy(cr, uid, id, default, context=context)
account_bank_statement()
@ -487,8 +495,8 @@ class account_bank_statement_line(osv.osv):
}
_defaults = {
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'type': lambda *a: 'general',
'date': time.strftime('%Y-%m-%d'),
'type': 'general',
}
account_bank_statement_line()

View File

@ -20,9 +20,10 @@
#
##############################################################################
from osv import osv, fields
import time
from mx import DateTime
from osv import osv, fields
from decimal import Decimal
from tools.translate import _
import decimal_precision as dp
@ -204,7 +205,6 @@ class account_cash_statement(osv.osv):
return res
_columns = {
'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'draft': [('readonly', False)]}, readonly=True, domain=[('type', '=', 'cash')]),
'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
'state': fields.selection(
[('draft', 'Draft'),
@ -291,7 +291,10 @@ class account_cash_statement(osv.osv):
res = super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context=context)
return res
def _equal_balance(self, cr, uid, ids, statement, context={}):
def _equal_balance(self, cr, uid, cash_id, context=None):
statement = self.browse(cr, uid, cash_id, context=context)
self.write(cr, uid, [cash_id], {'balance_end_real': statement.balance_end})
statement.balance_end_real = statement.balance_end
if statement.balance_end != statement.balance_end_cash:
return False
else:
@ -320,26 +323,6 @@ class account_cash_statement(osv.osv):
'name': number
})
# cr.execute("select id from account_bank_statement where journal_id=%s and user_id=%s and state=%s order by id desc limit 1", (statement.journal_id.id, uid, 'confirm'))
# rs = cr.fetchone()
# rs = rs and rs[0] or None
# if rs:
# if len(statement.starting_details_ids) > 0:
# sid = []
# for line in statement.starting_details_ids:
# sid.append(line.id)
# cash_pool.unlink(cr, uid, sid)
#
# statement = statement_pool.browse(cr, uid, rs)
# balance_start = statement.balance_end_real or 0.0
# open_ids = cash_pool.search(cr, uid, [('ending_id','=',statement.id)])
# for sid in open_ids:
# default = {
# 'ending_id': False,
# 'starting_id':ids[0]
# }
# cash_pool.copy(cr, uid, sid, default)
vals.update({
'date':time.strftime("%Y-%m-%d %H:%M:%S"),
'state':'open',
@ -349,204 +332,31 @@ class account_cash_statement(osv.osv):
self.write(cr, uid, ids, vals)
return True
def button_confirm_cash(self, cr, uid, ids, context={}):
""" Check the starting and ending detail of statement
@return: True
"""
done = []
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')
account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
account_analytic_line_obj = self.pool.get('account.analytic.line')
account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
company_currency_id = res_users_obj.browse(cr, uid, uid, context=context).company_id.currency_id.id
for st in self.browse(cr, uid, ids, context):
self.write(cr, uid, [st.id], {'balance_end_real':st.balance_end})
st.balance_end_real = st.balance_end
if not st.state == 'open':
continue
if not self._equal_balance(cr, uid, ids, st, context):
raise osv.except_osv(_('Error !'), _('CashBox Balance is not matching with Calculated Balance !'))
if (not st.journal_id.default_credit_account_id) \
or (not st.journal_id.default_debit_account_id):
raise osv.except_osv(_('Configuration Error !'),
_('Please verify that an account is defined in the journal.'))
for line in st.move_line_ids:
if line.state <> 'valid':
raise osv.except_osv(_('Error !'),
_('The account entries lines are not in valid state.'))
# for bank.statement.lines
# In line we get reconcile_id on bank.ste.rec.
# in bank stat.rec we get line_new_ids on bank.stat.rec.line
for move in st.line_ids:
if move.analytic_account_id:
if not st.journal_id.analytic_journal_id:
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (st.journal_id.name,))
context.update({'date':move.date})
move_id = account_move_obj.create(cr, uid, {
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'date': move.date,
}, context=context)
account_bank_statement_line_obj.write(cr, uid, [move.id], {
'move_ids': [(4,move_id, False)]
})
if not move.amount:
continue
torec = []
if move.amount >= 0:
account_id = st.journal_id.default_credit_account_id.id
else:
account_id = st.journal_id.default_debit_account_id.id
acc_cur = ((move.amount<=0) and st.journal_id.default_debit_account_id) or move.account_id
amount = res_currency_obj.compute(cr, uid, st.currency.id,
company_currency_id, move.amount, context=context,
account=acc_cur)
if move.reconcile_id and move.reconcile_id.line_new_ids:
for newline in move.reconcile_id.line_new_ids:
amount += newline.amount
val = {
'name': move.name,
'date': move.date,
'ref': move.ref,
'move_id': move_id,
'partner_id': ((move.partner_id) and move.partner_id.id) or False,
'account_id': (move.account_id) and move.account_id.id,
'credit': ((amount>0) and amount) or 0.0,
'debit': ((amount<0) and -amount) or 0.0,
'statement_id': st.id,
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'currency_id': st.currency.id,
'analytic_account_id': move.analytic_account_id and move.analytic_account_id.id or False
}
amount = res_currency_obj.compute(cr, uid, st.currency.id,
company_currency_id, move.amount, context=context,
account=acc_cur)
if st.currency.id <> company_currency_id:
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
st.currency.id, amount, context=context,
account=acc_cur)
val['amount_currency'] = -amount_cur
if move.account_id and move.account_id.currency_id and move.account_id.currency_id.id <> company_currency_id:
val['currency_id'] = move.account_id.currency_id.id
if company_currency_id==move.account_id.currency_id.id:
amount_cur = move.amount
else:
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
move.account_id.currency_id.id, amount, context=context,
account=acc_cur)
val['amount_currency'] = amount_cur
move_line_id = account_move_line_obj.create(cr, uid, val , context=context)
torec.append(move_line_id)
# if move.analytic_account_id:
# anal_val = {}
# amt = (val['credit'] or 0.0) - (val['debit'] or 0.0)
# anal_val = {
# 'name': val['name'],
# 'ref': val['ref'],
# 'date': val['date'],
# 'amount': amt,
# 'account_id': val['analytic_account_id'],
# 'currency_id': val['currency_id'],
# 'general_account_id': val['account_id'],
# 'journal_id': st.journal_id.analytic_journal_id.id,
# 'period_id': val['period_id'],
# 'user_id': uid,
# 'move_id': move_line_id
# }
# if val.get('amount_currency', False):
# anal_val['amount_currency'] = val['amount_currency']
# account_analytic_line_obj.create(cr, uid, anal_val, context=context)
if move.reconcile_id and move.reconcile_id.line_new_ids:
for newline in move.reconcile_id.line_new_ids:
account_move_line_obj.create(cr, uid, {
'name': newline.name or move.name,
'date': move.date,
'ref': move.ref,
'move_id': move_id,
'partner_id': ((move.partner_id) and move.partner_id.id) or False,
'account_id': (newline.account_id) and newline.account_id.id,
'debit': newline.amount>0 and newline.amount or 0.0,
'credit': newline.amount<0 and -newline.amount or 0.0,
'statement_id': st.id,
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'analytic_account_id':newline.analytic_id and newline.analytic_id.id or False,
}, context=context)
# Fill the secondary amount/currency
# if currency is not the same than the company
amount_currency = False
currency_id = False
if st.currency.id <> company_currency_id:
amount_currency = move.amount
currency_id = st.currency.id
account_move_line_obj.create(cr, uid, {
'name': move.name,
'date': move.date,
'ref': move.ref,
'move_id': move_id,
'partner_id': ((move.partner_id) and move.partner_id.id) or False,
'account_id': account_id,
'credit': ((amount < 0) and -amount) or 0.0,
'debit': ((amount > 0) and amount) or 0.0,
'statement_id': st.id,
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
'amount_currency': amount_currency,
'currency_id': currency_id,
}, context=context)
for line in account_move_line_obj.browse(cr, uid, [x.id for x in
account_move_obj.browse(cr, uid, move_id,
context=context).line_id],
context=context):
if line.state <> 'valid':
raise osv.except_osv(_('Error !'),
_('Journal Item "%s" is not valid') % line.name)
if move.reconcile_id and move.reconcile_id.line_ids:
torec += map(lambda x: x.id, move.reconcile_id.line_ids)
if abs(move.reconcile_amount-move.amount)<0.0001:
writeoff_acc_id = False
#There should only be one write-off account!
for entry in move.reconcile_id.line_new_ids:
writeoff_acc_id = entry.account_id.id
break
account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context)
else:
account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context)
move_name = st.name + ' - ' + str(move.sequence)
account_move_obj.write(cr, uid, [move_id], {'state':'posted', 'name': move_name})
done.append(st.id)
def balance_check(self, cr, uid, cash_id, journal_type='bank', context=None):
if journal_type == 'bank':
return super(account_cash_statement, self).balance_check(cr, uid, cash_id, journal_type, context)
if not self._equal_balance(cr, uid, cash_id, context):
raise osv.except_osv(_('Error !'), _('CashBox Balance is not matching with Calculated Balance !'))
return True
def statement_close(self, cr, uid, ids, journal_type='bank', context=None):
if journal_type == 'bank':
return super(account_cash_statement, self).statement_close(cr, uid, ids, journal_type, context)
vals = {
'state':'confirm',
'closing_date':time.strftime("%Y-%m-%d %H:%M:%S")
}
self.write(cr, uid, done, vals, context=context)
return True
return self.write(cr, uid, ids, vals, context=context)
def check_status_condition(self, cr, uid, state, journal_type='bank'):
if journal_type == 'bank':
return super(account_cash_statement, self).check_status_condition(cr, uid, state, journal_type)
return state=='open'
def button_confirm_cash(self, cr, uid, ids, context=None):
super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context)
return self.write(cr, uid, ids, {'closing_date':time.strftime("%Y-%m-%d %H:%M:%S")}, context=context)
def button_cancel(self, cr, uid, ids, context={}):
done = []
@ -560,4 +370,3 @@ class account_cash_statement(osv.osv):
return True
account_cash_statement()

View File

@ -62,7 +62,7 @@
<field colspan="4" name="name"/>
<field colspan="4" name="origin" groups="base.group_extended"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(parent.fiscal_position,account_id)" groups="base.group_user"/>
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="base.group_extended"/>
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<newline/>
<field name="price_subtotal"/>
<field name="company_id" groups="base.group_multi_company" readonly="1"/>
@ -178,7 +178,7 @@
<field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, {'company_id': parent.company_id})"/>
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id" on_change="onchange_account_id(parent.fiscal_position,account_id)"/>
<field name="invoice_line_tax_id" view_mode="2" context="{'type':parent.type}" domain="[('parent_id','=',False)]"/>
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="base.group_extended"/>
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', parent.company_id), ('parent_id', '!=', False)]" name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<field name="quantity"/>
<field name="price_unit"/>
<!-- Removed if subtotal is set -->
@ -357,7 +357,7 @@
<group col="10" colspan="4">
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
<filter icon="terp-gtk-media-pause" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices"/>
<filter icon="terp-camera_test" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Invoices"/>
<filter icon="terp-camera_test" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/>
<separator orientation="vertical"/>
<filter name="unpaid" icon="terp-dolar_ok!" string="Unpaid" domain="[('state','=','open')]" help="Unpaid Invoices"/>
<separator orientation="vertical"/>

View File

@ -8,8 +8,7 @@
<menuitem id="menu_finance_bank_and_cash" name="Bank and Cash" parent="menu_finance" sequence="3"/>
<menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="8" groups="group_account_user,group_account_manager,base.group_system,group_account_invoice"/>
<!-- This menu is used in account_code module -->
<menuitem id="menu_account_coda" name="Statements" parent="menu_finance_periodical_processing" sequence="12"/>
<menuitem id="menu_finance_periodical_processing_bank" name="Bank Reconciliation" parent="menu_finance_periodical_processing" sequence="8" groups="group_account_user,group_account_manager,base.group_system,group_account_invoice"/>
<menuitem id="menu_account_pp_statements" name="Statements" parent="menu_finance_periodical_processing" sequence="12"/>
<menuitem id="periodical_processing_journal_entries_validation" name="Draft Entries" parent="menu_finance_periodical_processing" groups="group_account_user,group_account_manager,base.group_system"/>
<menuitem id="periodical_processing_reconciliation" name="Reconciliation" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_invoicing" name="Invoicing" parent="menu_finance_periodical_processing"/>
@ -19,11 +18,11 @@
<menuitem id="menu_finance_legal_statement" name="Legal Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_management_belgian_reports" name="Belgian Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_configuration" name="Configuration" parent="menu_finance" sequence="13" groups="base.group_system"/>
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration" groups="analytic.group_analytic_accounting"/>
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts" groups="base.group_extended"/>
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration" groups="base.group_system"/>
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration" groups="base.group_system"/>
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts" groups="analytic.group_analytic_accounting"/>
<menuitem id="menu_low_level" name="Low Level" parent="menu_finance_accounting" groups="base.group_extended"/>
<menuitem id="menu_configuration_misc" name="Miscellaneous" parent="menu_finance_configuration" sequence="30"/>
<menuitem id="menu_configuration_misc" name="Miscellaneous" parent="menu_finance_configuration" sequence="30" groups="base.group_system"/>
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20"/>
<menuitem id="menu_finance_generic_reporting" name="Generic Reporting" parent="menu_finance_reporting" sequence="100" groups="base.group_system,group_account_manager"/>
<menuitem id="menu_finance_entries" name="Accounting" parent="menu_finance" sequence="4"

View File

@ -639,6 +639,7 @@ class account_move_line(osv.osv):
AND l.state <> 'draft'
GROUP BY l.partner_id
) AS s ON (p.id = s.partner_id)
WHERE debit > 0 AND credit > 0
ORDER BY p.last_reconciliation_date LIMIT 1 OFFSET %s""", (offset,)
)
return cr.fetchone()
@ -799,8 +800,8 @@ class account_move_line(osv.osv):
wf_service.trg_trigger(uid, 'account.move.line', id, cr)
if lines and lines[0]:
partner_id = lines[0].partner_id.id
if context and context.get('stop_reconcile', False):
partner_id = lines[0].partner_id and lines[0].partner_id.id or False
if partner_id and context and context.get('stop_reconcile', False):
self.pool.get('res.partner').write(cr, uid, [partner_id], {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')})
return r_id
@ -946,7 +947,7 @@ class account_move_line(osv.osv):
if field in ('amount_currency', 'currency_id'):
attrs.append('on_change="onchange_currency(account_id, amount_currency,currency_id, date, journal_id)"')
attrs.append("attrs='{'readonly':[('state','=','valid')]}'")
attrs.append('''attrs="{'readonly':[('state','=','valid')]}"''')
if field in widths:
attrs.append('width="'+str(widths[field])+'"')

View File

@ -47,14 +47,6 @@
name="Taxes"
parent="account.menu_finance_generic_reporting" sequence="3"/>
<report id="account_account_balance_compare"
string="Account balance"
model="account.account"
name="account.balance.account.balance"
rml="account/report/compare_account_balance.rml"
auto="False"
menu="False"/>
<report id="account_account_balance_landscape"
string="Account balance"
model="account.account"

View File

@ -95,8 +95,8 @@
<field name="code"/>
<field name="date_start"/>
<field name="date_stop"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="fiscalyear_id"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="fiscalyear_id" widget="selection"/>
<field name="special"/>
<separator colspan="4" string="States"/>
<field name="state"/>
@ -510,15 +510,12 @@
<group col="7" colspan="4">
<field name="name" select="1"/>
<field name="date" select="1" on_change="onchange_date(date)"/>
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" select="1"/>
<field name="journal_id" domain="[('type', '=', 'bank')]" on_change="onchange_journal_id(journal_id)" select="1" widget="selection"/>
<newline/>
<field name="period_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="currency" invisible="1"/>
<button name="%(action_view_account_statement_from_invoice_lines)d"
string="Import Invoices" type="action" icon="gtk-execute"
attrs="{'invisible':[('state','=','confirm')]}"/>
</group>
<notebook colspan="4">
<page string="Transaction" name="statement_line_ids">
@ -531,7 +528,7 @@
<field name="type"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency, {'amount': amount})"/>
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
<field name="analytic_account_id" groups="base.group_extended"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/>
</tree>
<form string="Statement lines">
@ -540,7 +537,7 @@
<field name="type"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency, {'amount': amount})"/>
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field name="analytic_account_id" groups="base.group_extended" />
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/>
<field name="ref"/>
<field name="sequence" readonly="0"/>
@ -579,9 +576,6 @@
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="currency" invisible="1"/>
<button name="%(action_view_account_statement_from_invoice_lines)d"
string="Import Invoices" type="action" icon="gtk-execute"
attrs="{'invisible':[('state','=','confirm')]}"/>
</group>
<notebook colspan="4">
<page string="Journal Entries">
@ -642,7 +636,7 @@
</record>
<menuitem string="Bank Statements" action="action_bank_statement_tree" id="menu_bank_statement_tree" parent="menu_finance_bank_and_cash" sequence="7"/>
<menuitem name="Statements Reconciliation" action="action_bank_statement_periodic_tree" id="menu_menu_Bank_process" parent="menu_finance_periodical_processing_bank" sequence="7"/>
<menuitem name="Statements Reconciliation" action="action_bank_statement_periodic_tree" id="menu_menu_Bank_process" parent="account.menu_account_pp_statements" sequence="7"/>
<record id="action_bank_statement_draft_tree" model="ir.actions.act_window">
@ -846,28 +840,33 @@
<form string="Account Tax">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="description" select="1"/>
<field name="active"/>
<field name="tax_group" select="1"/>
<field name="type"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="active"/>
</group>
<notebook colspan="4">
<page string="Tax Definition">
<field name="applicable_type"/>
<field name="amount" attrs="{'readonly':[('type','=','none'),('type','=','code')]}"/>
<field groups="base.group_extended" name="include_base_amount"/>
<field groups="base.group_extended" name="domain"/>
<newline/>
<page string="Tax Definition" >
<group col="2" colspan="2">
<separator colspan="2" string=""/>
<field name="applicable_type"/>
<field name="type_tax_use"/>
<field groups="base.group_extended" name="domain"/>
<field groups="base.group_extended" name="sequence"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string=""/>
<field name="amount" attrs="{'readonly':[('type','in',('none', 'code'))]}"/>
<field groups="base.group_extended" name="child_depend"/>
<field groups="base.group_extended" name="price_include"/>
<field groups="base.group_extended" name="include_base_amount"/>
</group>
<field name="account_collected_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<label colspan="2" nolabel="1" string="Keep empty to use the income account"/>
<field name="account_paid_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<label colspan="2" nolabel="1" string="Keep empty to use the expense account"/>
<field groups="base.group_extended" name="child_depend"/>
<field groups="base.group_extended" name="sequence"/>
<field groups="base.group_extended" name="price_include"/>
<field name="type_tax_use"/>
<newline/>
<separator colspan="4" string="Child Taxes"/>
<field colspan="4" groups="base.group_extended" name="child_ids" nolabel="1"/>
</page>
<page string="Tax Declaration">
@ -890,8 +889,8 @@
<field colspan="4" name="python_applicable" nolabel="1" attrs="{'readonly':[('applicable_type','=','true')], 'required':[('applicable_type','=','code')]}"/>
</page>
</notebook>
</form>
</field>
</form>
</field>
</record>
<record id="action_tax_form" model="ir.actions.act_window">
<field name="name">Taxes</field>
@ -2489,7 +2488,7 @@
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)" domain="[('type','=','cash')]" select="1" />
<field name="journal_id" on_change="onchange_journal_id(journal_id)" domain="[('type','=','cash')]" select="1" widget="selection"/>
<field name="user_id" select="1" readonly="1"/>
<field name="period_id" select="1"/>
<field name="currency" invisible="1"/>

View File

@ -348,6 +348,7 @@
<field name="sequence_id" ref="sequence_sale_journal"/>
<field model="account.account" name="default_credit_account_id" ref="a_sale"/>
<field model="account.account" name="default_debit_account_id" ref="a_sale"/>
<field name="analytic_journal_id" ref="cose_journal_sale"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="refund_sales_journal" model="account.journal">
@ -359,6 +360,7 @@
<field name="sequence_id" ref="sequence_sale_journal"/>
<field model="account.account" name="default_credit_account_id" ref="a_sale"/>
<field model="account.account" name="default_debit_account_id" ref="a_sale"/>
<field name="analytic_journal_id" ref="cose_journal_sale"/>
<field name="user_id" ref="base.user_root"/>
</record>
@ -370,6 +372,7 @@
<field name="sequence_id" ref="sequence_purchase_journal"/>
<field model="account.account" name="default_debit_account_id" ref="a_expense"/>
<field model="account.account" name="default_credit_account_id" ref="a_expense"/>
<field name="analytic_journal_id" ref="exp"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="refund_expenses_journal" model="account.journal">
@ -381,6 +384,7 @@
<field name="sequence_id" ref="sequence_purchase_journal"/>
<field model="account.account" name="default_debit_account_id" ref="a_expense"/>
<field model="account.account" name="default_credit_account_id" ref="a_expense"/>
<field name="analytic_journal_id" ref="exp"/>
<field name="user_id" ref="base.user_root"/>
</record>
@ -392,6 +396,7 @@
<field name="sequence_id" ref="sequence_journal"/>
<field model="account.account" name="default_debit_account_id" ref="cash"/>
<field model="account.account" name="default_credit_account_id" ref="cash"/>
<field name="analytic_journal_id" ref="sit"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="check_journal" model="account.journal">
@ -402,6 +407,7 @@
<field name="sequence_id" ref="sequence_journal"/>
<field model="account.account" name="default_debit_account_id" ref="cash"/>
<field model="account.account" name="default_credit_account_id" ref="cash"/>
<field name="analytic_journal_id" ref="sit"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="cash_journal" model="account.journal">
@ -412,6 +418,7 @@
<field name="sequence_id" ref="sequence_journal"/>
<field model="account.account" name="default_debit_account_id" ref="cash"/>
<field model="account.account" name="default_credit_account_id" ref="cash"/>
<field name="analytic_journal_id" ref="sit"/>
<field name="user_id" ref="base.user_root"/>
</record>

View File

@ -67,13 +67,13 @@ class account_installer(osv.osv_memory):
'company_id': fields.many2one('res.company', 'Company'),
}
def _default_company(self, cr, uid, context={}):
def _default_company(self, cr, uid, context=None):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
return False
def _get_default_charts(self, cr, uid, context={}):
def _get_default_charts(self, cr, uid, context=None):
module_name = False
company_id = self._default_company(cr, uid, context=context)
company = self.pool.get('res.company').browse(cr, uid, company_id)
@ -91,18 +91,18 @@ class account_installer(osv.osv_memory):
_defaults = {
'date_start': lambda *a: time.strftime('%Y-01-01'),
'date_stop': lambda *a: time.strftime('%Y-12-31'),
'period':lambda *a:'month',
'sale_tax':lambda *a:0.0,
'purchase_tax':lambda *a:0.0,
'period': lambda *a:'month',
'sale_tax': lambda *a:0.0,
'purchase_tax': lambda *a:0.0,
'company_id': _default_company,
'bank_accounts_id':_get_default_accounts,
'bank_accounts_id': _get_default_accounts,
'charts': _get_default_charts
}
def on_change_tax(self, cr, uid, id, tax):
return {'value':{'purchase_tax':tax}}
def on_change_start_date(self, cr, uid, id, start_date):
def on_change_start_date(self, cr, uid, id, start_date=False):
if start_date:
start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d")
end_date = (start_date + relativedelta(months=12)) - relativedelta(days=1)
@ -117,8 +117,8 @@ class account_installer(osv.osv_memory):
obj_acc_template = self.pool.get('account.account.template')
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
obj_fiscal_position = self.pool.get('account.fiscal.position')
data_pool = self.pool.get('ir.model.data')
mod_obj = self.pool.get('ir.model.data')
analytic_journal_obj = self.pool.get('account.analytic.journal')
result = mod_obj._get_id(cr, uid, 'account', 'configurable_chart_template')
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
@ -126,7 +126,7 @@ class account_installer(osv.osv_memory):
if context is None:
context = {}
company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id
company_id = self.browse(cr, uid, ids, context)[0].company_id
seq_journal = True
# Creating Account
@ -211,7 +211,7 @@ class account_installer(osv.osv_memory):
vals={
'name': (obj_acc_root.id == account_template.id) and company_id.name or account_template.name,
#'sign': account_template.sign,
#'currency_id': account_template.currency_id and account_template.currency_id.id or False,
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
'code': code_acc,
'type': account_template.type,
'user_type': account_template.user_type and account_template.user_type.id or False,
@ -237,7 +237,7 @@ class account_installer(osv.osv_memory):
'company_id': company_id.id,
}
bank_account = obj_acc.create(cr, uid, b_vals)
view_id_cash = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Bank/Cash Journal View')])[0] #why fixed name here?
view_id_cur = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Bank/Cash Journal (Multi-Currency) View')])[0] #Why Fixed name here?
ref_acc_bank = obj_multi.bank_account_view_id
@ -262,11 +262,14 @@ class account_installer(osv.osv_memory):
seq_id = obj_sequence.create(cr,uid,vals_seq)
#create the bank journals
analitical_bank_ids = analytic_journal_obj.search(cr,uid,[('type','=','situation')])
analitical_journal_bank = analitical_bank_ids and analitical_bank_ids[0] or False
vals_journal = {}
vals_journal['name']= _('Bank Journal ')
vals_journal['code']= _('BNK')
vals_journal['sequence_id'] = seq_id
vals_journal['type'] = 'cash'
vals_journal['analytic_journal_id'] = analitical_journal_bank
if vals.get('currency_id', False):
vals_journal['view_id'] = view_id_cur
vals_journal['currency'] = vals.get('currency_id', False)
@ -321,6 +324,7 @@ class account_installer(osv.osv_memory):
vals_journal['view_id'] = view_id_cash
vals_journal['default_credit_account_id'] = child_bnk_acc
vals_journal['default_debit_account_id'] = child_bnk_acc
vals_journal['analytic_journal_id'] = analitical_journal_bank
obj_journal.create(cr,uid,vals_journal)
code_cnt += 1
@ -366,10 +370,15 @@ class account_installer(osv.osv_memory):
vals_journal['view_id'] = view_id
#Sales Journal
analitical_sale_ids = analytic_journal_obj.search(cr,uid,[('type','=','sale')])
analitical_journal_sale = analitical_sale_ids and analitical_sale_ids[0] or False
vals_journal['name'] = _('Sales Journal')
vals_journal['type'] = 'sale'
vals_journal['code'] = _('SAJ')
vals_journal['sequence_id'] = seq_id_sale
vals_journal['analytic_journal_id'] = analitical_journal_sale
if obj_multi.property_account_receivable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
@ -378,10 +387,14 @@ class account_installer(osv.osv_memory):
obj_journal.create(cr,uid,vals_journal)
# Purchase Journal
analitical_purchase_ids = analytic_journal_obj.search(cr,uid,[('type','=','purchase')])
analitical_journal_purchase = analitical_purchase_ids and analitical_purchase_ids[0] or False
vals_journal['name'] = _('Purchase Journal')
vals_journal['type'] = 'purchase'
vals_journal['code'] = _('EXJ')
vals_journal['sequence_id'] = seq_id_purchase
vals_journal['analytic_journal_id'] = analitical_journal_purchase
if obj_multi.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
@ -406,6 +419,7 @@ class account_installer(osv.osv_memory):
vals_journal['refund_journal'] = True
vals_journal['code'] = _('SCNJ')
vals_journal['sequence_id'] = seq_id_sale_refund
vals_journal['analytic_journal_id'] = analitical_journal_sale
if obj_multi.property_account_receivable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
@ -419,6 +433,7 @@ class account_installer(osv.osv_memory):
vals_journal['refund_journal'] = True
vals_journal['code'] = _('ECNJ')
vals_journal['sequence_id'] = seq_id_purchase_refund
vals_journal['analytic_journal_id'] = analitical_journal_purchase
if obj_multi.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
@ -499,14 +514,15 @@ class account_installer(osv.osv_memory):
if context is None:
context = {}
fy_obj = self.pool.get('account.fiscalyear')
data_pool = self.pool.get('ir.model.data')
mod_obj = self.pool.get('ir.model.data')
obj_acc = self.pool.get('account.account')
obj_tax_code = self.pool.get('account.tax.code')
obj_temp_tax_code = self.pool.get('account.tax.code.template')
super(account_installer, self).execute(cr, uid, ids, context=context)
record = self.browse(cr, uid, ids, context=context)[0]
company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id
company_id = record.company_id
for res in self.read(cr, uid, ids):
if record.charts == 'configurable':
mod_obj = self.pool.get('ir.model.data')
fp = tools.file_open(opj('account','configurable_account_chart.xml'))
tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None)
fp.close()
@ -519,11 +535,45 @@ class account_installer(osv.osv_memory):
tax_val = {}
default_tax = []
pur_tax_parent = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_purchases')
pur_tax_parent_id = mod_obj.read(cr, uid, [pur_tax_parent], ['res_id'])[0]['res_id']
pur_temp_tax = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_purchases')
pur_temp_tax_id = mod_obj.read(cr, uid, [pur_temp_tax], ['res_id'])[0]['res_id']
pur_temp_tax_names = obj_temp_tax_code.read(cr, uid, [pur_temp_tax_id], ['name'])
pur_tax_parent_name = pur_temp_tax_names and pur_temp_tax_names[0]['name'] or False
pur_taxcode_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', pur_tax_parent_name)])
if pur_taxcode_parent_id:
pur_taxcode_parent_id = pur_taxcode_parent_id[0]
else:
pur_taxcode_parent_id = False
sal_tax_parent = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_sales')
sal_tax_parent_id = mod_obj.read(cr, uid, [sal_tax_parent], ['res_id'])[0]['res_id']
pur_temp_tax_paid = mod_obj._get_id(cr, uid, 'account', 'tax_code_input')
pur_temp_tax_paid_id = mod_obj.read(cr, uid, [pur_temp_tax_paid], ['res_id'])[0]['res_id']
pur_temp_tax_paid_names = obj_temp_tax_code.read(cr, uid, [pur_temp_tax_paid_id], ['name'])
pur_tax_paid_parent_name = pur_temp_tax_names and pur_temp_tax_paid_names[0]['name'] or False
pur_taxcode_paid_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', pur_tax_paid_parent_name)])
if pur_taxcode_paid_parent_id:
pur_taxcode_paid_parent_id = pur_taxcode_paid_parent_id[0]
else:
pur_taxcode_paid_parent_id = False
sale_temp_tax = mod_obj._get_id(cr, uid, 'account', 'tax_code_base_sales')
sale_temp_tax_id = mod_obj.read(cr, uid, [sale_temp_tax], ['res_id'])[0]['res_id']
sale_temp_tax_names = obj_temp_tax_code.read(cr, uid, [sale_temp_tax_id], ['name'])
sale_tax_parent_name = sale_temp_tax_names and sale_temp_tax_names[0]['name'] or False
sale_taxcode_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', sale_tax_parent_name)])
if sale_taxcode_parent_id:
sale_taxcode_parent_id = sale_taxcode_parent_id[0]
else:
sale_taxcode_parent_id = False
sale_temp_tax_paid = mod_obj._get_id(cr, uid, 'account', 'tax_code_output')
sale_temp_tax_paid_id = mod_obj.read(cr, uid, [sale_temp_tax_paid], ['res_id'])[0]['res_id']
sale_temp_tax_paid_names = obj_temp_tax_code.read(cr, uid, [sale_temp_tax_paid_id], ['name'])
sale_tax_paid_parent_name = sale_temp_tax_paid_names and sale_temp_tax_paid_names[0]['name'] or False
sale_taxcode_paid_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', sale_tax_paid_parent_name)])
if sale_taxcode_paid_parent_id:
sale_taxcode_paid_parent_id = sale_taxcode_paid_parent_id[0]
else:
sale_taxcode_paid_parent_id = False
if s_tax*100 > 0.0:
tax_account_ids = obj_acc.search(cr, uid, [('name','=','Tax Received')], context=context)
@ -533,15 +583,25 @@ class account_installer(osv.osv_memory):
'code': 'TAX%s%%'%(s_tax*100),
'company_id': company_id.id,
'sign': 1,
'parent_id':sal_tax_parent_id
'parent_id': sale_taxcode_parent_id
}
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_tax_code)
vals_paid_tax_code = {
'name': 'TAX Received %s%%'%(s_tax*100),
'code': 'TAX Received %s%%'%(s_tax*100),
'company_id': company_id.id,
'sign': 1,
'parent_id': sale_taxcode_paid_parent_id
}
new_paid_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_paid_tax_code)
sales_tax = obj_tax.create(cr, uid,
{'name':'TAX%s%%'%(s_tax*100),
'description':'TAX%s%%'%(s_tax*100),
'amount':s_tax,
'base_code_id':new_tax_code,
'tax_code_id':new_tax_code,
'tax_code_id':new_paid_tax_code,
'type_tax_use':'sale',
'account_collected_id':sales_tax_account_id,
'account_paid_id':sales_tax_account_id
@ -559,15 +619,25 @@ class account_installer(osv.osv_memory):
'code': 'TAX%s%%'%(p_tax*100),
'company_id': company_id.id,
'sign': 1,
'parent_id':pur_tax_parent_id
'parent_id': pur_taxcode_parent_id
}
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_tax_code)
vals_paid_tax_code = {
'name': 'TAX Paid %s%%'%(p_tax*100),
'code': 'TAX Paid %s%%'%(p_tax*100),
'company_id': company_id.id,
'sign': 1,
'parent_id': pur_taxcode_paid_parent_id
}
new_paid_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_paid_tax_code)
purchase_tax = obj_tax.create(cr, uid,
{'name':'TAX%s%%'%(p_tax*100),
'description':'TAX%s%%'%(p_tax*100),
'amount':p_tax,
'base_code_id':new_tax_code,
'tax_code_id':new_tax_code,
'tax_code_id':new_paid_tax_code,
'type_tax_use':'purchase',
'account_collected_id':purchase_tax_account_id,
'account_paid_id':purchase_tax_account_id
@ -603,14 +673,6 @@ class account_installer(osv.osv_memory):
elif res['period'] == '3months':
fy_obj.create_period3(cr, uid, [fiscal_id])
# #fially inactive the demo chart of accounts
# data_id = data_pool.search(cr, uid, [('model','=','account.account'), ('name','=','chart0')])
# if data_id:
# data = data_pool.browse(cr, uid, data_id[0])
# account_id = data.res_id
# acc_ids = obj_acc._get_children_and_consol(cr, uid, [account_id])
# if acc_ids:
# cr.execute("update account_account set active='f' where id in " + str(tuple(acc_ids)))
def modules_to_install(self, cr, uid, ids, context=None):
modules = super(account_installer, self).modules_to_install(
@ -633,9 +695,9 @@ class account_bank_accounts_wizard(osv.osv_memory):
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
'account_type': fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Account Type', size=32),
}
_defaults = {
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
}
# _defaults = {
# 'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
# }
account_bank_accounts_wizard()
@ -663,11 +725,12 @@ class account_installer_modules(osv.osv_memory):
# 'account_voucher_payment':fields.boolean('Voucher and Reconcile Management',
# help="Extension Account Voucher module includes allows to link payment / receipt "
# "entries with voucher, also automatically reconcile during the payment and receipt entries."),
}
}
_defaults = {
'account_voucher': True,
}
}
account_installer_modules()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -332,6 +332,7 @@ class account_invoice(osv.osv):
}
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
journal_obj = self.pool.get('account.journal')
if context.get('active_model','') in ['res.partner']:
partner = self.pool.get(context['active_model']).read(cr,uid,context['active_ids'],['supplier','customer'])[0]
if not view_type:
@ -343,10 +344,10 @@ class account_invoice(osv.osv):
else:
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0]
res = super(account_invoice,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
type = context.get('journal_type', 'sale')
for field in res['fields']:
type = context.get('journal_type', 'sale')
if field == 'journal_id':
journal_select = self.pool.get('account.journal')._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
res['fields'][field]['selection'] = journal_select
return res
@ -836,7 +837,7 @@ class account_invoice(osv.osv):
total_percent += line.value_amount
total_fixed = (total_fixed * 100) / inv.amount_total
if (total_fixed + total_percent) > 100:
raise osv.except_osv(_('Error !'), _("You cannot create an invoice !\nAs you have defined payment term and so the total of invoice should be greater than the computed amount for journal entries using payment term"))
raise osv.except_osv(_('Error !'), _("Cannot create the invoice !\nThe payment term defined gives a computed amount greater than the total invoiced amount."))
# one move line per tax line
iml += ait_obj.move_line_get(cr, uid, inv.id)

View File

@ -13,7 +13,7 @@
</record>
<record id="sit" model="account.analytic.journal">
<field name="code">START</field>
<field name="name">Starting Balance</field>
<field name="name">Miscellaneous Operation</field>
<field name="type">situation</field>
</record>
</data>

View File

@ -8,7 +8,7 @@
<field name="type">tree</field>
<field eval="8" name="priority"/>
<field name="arch" type="xml">
<tree toolbar="1" colors="red:(date&lt;current_date);black:(date&gt;=current_date);black:(date==False)" string="Analytic account">
<tree toolbar="1" colors="red:(date&lt;current_date);black:(date&gt;=current_date);black:(date==False)" string="Analytic Accounts">
<field name="code"/>
<field name="complete_name"/>
<field name="quantity"/>
@ -25,10 +25,11 @@
<field name="arch" type="xml">
<search string="Analytic Account">
<group col="8" colspan="4">
<filter icon="terp-go-today" string="Overpassed Account" domain="[('date','&lt;',time.strftime('%%Y-%%m-%%d'))]" help="Overpassed Account"/>
<filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]" help="Pending Accounts"/>
<filter icon="terp-camera_test" string="Current" domain="[('state','=','open')]" help="Current Accounts"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today" string="Overdue Account" domain="[('date','&lt;',time.strftime('%%Y-%%m-%%d'))]" help="Analytic Accounts with a past deadline."/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="partner_id" select="1"/>
@ -36,11 +37,10 @@
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Parent" icon="terp-folder-orange" domain="[]" context="{'group_by':'parent_id'}"/>
<filter string="Type" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'type'}"/>
<separator orientation="vertical"/>
<filter string="Associated Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Manager" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Associated Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Parent" icon="terp-folder-orange" domain="[]" context="{'group_by':'parent_id'}"/>
</group>
</search>
</field>
@ -60,8 +60,11 @@
<field name="debit"/>
<field name="credit"/>
<field name="balance"/>
<field name="currency_id"/>
<field name="currency_id" groups="base.group_extended"/>
<field name="date" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
</tree>
</field>
</record>
@ -192,13 +195,14 @@
<field name="arch" type="xml">
<search string="Search Analytic Lines">
<group col='6' colspan='4'>
<filter string="Sale" domain="[('journal_id.type','=','sale')]" icon="terp-sale"/>
<filter string="Purchase" domain="[('journal_id.type','=','purchase')]" icon="terp-purchase"/>
<filter string="Sales" domain="[('journal_id.type','=','sale')]" icon="terp-sale" help="Analytic Journal Items related to a sale journal."/>
<filter string="Purchases" domain="[('journal_id.type','=','purchase')]" icon="terp-purchase" help="Analytic Journal Items related to a purchase journal."/>
<separator orientation="vertical"/>
<filter icon="terp-go-today" string="Overdue Accounts" domain="[('account_id.date','&lt;',time.strftime('%%Y-%%m-%%d'))]" help="Analytic Journal Items related to accounts having a past deadline."/>
<separator orientation="vertical"/>
<field name="date" select="1"/>
<field name="name" select="1"/>
<field name="account_id" select="1" groups="base.group_extended"/>
<field name="account_id" select="1"/>
<field name="user_id" widget="selection"/>
</group>
<newline/>

View File

@ -32,7 +32,6 @@ import account_aged_partner_balance
import tax_report
import account_tax_code
import account_balance_landscape
import compare_account_balance
import account_invoice_report
import account_report
import account_entries_report

View File

@ -35,6 +35,7 @@ class analytic_entries_report(osv.osv):
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'user_id' : fields.many2one('res.users', 'User',readonly=True),
'name': fields.char('Description', size=64, readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner'),
'company_id': fields.many2one('res.company', 'Company', required=True),
'currency_id': fields.many2one('res.currency', 'Currency', required=True),
'account_id': fields.many2one('account.analytic.account', 'Account', required=True),
@ -44,8 +45,7 @@ class analytic_entries_report(osv.osv):
'product_id': fields.many2one('product.product', 'Product', required=True),
'product_uom_id': fields.many2one('product.uom', 'Product UOM', required=True),
'amount': fields.float('Amount', readonly=True),
'unit_amount': fields.float('Unit Amount', readonly=True),
'amount_currency': fields.float('Amount Currency', readonly=True),
'unit_amount': fields.float('Quantity', readonly=True),
'nbr': fields.integer('#Entries', readonly=True),
}
def init(self, cr):
@ -61,6 +61,7 @@ class analytic_entries_report(osv.osv):
to_char(a.create_date, 'YYYY-MM-DD') as day,
a.user_id as user_id,
a.name as name,
analytic.partner_id as partner_id,
a.company_id as company_id,
a.currency_id as currency_id,
a.account_id as account_id,
@ -70,12 +71,12 @@ class analytic_entries_report(osv.osv):
a.product_id as product_id,
a.product_uom_id as product_uom_id,
sum(a.amount) as amount,
sum(a.unit_amount) as unit_amount,
sum(a.amount_currency) as amount_currency
sum(a.unit_amount) as unit_amount
from
account_analytic_line a
account_analytic_line a, account_analytic_account analytic
where analytic.id = a.account_id
group by
a.create_date, a.user_id,a.name,company_id,a.currency_id,
a.create_date, a.user_id,a.name,analytic.partner_id,a.company_id,a.currency_id,
a.account_id,a.general_account_id,a.journal_id,
a.move_id,a.product_id,a.product_uom_id
)

View File

@ -13,6 +13,7 @@
<field name="month" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="name" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
<field name="currency_id" invisible="1"/>
<field name="account_id" invisible="1"/>
@ -21,9 +22,8 @@
<field name="product_id" invisible="1"/>
<field name="product_uom_id" invisible="1"/>
<field name="nbr" sum="Entries"/>
<field name="unit_amount" sum="Quantity"/>
<field name="amount" sum="Amount"/>
<field name="unit_amount" sum="Unit Amount"/>
<field name="amount_currency" sum="Amount Currency"/>
</tree>
</field>
</record>
@ -48,8 +48,10 @@
domain="[('day','&lt;=', time.strftime('%%Y-%%m-%%d')), ('day','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Analytic Entries during last 7 days"/>
<separator orientation="vertical"/>
<field name="date" />
<field name="account_id" />
<field name="product_id" />
<field name="user_id" widget="selection">
<field name="user_id">
<filter icon="terp-personal" domain="[('user_id','=',uid)]" help="My Entries"/>
</field>
</group>
@ -67,18 +69,18 @@
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
<filter string="Currency" icon="terp-dolar" context="{'group_by':'currency_id'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Account" icon="terp-folder-orange" context="{'group_by':'account_id'}"/>
<filter string="General Account" icon="terp-folder-orange" context="{'group_by':'general_account_id'}"/>
<filter string="Account" name="Account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>
<filter string="General Account" icon="terp-folder-green" context="{'group_by':'general_account_id'}"/>
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter string="Product UOM" icon="terp-mrp" context="{'group_by':'product_uom_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Month" name="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
</group>
</search>
@ -91,9 +93,8 @@
<field name="arch" type="xml">
<graph string="Analytic Entries Analysis" type="bar">
<field name="user_id"/>
<field name="amount" operator="+"/>
<field name="unit_amount" operator="+"/>
<field name="amount_currency" operator="+"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
@ -102,7 +103,7 @@
<field name="res_model">analytic.entries.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_month':1, 'group_by_no_leaf':1, 'search_default_Account':1, 'search_default_Month':1, 'group_by':[]}</field>
<field name="search_view_id" ref="view_analytic_entries_report_search"/>
<field name="help">A tool search lets you know statistics on your analytics records that match your needs.</field>
</record>

View File

@ -50,6 +50,7 @@ class account_entries_report(osv.osv):
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'product_uom_id': fields.many2one('product.uom', 'Product UOM', readonly=True),
'move_state': fields.selection([('draft','Unposted'), ('posted','Posted')], 'State', readonly=True),
'move_line_state': fields.selection([('draft','Unbalanced'), ('valid','Valid')], 'State of Move Line', readonly=True),
'reconcile_id': fields.many2one('account.move.reconcile', readonly=True),
@ -73,7 +74,7 @@ class account_entries_report(osv.osv):
}
_order = 'date desc'
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
for arg in args:
@ -90,7 +91,7 @@ class account_entries_report(osv.osv):
args.remove(a)
return super(account_entries_report, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order,
context=context, count=count)
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None):
todel=[]
for arg in domain:
@ -108,7 +109,7 @@ class account_entries_report(osv.osv):
if a in domain:
domain.remove(a)
return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context)
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_entries_report')
cr.execute("""
@ -127,6 +128,7 @@ class account_entries_report(osv.osv):
to_char(am.date, 'YYYY-MM-DD') as day,
l.partner_id as partner_id,
l.product_id as product_id,
l.product_uom_id as product_uom_id,
am.company_id as company_id,
am.journal_id as journal_id,
p.fiscalyear_id as fiscalyear_id,

View File

@ -12,7 +12,7 @@
<field name="date_maturity" invisible="1"/>
<field name="ref" invisible="1"/>
<field name="nbr" sum="# of Entries "/>
<field name="quantity" sum="# of Products Qty "/>
<field name="quantity" sum="# of Products Qty " invisible="not context.get('quantity_visible', False)"/>
<field name="amount_currency" invisible="not context.get('amount_currency_visible', False)"/>
<field name="currency_id" invisible="not context.get('currency_id_visible', False)"/>
<field name="debit"/>
@ -24,6 +24,7 @@
<field name="year" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_uom_id" invisible="1"/>
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
<field name="journal_id" invisible="1"/>
<field name="account_id" invisible="1"/>
@ -90,7 +91,7 @@
<group expand="1" string="Group By...">
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':['product_id','product_uom_id'], 'quantity_visible':1}"/>
<separator orientation="vertical"/>
<filter string="Currency" name="group_currency" icon="terp-dolar" context="{'group_by':'currency_id', 'currency_id_visible':1, 'amount_currency_visible':1}"/>
<filter string="Journal" name="group_journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
@ -113,7 +114,7 @@
<field name="res_model">account.entries.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'group_by':[],'search_default_usertype':1, 'search_default_thisyear':1, 'group_by_no_leaf':1,}</field>
<field name="context">{'group_by':[], 'search_default_usertype':1, 'search_default_thisyear':1, 'group_by_no_leaf':1}</field>
<field name="help">A tool search lets you know statistics on your different financial accounts that match your needs.</field>
</record>
<menuitem action="action_account_entries_report_all" id="menu_action_account_entries_report_all" parent="account.menu_finance_statistic_report_statement" sequence="2"/>

View File

@ -72,6 +72,7 @@ class account_invoice_report(osv.osv):
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',readonly=True),
'residual': fields.float('Total Residual', readonly=True),
'delay_to_pay': fields.float('Avg. Delay To Pay', readonly=True, group_operator="avg"),
'due_delay': fields.float('Avg. Due Delay', readonly=True, group_operator="avg"),
}
_order = 'date desc'
def init(self, cr):
@ -134,6 +135,11 @@ class account_invoice_report(osv.osv):
left join account_invoice as a ON (a.move_id=aml.move_id)
left join account_invoice_line as l ON (a.id=l.invoice_id)
where a.id=ai.id)) as delay_to_pay,
sum((select extract(epoch from avg(date_trunc('day',a.date_due)-date_trunc('day',a.date_invoice)))/(24*60*60)::decimal(16,2)
from account_move_line as aml
left join account_invoice as a ON (a.move_id=aml.move_id)
left join account_invoice_line as l ON (a.id=l.invoice_id)
where a.id=ai.id)) as due_delay,
(case when ai.type in ('out_refund','in_invoice') then
ai.residual * -1
else
@ -145,7 +151,7 @@ class account_invoice_report(osv.osv):
left join account_invoice as ai ON (ai.id=ail.invoice_id)
left join product_template pt on (pt.id=ail.product_id)
left join product_uom u on (u.id=ail.uos_id),
res_currency_rate cr
res_currency_rate cr
where cr.id in (select id from res_currency_rate cr2 where (cr2.currency_id = ai.currency_id)
and ((ai.date_invoice is not null and cr.name <= ai.date_invoice) or (ai.date_invoice is null and cr.name <= NOW())) limit 1)
group by ail.product_id,

View File

@ -34,6 +34,7 @@
<field name="price_total" sum="Total Without Tax"/>
<field name="price_total_tax" sum="Total With Tax"/>
<field name="residual" sum="Total Residual" invisible="context.get('residual_invisible',False)"/>
<field name="due_delay" sum="Avg. Due Delay" invisible="context.get('residual_invisible',False)"/>
<field name="delay_to_pay" sum="Avg. Delay To Pay" invisible="context.get('residual_invisible',False)"/>
</tree>
</field>

View File

@ -1,397 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import locale
from report import report_sxw
#from addons.account.wizard import wizard_account_balance_report
parents = {
'tr':1,
'li':1,
'story': 0,
'section': 0
}
class account_balance(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_balance, self).__init__(cr, uid, name, context=context)
self.flag=1
self.dr_total= 0.00
self.cr_total= 0.00
self.parent_bal=0
self.status=0
self.done_total=0
self.baldiv={}
self.empty_parent=0
self.result_total = {}
self.total_for_perc=[]
self.localcontext.update({
'time': time,
'lines': self.lines,
'get_lines':self.get_lines,
'linesForTotal': self.linesForTotal,
'linesForYear': self.linesForYear,
'get_years':self.get_years,
'cal_total':self.cal_total,
'total_dr':self.total_dr,
'total_cr':self.total_cr
})
self.context = context
def linesForYear(self, form):
temp=0
years={}
global pattern
global show
global perc
global bal_zero
global ref_bal
pattern=form['compare_pattern']
if form['show_columns']!=1:
show=0
else:
show=form['show_columns']
if form['format_perc']!=1:
perc=0
else:
perc=form['format_perc']
if form['account_choice']=='bal_zero':
bal_zero=0
else:
bal_zero=1
ctx = self.context.copy()
if perc==1:
if form['select_account']!=False:
ref_ac=self.pool.get('account.account').browse(self.cr, self.uid, form['select_account'], ctx.copy())
if ref_ac.balance<>0.00:
ref_bal=ref_ac.balance
else:
ref_bal=1.00
else:
ref_bal='nothing'
else:
ref_bal='nothing'
total_for_perc=[]
self.done_total=1
self.total_for_perc=self.linesForTotal(form, ids={}, doneAccount={}, level=1)
self.done_total=0
for t1 in range(0,len(form['fiscalyear'])):
locale.setlocale(locale.LC_ALL, '')
self.result_total["sum_credit" + str(t1)]=locale.format("%.2f", self.result_total["sum_credit" + str(t1)], grouping=True)
self.result_total["sum_debit" + str(t1)]=locale.format("%.2f", self.result_total["sum_debit" + str(t1)], grouping=True)
for temp in range(0,len(form['fiscalyear'])):
fy=self.pool.get('account.fiscalyear').name_get(self.cr, self.uid, form['fiscalyear'][temp])
years["year"+str(temp)]=fy[0][1][12:16]
return [years]
def linesForTotal(self, form, ids={}, doneAccount={}, level=1):
if self.done_total==1:
self.done_total==1
else:
return [self.result_total]
accounts=[]
if not ids:
ids = self.ids
if not ids:
return []
ctx = self.context.copy()
result_total_parent=[]
for id in form['fiscalyear']:
tmp=[]
ctx['fiscalyear'] = id
ctx['periods'] = form['periods']
ctx['period_manner'] = form['period_manner']
ctx['state'] = form['context'].get('state','all')
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
if len(tmp):
accounts.append(tmp)
merged_accounts=zip(*accounts)
# used to check for the frst record so all sum_credit and sum_debit r set to 0.00
if level==1:
doneAccount={}
for entry in merged_accounts:
if entry[0].id in doneAccount:
continue
doneAccount[entry[0].id] = 1
for k in range(0,len(entry)):
temp_credit=0.00
temp_debit=0.00
if entry[0].type <> 'view':
temp_credit+=entry[k].credit
temp_debit+=entry[k].debit
if self.flag==1:
self.result_total["sum_credit" + str(k)]=0.00
self.result_total["sum_debit" + str(k)]=0.00
if form['account_choice']=='bal_zero':
if temp_credit<>temp_debit:
self.result_total["sum_credit" + str(k)]+=temp_credit
self.result_total["sum_debit" + str(k)]+=temp_debit
else:
self.result_total["sum_credit" + str(k)]+=temp_credit
self.result_total["sum_debit" + str(k)]+=temp_debit
self.flag=2
if entry[0].child_id:
ids2 = [(x.code,x.id) for x in entry[0].child_id]
ids2.sort()
result_total_parent = self.linesForTotal(form, [x[1] for x in ids2], doneAccount, level+1)
return [self.result_total]
def lines(self, form, ids={}, done={}, level=1):
accounts=[]
if not ids:
ids = self.ids
if not ids:
return []
result = []
ctx = self.context.copy()
tmp1=[]
for id in form['fiscalyear']:
ctx['fiscalyear'] = id
ctx['periods'] = form['periods']
ctx['period_manner']=form['period_manner']
ctx['state'] = form['context'].get('state','all')
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
if len(tmp1):
accounts.append(tmp1)
if level==1: #if parent is called,done is not empty when called again.
done={}
def cmp_code(x, y):
return cmp(x.code, y.code)
for n in range(0,len(accounts)):
accounts[n].sort(cmp_code)
common={}
merged_accounts=zip(*accounts)
for entry in merged_accounts:
j=0
checked=1
if form['account_choice']!='all': # if checked,include empty a/c;not otherwise
checked=0
if entry[0].id in done:
continue
done[entry[0].id] = 1
if entry[0].child_id: # this is for parent account,dont check 0 for it
checked=4
self.status=1 # for displaying it Bold
else:
self.status=0
if checked==0:
i=0
for i in range(0,len(entry)):
if bal_zero==0:
if entry[i].balance<>0.0:
checked=4
break
else:
checked=3
i=i+1
else:
if entry[i].credit <> 0.0 or entry[i].debit <> 0.0:
checked=4
break
else:
checked=3
i=i+1
if checked==3:
# this is the point where we skip those accounts which are encountered as empty ones
continue
self.empty_parent=0
else:
self.empty_parent=1
res = {
'code': entry[0].code,
'name': entry[0].name,
'level': level,
'status': self.status,
}
for j in range(0,len(entry)):
locale.setlocale(locale.LC_ALL, '')
res["debit"+str(j)]=locale.format("%.2f", entry[j].debit, grouping=True)
res["credit"+str(j)]=locale.format("%.2f", entry[j].credit, grouping=True)
res["balance"+str(j)]=locale.format("%.2f", entry[j].balance, grouping=True)
if j==0:
res["bal_cash"+str(j)]="0.00"
res["bal_perc"+str(j)]="0.00%"
else:
temp_cash=entry[j].balance - entry[j-1].balance
res["bal_cash"+str(j)]=locale.format("%.2f", temp_cash, grouping=True)
if entry[j-1].balance<>0.00:
temp_perc=(entry[j].balance - entry[j-1].balance )*100/entry[j-1].balance
else:
temp_perc=(entry[j].balance) *100
res["bal_perc"+str(j)]=locale.format("%.2f", temp_perc) + "%"
if ref_bal=='nothing':
if level==1:
self.parent_bal=1
else:
self.parent_bal=0
if self.parent_bal==1:
res["balance_perc"+str(j)]="/"
else:
if entry[j].balance==0.00:
if self.baldiv["baldiv"+str(level-1)+str(j)]<>0.00:
res["balance_perc"+str(j)]="0.00%"
else:
res["balance_perc"+str(j)]="/"
else:
if self.baldiv["baldiv"+str(level-1)+str(j)]<>0.00:
temp=self.baldiv["baldiv"+str(level-1)+str(j)]
temp1=(entry[j].balance * 100 )/ float(temp)
temp1=round(temp1,2)
res["balance_perc" + str(j)]=str(temp1)+"%"
else:
res["balance_perc"+str(j)]="/"
else:
res["balance_perc"+str(j)]=str( (entry[j].balance * 100 )/ float(ref_bal)) + "%"
result.append(res)
if entry[0].child_id:
for q in range(0,len(form['fiscalyear'])):
self.baldiv["baldiv"+str(level)+str(q)]=entry[q].balance
ids2 = [(x.code,x.id) for x in entry[0].child_id]
ids2.sort()
dir=[]
dir += self.lines(form, [x[1] for x in ids2], done, level+1)
if dir==[]:
for w in range(0,len(form['fiscalyear'])):
if entry[w].credit <> 0.0 or entry[w].debit <> 0.0 or entry[w].balance<>0.00:
dont_pop=1
break
else:
dont_pop=0
if dont_pop==1:
result +=dir
else:
result.pop(-1) # here we pop up the parent having its children as emprty accounts
else:
result +=dir
return result
def get_years(self, form):
result =[]
res={}
for temp in range(0,len(form['fiscalyear'])):
res={}
fy=self.pool.get('account.fiscalyear').name_get(self.cr, self.uid, form['fiscalyear'][temp])
res['year']=fy[0][1]
res['last_str']=temp
result.append(res)
self.linesForYear(form)
return result
def get_lines(self, year_dict, form):
final_result = []
line_l =[]
res = {}
line_l = self.lines(form)
self.cal_total(year_dict)
if line_l:
for l in line_l:
res = {}
res['code'] = l['code']
res['name'] = l['name']
res['level'] = l['level']
for k,v in l.items():
if k.startswith('debit'+str(year_dict['last_str'])):
res['debit'] = v
if k.startswith('credit'+str(year_dict['last_str'])):
res['credit'] = v
if k.startswith('balance'+str(year_dict['last_str'])) and not k.startswith('balance_perc'+str(year_dict['last_str'])):
res['balance'] =v
if k.startswith('balance_perc'+str(year_dict['last_str'])) and not k.startswith('balance'+str(year_dict['last_str'])):
res['balance_perc'] = v
if form['compare_pattern'] == 'bal_perc':
if k.startswith('bal_perc'+str(year_dict['last_str'])):
res['pattern'] = v
elif form['compare_pattern'] == 'bal_cash':
if k.startswith('bal_cash'+str(year_dict['last_str'])):
res['pattern'] = v
else:
res['pattern'] = ''
final_result.append(res)
return final_result
def cal_total(self, year_dict):
total_l = self.result_total
if total_l:
for k,v in total_l.items():
if k.startswith('sum_debit'+str(year_dict['last_str'])):
self.dr_total = v
elif k.startswith('sum_credit'+str(year_dict['last_str'])):
self.cr_total = v
else:
continue
return True
def total_dr(self):
return self.dr_total
def total_cr(self):
return self.cr_total
report_sxw.report_sxw('report.account.balance.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header="internal")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,427 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Account Balance" 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="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_Tiltle">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_header_account_a">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/>
<blockBackground colorName="#ffffff" start="3,0" stop="3,-1"/>
<blockBackground colorName="#ffffff" start="4,0" stop="4,-1"/>
<blockBackground colorName="#ffffff" start="5,0" stop="5,-1"/>
<blockBackground colorName="#ffffff" start="6,0" stop="6,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_header_account">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/>
<blockBackground colorName="#ffffff" start="3,0" stop="3,-1"/>
<blockBackground colorName="#ffffff" start="4,0" stop="4,-1"/>
<blockBackground colorName="#ffffff" start="5,0" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1a">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/>
<blockBackground colorName="#ffffff" start="3,0" stop="3,-1"/>
<blockBackground colorName="#ffffff" start="4,0" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/>
<blockBackground colorName="#ffffff" start="3,0" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6a">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/>
<blockBackground colorName="#ffffff" start="3,0" stop="3,-1"/>
<blockBackground colorName="#ffffff" start="4,0" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3a">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/>
<blockBackground colorName="#ffffff" start="3,0" stop="3,-1"/>
<blockBackground colorName="#ffffff" start="4,0" stop="4,-1"/>
<blockBackground colorName="#ffffff" start="5,0" stop="5,-1"/>
<blockBackground colorName="#ffffff" start="6,0" stop="6,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<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_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" 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_space" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">[[ repeatIn(get_years(data['form']), 'y') ]]</para>
<blockTable colWidths="482.0" style="Table_Tiltle">
<tr>
<td>
<para style="terp_header_Centre">Account Balance - [[ company.currency_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_header">Year : [[ y['year'] ]]</para>
<blockTable colWidths="57.0,180.0,69.0,57.0,57.0,60.0" style="Table_header_account">
<tr>
<td>
<para style="terp_tblheader_Details">[[ (data['form']['show_columns'] and not data['form']['format_perc']) and 'Code' or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details">Account Name </para>
</td>
<td>
<para style="terp_tblheader_Details">[[ data['form']['compare_pattern']!='none' and 'C.S.Y.T.(C./P)' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Debit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Credit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="40.0,154.0,60.0,61.0,61.0,61.0,45.0" style="Table_header_account_a">
<tr>
<td>
<para style="terp_tblheader_Details">[[ (data['form']['show_columns'] and data['form']['format_perc']) and 'Code' or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details">Account Name </para>
</td>
<td>
<para style="terp_tblheader_Details">[[ data['form']['compare_pattern']!='none' and 'C.S.Y.T.(C./P)' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Debit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Credit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
<td>
<para style="terp_tblheader_Details_Right"></para>
</td>
</tr>
</blockTable>
<blockTable colWidths="56.0,290.0,76.0,58.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_Details">[[ (not data['form']['show_columns'] and not data['form']['format_perc']) and 'Code' or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details">Account Name </para>
</td>
<td>
<para style="terp_tblheader_Details">[[ data['form']['compare_pattern']!='none' and 'C.S.Y.T.(C./P)' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="66.0,205.0,90.0,70.0,60.0" style="Table1a">
<tr>
<td>
<para style="terp_tblheader_Details">[[ (not data['form']['show_columns'] and data['form']['format_perc']) and 'Code' or removeParentNode('blockTable') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details">Account Name </para>
</td>
<td>
<para style="terp_tblheader_Details">[[ data['form']['compare_pattern']!='none' and 'C.S.Y.T.(C./P)' or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
<td>
<para style="terp_tblheader_Details_Right"></para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_8">[[ repeatIn(get_lines(y,data['form']), 'a') ]]</para>
<blockTable colWidths="57.0,180.0,69.0,57.0,57.0,60.0" style="Table4">
<tr>
<td>
<para style="terp_default_9">[[ (data['form']['format_perc'] or not data['form']['show_columns']) and removeParentNode('blockTable') ]] <font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['code'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font face="Helvetica" color="white">[['...'*(a['level']-1) ]]</font> <font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['name'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['pattern'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['debit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['credit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['balance'] ]] [[company.currency_id.symbol]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="40.0,154.0,60.0,61.0,61.0,61.0,45.0" style="Table2">
<tr>
<td>
<para style="terp_default_9">[[ (not data['form']['format_perc'] or not data['form']['show_columns']) and removeParentNode('blockTable') ]] <font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['code'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font face="Helvetica" color="white">[['...'*(a['level']-1) ]]</font> <font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['name'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['pattern'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['debit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['credit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['balance'] ]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['balance_perc'] ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="56.0,290.0,76.0,58.0" style="Table6">
<tr>
<td>
<para style="terp_default_9">[[ (data['form']['format_perc'] or data['form']['show_columns']) and removeParentNode('blockTable') ]] <font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['code'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font face="Helvetica" color="white">[['...'*(a['level']-1) ]]</font> <font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['name'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['pattern'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['balance'] ]] [[company.currency_id.symbol]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="66.0,205.0,90.0,70.0,60.0" style="Table6a">
<tr>
<td>
<para style="terp_default_9">[[ (not data['form']['format_perc'] or data['form']['show_columns']) and removeParentNode('blockTable') ]]<font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font> [[ a['code'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font face="Helvetica" color="white">[['...'*(a['level']-1) ]]</font> <font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['name'] ]]</para>
</td>
<td>
<para style="terp_default_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font')]]</font>[[ a['pattern'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['balance'] ]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_default_Right_9"><font>[[ a['level']&lt;4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font')]]</font>[[ a['balance_perc'] ]]</para>
</td>
</tr>
</blockTable>
</section>
<blockTable colWidths="57.0,249.0,57.0,57.0,60.0" style="Table3">
<tr>
<td>
<para style="terp_default_9">[[ (data['form']['show_columns'] and not data['form']['format_perc']) or removeParentNode('blockTable') ]] </para>
</td>
<td>
<para style="terp_tblheader_Details">Total :</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ total_dr() ]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ total_cr() ]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="40.0,154.0,60.0,61.0,61.0,61.0,45.0" style="Table3a">
<tr>
<td>
<para style="terp_default_9">[[ (not data['form']['show_columns'] or not data['form']['format_perc']) and removeParentNode('blockTable') ]] </para>
</td>
<td>
<para style="terp_tblheader_Details">Total :</para>
</td>
<td>
<para style="terp_default_space">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ total_dr() ]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ total_cr() ]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="terp_default_space">
<font color="white"> </font>
</para>
<para style="terp_tblheader_Details">[[ data['form']['compare_pattern']!='none' and "C.S.Y.T.(C./P) : Compare Selected Years In Terms of Cash/Perc" or removeParentNode('font') ]]</para>
</story>
</document>

View File

@ -19,7 +19,7 @@
<record id="menu_finance_reporting" model="ir.ui.menu">
<field eval="[(6,0,[ref('group_account_manager')])]" name="groups_id"/>
<field eval="[(6,0,[ref('group_account_manager'), ref('analytic.group_analytic_accounting')])]" name="groups_id"/>
</record>
<record id="menu_finance_legal_statement" model="ir.ui.menu">
@ -35,7 +35,7 @@
</record>
<record id="menu_finance_charts" model="ir.ui.menu">
<field eval="[(6,0,[ref('group_account_user'), ref('group_account_manager')])]" name="groups_id"/>
<field eval="[(6,0,[ref('group_account_user'), ref('group_account_manager'), ref('analytic.group_analytic_accounting')])]" name="groups_id"/>
</record>
<record id="menu_eaction_account_moves_sale" model="ir.ui.menu">
@ -87,7 +87,7 @@
</record>
<record id="final_accounting_reports" model="ir.ui.menu">
<field eval="[(6,0,[ref('group_account_manager'),ref('base.group_system')])]" name="groups_id"/>
<field eval="[(6,0,[ref('group_account_manager'),ref('base.group_system'), ref('analytic.group_analytic_accounting')])]" name="groups_id"/>
</record>
<record id="menu_journals_report" model="ir.ui.menu">
@ -138,6 +138,22 @@
<field eval="[(6,0,[ref('group_account_manager')])]" name="groups_id"/>
</record>
<record id="menu_finance_generic_reporting" model="ir.ui.menu">
<field eval="[(6,0,[ref('analytic.group_analytic_accounting')])]" name="groups_id"/>
</record>
<record id="menu_finance_configuration" model="ir.ui.menu">
<field eval="[(6,0,[ref('analytic.group_analytic_accounting')])]" name="groups_id"/>
</record>
<record id="menu_finance_entries" model="ir.ui.menu">
<field eval="[(6,0,[ref('analytic.group_analytic_accounting')])]" name="groups_id"/>
</record>
<record id="menu_analytic_accounting" model="ir.ui.menu">
<field eval="[(6,0,[ref('analytic.group_analytic_accounting')])]" name="groups_id"/>
</record>
<record id="account_move_comp_rule" model="ir.rule">
<field name="name">Account Entry</field>
<field ref="model_account_move" name="model_id"/>

View File

@ -1,21 +1,21 @@
-
In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear "Fiscal Year 2011" to which the entries will move
In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear to which the entries will move
-
!record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
code: FY2011
code: !eval "'FY%s'% (datetime.now().year+1)"
company_id: base.main_company
date_start: '2011-01-01'
date_stop: '2011-12-31'
name: Fiscal Year 2011
date_start: !eval "'%s-01-01' %(datetime.now().year+1)"
date_stop: !eval "'%s-12-31' %(datetime.now().year+1)"
name: !eval "'Fiscal Year %s' %(datetime.now().year+1)"
-
I create a period "Jan2011" for the new fiscalyear
I create a period for the month of january for the new fiscalyear
-
!record {model: account.period, id: account_period_jan11}:
company_id: base.main_company
date_start: '2011-01-01'
date_stop: '2011-12-31'
date_start: !eval "'%s-01-01'% (datetime.now().year+1)"
date_stop: !eval "'%s-12-31'% (datetime.now().year+1)"
fiscalyear_id: account_fiscalyear_fiscalyear0
name: Jan2011
name: !eval "'Jan%s' %(datetime.now().year+1)"
special: 1
-
@ -25,6 +25,7 @@
name: End of Year
code: NEW
type: situation
analytic_journal_id: sit
sequence_id: sequence_journal
default_debit_account_id: cash
default_credit_account_id: cash
@ -90,7 +91,4 @@
# self.action_open_window(cr, uid, [ref("account_move_journal_2")], {"lang": 'en_US',
# "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_move_journal_line_form")],
# "tz": False, "active_id": ref("account.menu_action_move_journal_line_form"),
# })
# })

View File

@ -3,11 +3,11 @@
In order to check the Close a Fiscal Year wizard in OpenERP I first create a Fiscalyear
-
!record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
code: FY2011
code: !eval "'FY%s'% (datetime.now().year+1)"
company_id: base.main_company
date_start: '2011-01-01'
date_stop: '2011-12-31'
name: Fiscal Year 2011
date_start: !eval "'%s-01-01' %(datetime.now().year+1)"
date_stop: !eval "'%s-12-31' %(datetime.now().year+1)"
name: !eval "'Fiscal Year %s' %(datetime.now().year+1)"
-
I create monthly Periods for this fiscalyear
-

View File

@ -93,27 +93,6 @@
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'account-aged_partner_balance.'+format), 'wb+').write(data)
-
Print the Compare Account Balance Report in Normal mode
-
!python {model: account.account}: |
import netsvc, tools, os, time
data_dict = {'model': 'account.account', 'form': {'id':ref('account.bal'),'chart_account_id':ref('account.chart0'),'select_account': False,'format_perc':0,'show_columns' :0, 'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear': [ref('account.data_fiscalyear')] ,'target_move': 'all','periods': [],'context':{'state':'all'}}}
(data, format) = netsvc.LocalService('report.account.balance.account.balance').create(cr, uid, [ref('account.bal'),ref('account.gpf')], data_dict, {'periods': []})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'account-compare-account_balance.'+format), 'wb+').write(data)
-
Print the Compare Account Balance Report in Landscape mode
-
!python {model: account.account}: |
import netsvc, tools, os, time
data_dict = {'model': 'account.account', 'form': {'id':ref('account.bal'),'chart_account_id':ref('account.chart0'),'select_account': False,'format_perc':0,'show_columns' :0, 'compare_pattern': 'none','account_choice': 'moves','landscape':1,'period_manner': 'actual','fiscalyear': [ref('account.data_fiscalyear')] ,'target_move': 'all','periods': [],'context':{'state':'all'}}}
(data, format) = netsvc.LocalService('report.account.account.balance.landscape').create(cr, uid, [ref('account.bal'),ref('account.gpf')], data_dict, {'periods': []})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'account-compare-account_balance-landscape.'+format), 'wb+').write(data)
-
Print the Account Balance Sheet in Horizontal mode
-

View File

@ -44,7 +44,6 @@ import account_fiscalyear_close_state
import account_vat
import account_open_closed_fiscalyear
import account_compare_account_balance_report
import account_invoice_state
import account_chart
import account_tax_chart
@ -56,8 +55,6 @@ import account_use_model
import account_state_open
import account_statement_from_invoice
import account_report_print_journal
import account_report_central_journal
import account_report_general_journal

View File

@ -30,8 +30,7 @@ class account_automatic_reconcile(osv.osv_memory):
_description = 'Automatic Reconcile'
_columns = {
'account_ids': fields.many2many('account.account', 'reconcile_account_rel', 'reconcile_id', 'account_id', 'Accounts to Reconcile', domain = [('reconcile','=',1)], \
help = 'If no account is specified, the reconciliation will be made using every accounts that can be reconcilied'),
'account_ids': fields.many2many('account.account', 'reconcile_account_rel', 'reconcile_id', 'account_id', 'Accounts to Reconcile', domain = [('reconcile','=',1)],),
'writeoff_acc_id': fields.many2one('account.account', 'Account'),
'journal_id': fields.many2one('account.journal', 'Journal'),
'period_id': fields.many2one('account.period', 'Period'),
@ -142,25 +141,25 @@ class account_automatic_reconcile(osv.osv_memory):
if context is None:
context = {}
form = self.read(cr, uid, ids, [])[0]
max_amount = form.get('max_amount', 0.0)
max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0
power = form['power']
allow_write_off = form['allow_write_off']
reconciled = unreconciled = 0
if not form['account_ids']:
raise osv.except_osv(_('UserError'), _('You must select accounts to reconcile'))
for account_id in form['account_ids']:
params = (account_id,)
if not allow_write_off:
query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \
AND state <> 'draft' GROUP BY partner_id \
HAVING ABS(SUM(debit-credit)) = %s AND count(*)>0"%(account_id, 0.0)
# HAVING ABS(SUM(debit-credit)) <> %s AND count(*)>0"%(account_id, 0.0)
# HAVING count(*)>0"%(account_id,)
query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL
AND state <> 'draft' GROUP BY partner_id
HAVING ABS(SUM(debit-credit)) = 0.0 AND count(*)>0"""
else:
query = "SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL \
AND state <> 'draft' GROUP BY partner_id \
HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0"%(account_id, max_amount or 0.0)
query = """SELECT partner_id FROM account_move_line WHERE account_id=%s AND reconcile_id IS NULL
AND state <> 'draft' GROUP BY partner_id
HAVING ABS(SUM(debit-credit)) < %s AND count(*)>0"""
params += (max_amount,)
# reconcile automatically all transactions from partners whose balance is 0
cr.execute(query)
cr.execute(query, params)
partner_ids = [id for (id,) in cr.fetchall()]
for partner_id in partner_ids:
cr.execute(
@ -176,65 +175,63 @@ class account_automatic_reconcile(osv.osv_memory):
reconciled += len(line_ids)
if allow_write_off:
move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
# move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
else:
move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
# move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
# get the list of partners who have more than one unreconciled transaction
cr.execute(
"SELECT partner_id " \
"FROM account_move_line " \
"WHERE account_id=%s " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " \
"AND partner_id IS NOT NULL " \
"GROUP BY partner_id " \
"HAVING count(*)>1",
(account_id,))
partner_ids = [id for (id,) in cr.fetchall()]
#filter?
for partner_id in partner_ids:
# get the list of unreconciled 'debit transactions' for this partner
cr.execute(
"SELECT id, debit " \
"FROM account_move_line " \
"WHERE account_id=%s " \
"AND partner_id=%s " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " \
"AND debit > 0",
(account_id, partner_id))
debits = cr.fetchall()
# get the list of partners who have more than one unreconciled transaction
cr.execute(
"SELECT partner_id " \
"FROM account_move_line " \
"WHERE account_id=%s " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " \
"AND partner_id IS NOT NULL " \
"GROUP BY partner_id " \
"HAVING count(*)>1",
(account_id,))
partner_ids = [id for (id,) in cr.fetchall()]
#filter?
for partner_id in partner_ids:
# get the list of unreconciled 'debit transactions' for this partner
cr.execute(
"SELECT id, debit " \
"FROM account_move_line " \
"WHERE account_id=%s " \
"AND partner_id=%s " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " \
"AND debit > 0",
(account_id, partner_id))
debits = cr.fetchall()
# get the list of unreconciled 'credit transactions' for this partner
cr.execute(
"SELECT id, credit " \
"FROM account_move_line " \
"WHERE account_id=%s " \
"AND partner_id=%s " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " \
"AND credit > 0",
(account_id, partner_id))
credits = cr.fetchall()
# get the list of unreconciled 'credit transactions' for this partner
cr.execute(
"SELECT id, credit " \
"FROM account_move_line " \
"WHERE account_id=%s " \
"AND partner_id=%s " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " \
"AND credit > 0",
(account_id, partner_id))
credits = cr.fetchall()
(rec, unrec) = self.do_reconcile(cr, uid, credits, debits, max_amount, power, form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
reconciled += rec
unreconciled += unrec
(rec, unrec) = self.do_reconcile(cr, uid, credits, debits, max_amount, power, form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
reconciled += rec
unreconciled += unrec
# add the number of transactions for partners who have only one
# unreconciled transactions to the unreconciled count
partner_filter = partner_ids and 'AND partner_id not in (%s)' % ','.join(map(str, filter(None, partner_ids))) or ''
cr.execute(
"SELECT count(*) " \
"FROM account_move_line " \
"WHERE account_id=%s " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " + partner_filter,
(account_id,))
additional_unrec = cr.fetchone()[0]
unreconciled = unreconciled + additional_unrec
# add the number of transactions for partners who have only one
# unreconciled transactions to the unreconciled count
partner_filter = partner_ids and 'AND partner_id not in (%s)' % ','.join(map(str, filter(None, partner_ids))) or ''
cr.execute(
"SELECT count(*) " \
"FROM account_move_line " \
"WHERE account_id=%s " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " + partner_filter,
(account_id,))
additional_unrec = cr.fetchone()[0]
unreconciled = unreconciled + additional_unrec
context.update({'reconciled': reconciled, 'unreconciled': unreconciled})
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','account_automatic_reconcile_view1')])
resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
@ -250,4 +247,4 @@ class account_automatic_reconcile(osv.osv_memory):
account_automatic_reconcile()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,135 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import osv, fields
from tools.translate import _
class account_compare_account_balance_report(osv.osv_memory):
"""
This wizard will provide the account balance comparision report by fiscal years.
"""
_name = 'account.compare.account.balance.report'
_description = 'Account Balance Report'
_columns = {
'fiscalyear': fields.many2many('account.fiscalyear', 'account_fiscalyear_rel','account_id','fiscalyear_id','Fiscal year', help='Keep empty for all open fiscal year'),
'select_account': fields.many2one('account.account','Select Reference Account(for % comparision)',help='Keep empty for comparison to its parent'),
'account_choice': fields.selection([('all','All accounts'),
('bal_zero','With balance is not equal to 0'),
('moves','With movements')],'Show Accounts'),
'show_columns': fields.boolean('Show Debit/Credit Information'),
'landscape': fields.boolean('Show Report in Landscape Form'),
'format_perc': fields.boolean('Show Comparision in %'),
'compare_pattern': fields.selection([('bal_cash','Cash'),
('bal_perc','Percentage'),
('none','Don'+ "'" +'t Compare')],'Compare Selected Years In Terms Of'),
'period_manner': fields.selection([('actual','Financial Period'),('created','Creation Date')],'Entries Selection Based on'),
'periods': fields.many2many('account.period', 'period_account_balance_rel',
'report_id', 'period_id', 'Periods',
help='Keep empty for all open fiscal year'),
}
_defaults={
'compare_pattern': 'none',
'account_choice': 'moves',
'period_manner': 'actual',
}
def check(self, cr, uid, ids, context=None):
data={}
if context is None:
context = {}
data = {
'ids':context['active_ids'],
'form': self.read(cr, uid, ids, ['fiscalyear', 'select_account', 'account_choice', 'periods', 'show_columns', 'landscape', 'format_perc','compare_pattern','period_manner'])[0],
}
data['form']['context'] = context
if (len(data['form']['fiscalyear'])==0) or (len(data['form']['fiscalyear'])>1 and (data['form']['compare_pattern']!='none') and (data['form']['format_perc']==1) and (data['form']['show_columns']==1) and (data['form']['landscape']!=1)):
raise osv.except_osv(_('Warning !'), _('You have to select at least 1 Fiscal Year. \nYou may have selected the compare options with more than 1 year with credit/debit columns and % option.This can lead contents to be printed out of the paper.Please try again.'))
if ((len(data['form']['fiscalyear'])==3) and (data['form']['format_perc']!=1) and (data['form']['show_columns']!=1)):
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balance.account.balance',
'datas': data,
}
if data['form']['format_perc']==1:
if len(data['form']['fiscalyear'])<=2:
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balance.account.balance',
'datas': data,
}
else:
if len(data['form']['fiscalyear'])==3:
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
else:
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
else:
if len(data['form']['fiscalyear'])>2:
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
raise osv.except_osv(_('Warning !'), _('You might have done following mistakes. Please correct them and try again. \n 1. You have selected more than 3 years in any case. \n 2. You have not selected Percentage option, but you have selected more than 2 years. \n You can select maximum 3 years. Please check again. \n 3. You have selected Percentage option with more than 2 years, but you have not selected landscape format. You have to select Landscape option. Please Check it.'))
else:
if data['form']['landscape']==1:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.account.balance.landscape',
'datas': data,
}
else:
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.balance.account.balance',
'datas': data,
}
account_compare_account_balance_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="account_compare_account_balance_report_view" model="ir.ui.view">
<field name="name">account.compare.account.balance.report.form</field>
<field name="model">account.compare.account.balance.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Customize Report">
<notebook tabpos="up">
<page string="Report Options">
<separator string="Select Fiscal Year(s)(Maximum Three Years)" colspan="4"/>
<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
<field name="fiscalyear" colspan="5" nolabel="1"/>
<field name="landscape" colspan="4"/>
<field name="show_columns" colspan="4"/>
<field name="format_perc" colspan="4"/>
<field name="select_account" colspan="4"/>
<field name="account_choice" colspan="4"/>
<field name="compare_pattern" colspan="4"/>
</page>
<page string="Select Period">
<field name="period_manner" colspan="4"/>
<separator string="Select Period(s)" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</page>
</notebook>
<newline/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</form>
</field>
</record>
<act_window name="Account balance-Compare Years"
res_model="account.compare.account.balance.report"
src_model="account.account"
view_mode="form"
target="new"
key2="client_print_multi"
id="action_view_account_compare_account_balance_report"/>
</data>
</openerp>

View File

@ -45,7 +45,7 @@ class account_invoice_refund(osv.osv_memory):
context = {}
journal = obj_journal.search(cr, uid, [('type', '=', 'sale_refund')])
if context.get('type', False):
if context['type'] == 'in_invoice':
if context['type'] in ('in_invoice', 'in_refund'):
journal = obj_journal.search(cr, uid, [('type', '=', 'purchase_refund')])
return journal and journal[0] or False
@ -55,6 +55,20 @@ class account_invoice_refund(osv.osv_memory):
'filter_refund': 'modify',
}
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
journal_obj = self.pool.get('account.journal')
res = super(account_invoice_refund,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
type = context.get('journal_type', 'sale_refund')
if type in ('sale', 'sale_refund'):
type = 'sale_refund'
else:
type = 'purchase_refund'
for field in res['fields']:
if field == 'journal_id':
journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type)], context=context, limit=None, name_get_uid=1)
res['fields'][field]['selection'] = journal_select
return res
def compute_refund(self, cr, uid, ids, mode='refund', context=None):
"""
@param cr: the current row, from the database cursor,

View File

@ -11,7 +11,7 @@
<separator string="Refund Invoice Options" colspan="4"/>
<group colspan="4" >
<field name="description"/>
<field name="journal_id"/>
<field name="journal_id" widget='selection'/>
<field name="date"/>
<field name="period"/>
<field name="filter_refund"/>

View File

@ -85,7 +85,19 @@ class account_move_line_reconcile(osv.osv_memory):
ids = self.pool.get('account.period').find(cr, uid, dt=date, context=context)
if len(ids):
period_id = ids[0]
context.update({'stop_reconcile': True})
#stop the reconciliation process by partner (manual reconciliation) only if there is nothing more to reconcile for this partner
if 'active_ids' in context and context['active_ids']:
tmp_ml_id = account_move_line_obj.browse(cr, uid, context['active_ids'], context)[0]
partner_id = tmp_ml_id.partner_id and tmp_ml_id.partner_id.id or False
debit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('debit', '>', 0)], context=context)
credit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('credit', '>', 0)], context=context)
for ml_id in context['active_ids']:
if ml_id in debit_ml_ids:
debit_ml_ids.remove(ml_id)
if ml_id in credit_ml_ids:
credit_ml_ids.remove(ml_id)
if not (len(debit_ml_ids) and len(credit_ml_ids)):
context.update({'stop_reconcile': True})
account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
period_id, journal_id, context=context)
return {}

View File

@ -28,14 +28,18 @@ class account_partner_reconcile_process(osv.osv_memory):
_description = 'Reconcilation Process partner by partner'
def _get_to_reconcile(self, cr, uid, context=None):
cr.execute(
"SELECT l.partner_id " \
"FROM account_move_line AS l LEFT JOIN res_partner p ON (p.id = l.partner_id) " \
"WHERE l.reconcile_id IS NULL " \
"AND (%s > to_char(p.last_reconciliation_date, 'YYYY-MM-DD') " \
"OR p.last_reconciliation_date IS NULL ) " \
"AND l.state <> 'draft' " \
"GROUP BY l.partner_id ",(time.strftime('%Y-%m-%d'),)
cr.execute("""
SELECT p_id FROM (SELECT l.partner_id as p_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
FROM account_move_line AS l LEFT JOIN account_account a ON (l.account_id = a.id)
LEFT JOIN res_partner p ON (p.id = l.partner_id)
WHERE a.reconcile = 't'
AND l.reconcile_id IS NULL
AND (%s > to_char(p.last_reconciliation_date, 'YYYY-MM-DD') OR p.last_reconciliation_date IS NULL )
AND l.state <> 'draft'
GROUP BY l.partner_id) AS tmp
WHERE debit > 0
AND credit > 0
""",(time.strftime('%Y-%m-%d'),)
)
return len(map(lambda x: x[0], cr.fetchall())) - 1
@ -57,7 +61,7 @@ class account_partner_reconcile_process(osv.osv_memory):
return partner[0]
def data_get(self, cr, uid, to_reconcile, today_reconciled, context=None):
return {'progress': (100 / float(to_reconcile + today_reconciled)) * today_reconciled}
return {'progress': (100 / (float(to_reconcile + today_reconciled) or 1.0)) * today_reconciled}
def default_get(self, cr, uid, fields, context=None):
res = super(account_partner_reconcile_process, self).default_get(cr, uid, fields, context=context)

View File

@ -20,7 +20,7 @@
##############################################################################
import datetime
from osv import osv,fields
from osv import osv, fields
from tools.translate import _
def strToDate(dt):
@ -113,12 +113,14 @@ class crossovered_budget(osv.osv):
'date_from': fields.date('Start Date', required=True, states={'done':[('readonly',True)]}),
'date_to': fields.date('End Date', required=True, states={'done':[('readonly',True)]}),
'state' : fields.selection([('draft','Draft'),('confirm','Confirmed'),('validate','Validated'),('done','Done'),('cancel', 'Cancelled')], 'Status', select=True, required=True, readonly=True),
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'crossovered_budget_id', 'Budget Lines', states={'done':[('readonly',True)]} ),
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'crossovered_budget_id', 'Budget Lines', states={'done':[('readonly',True)]}),
'company_id': fields.many2one('res.company', 'Company', required=True),
}
_defaults = {
'state': 'draft',
'creating_user_id': lambda self,cr,uid,context: uid,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c)
}
def budget_confirm(self, cr, uid, ids, *args):
@ -244,7 +246,9 @@ class crossovered_budget_lines(osv.osv):
'practical_amount':fields.function(_prac, method=True, string='Practical Amount', type='float', digits=(16,2)),
'theoritical_amount':fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits=(16,2)),
'percentage':fields.function(_perc, method=True, string='Percentage', type='float'),
'company_id': fields.related('crossovered_budget_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
}
crossovered_budget_lines()
class account_analytic_account(osv.osv):
@ -257,5 +261,4 @@ class account_analytic_account(osv.osv):
account_analytic_account()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,7 +21,7 @@
<tree string="Budgetary Position">
<field name="code"/>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</tree>
</field>
</record>
@ -69,7 +69,7 @@
<form string="Budgetary Position">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<notebook colspan="4">
<page string="Accounts">
<field name="account_ids" colspan="4" nolabel="1"/>
@ -122,6 +122,7 @@
<field name="validating_user_id" readonly="True" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="date_from" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="date_to" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="crossovered_budget_line" colspan="4" nolabel="1" attrs="{'readonly':[('state','!=','draft')]}">
<tree string="Budget Lines">
<field name="analytic_account_id" groups="base.group_extended"/>
@ -141,6 +142,7 @@
<field name="date_to"/>
<field name="paid_date" select="1"/>
<field name="planned_amount" select="1"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</form>
</field>
<field name="state" select="1"/>
@ -166,6 +168,7 @@
<field name="code" colspan="1"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="creating_user_id"/>
<field name="state"/>
</tree>
@ -238,6 +241,7 @@
<field name="practical_amount" select="1"/>
<field name="theoritical_amount"/>
<field name="percentage"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</form>
</field>
</record>

View File

@ -1,10 +1,27 @@
<?xml version="1.0" encoding="utf-8"?><openerp><data noupdate="0">
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record id="budget_post_comp_rule" model="ir.rule">
<field name="name">Budget post multi-company</field>
<field name="model_id" ref="model_account_budget_post"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="budget_post_comp_rule" model="ir.rule">
<field name="name">Budget post multi-company</field>
<field name="model_id" ref="model_account_budget_post"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data></openerp>
<record id="budget_comp_rule" model="ir.rule">
<field name="name">Budget multi-company</field>
<field name="model_id" ref="model_crossovered_budget"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="budget_lines_comp_rule" model="ir.rule">
<field name="name">Budget lines multi-company</field>
<field name="model_id" ref="model_crossovered_budget_lines"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
</data>
</openerp>

View File

@ -9,7 +9,7 @@
<field name="arch" type="xml">
<form string="Coda import">
<field name="name" />
<field name="journal_id" />
<field name="journal_id" widget="selection"/>
<field name="date" />
<field name="user_id" />
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
@ -30,8 +30,8 @@
<field name="model">account.coda</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Coda import">
<field name="journal_id" />
<tree string="Coda Import">
<field name="journal_id" widget="selection"/>
<field name="date" />
<field name="user_id" />
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
@ -46,25 +46,26 @@
<field name="arch" type="xml">
<search string="Search Coda">
<group col="10" colspan="4">
<field name="journal_id"/>
<field name="journal_id" widget='selection'/>
<field name="date"/>
<field name="user_id" default="uid"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="User" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<separator orientation="vertical"/>
<filter string="User" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-personal" domain="[]" context="{'group_by':'company_id'}"/>
<filter string="Company" icon="terp-go-home" domain="[]" groups="base.group_multi_company" context="{'group_by':'company_id'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_account_coda">
<field name="name">Statements</field>
<field name="name">Coda Logs</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.coda</field>
<field name="view_type">form</field>
@ -75,7 +76,7 @@
<menuitem name="Coda Import Logs" parent="account.menu_finance_bank_and_cash" id="menu_account_coda_statement" action="action_account_coda" groups="base.group_extended" sequence="32"/>
<menuitem name="Import Coda Statements" action="action_account_coda_import" parent="account.menu_account_coda"
<menuitem name="Import Coda Statements" action="action_account_coda_import" parent="account.menu_account_pp_statements"
id="menu_account_coda_import" sequence="20"/>
<act_window name="Coda File"

View File

@ -144,7 +144,7 @@
src_model=""
view="account_move_line_partner_tree"/>
<menuitem action="act_account_partner_account_move_all" id="menu_account_move_open_unreconcile" parent="account_followup.menu_action_followup_stat"/>
<!--<menuitem action="act_account_partner_account_move_all" id="menu_account_move_open_unreconcile" parent="account_followup.menu_action_followup_stat"/> -->
<act_window
domain="[('reconcile_id', '=', False), ('account_id.type','=','payable')]"
@ -154,7 +154,7 @@
src_model=""
view="account_move_line_partner_tree"/>
<menuitem action="act_account_partner_account_move_payable_all" id="menu_account_move_open_unreconcile_payable" parent="account_followup.menu_action_followup_stat"/>
<!-- <menuitem action="act_account_partner_account_move_payable_all" id="menu_account_move_open_unreconcile_payable" parent="account_followup.menu_action_followup_stat"/> -->
<record model="ir.ui.view" id="view_company_inherit_followup_form">
<field name="name">res.company.followup.form.inherit</field>

View File

@ -1,27 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_followup_stat_form" model="ir.ui.view">
<field name="name">account_followup.stat.form</field>
<field name="model">account_followup.stat</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Follow-Up lines">
<field name="name" select="1"/>
<field name="account_type"/>
<field name="date_move" select="1"/>
<field name="date_move_last" select="1"/>
<field name="date_followup"/>
<field name="followup_id"/>
<field name="balance"/>
<field name="debit"/>
<field name="credit"/>
</form>
</field>
</record>
<record id="view_account_followup_stat_tree" model="ir.ui.view">
<field name="name">account_followup.stat.tree</field>
<field name="model">account_followup.stat</field>
@ -29,27 +9,38 @@
<field name="arch" type="xml">
<tree string="Follow-Up lines">
<field name="name"/>
<field name="account_type"/>
<field name="date_move"/>
<field name="date_move_last"/>
<field name="date_followup"/>
<field name="followup_id"/>
<field name="balance"/>
<field name="balance" sum="Balance"/>
<field name="debit"/>
<field name="credit"/>
</tree>
</field>
</record>
<record id="view_account_followup_stat_graph" model="ir.ui.view">
<field name="name">account_followup.stat.graph</field>
<field name="model">account_followup.stat</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Follow-Up lines" type="bar">
<field name="name"/>
<field name="balance" operator="+"/>
</graph>
</field>
</record>
<record id="action_followup_stat" model="ir.actions.act_window">
<field name="name">Latest Reminders</field>
<field name="name">Follow-ups Sent</field>
<field name="res_model">account_followup.stat</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
</record>
<menuitem name="Partners Follow-Ups" id="menu_action_followup_stat" parent="account.menu_finance_generic_reporting"/>
<!-- <menuitem name="Partners Follow-Ups" id="menu_action_followup_stat" parent="account.menu_finance_generic_reporting"/> -->
<menuitem action="action_followup_stat" id="menu_action_followup_stat_follow" parent="menu_action_followup_stat"/>
<menuitem action="action_followup_stat" id="menu_action_followup_stat_follow" parent="account.next_id_22"/>
</data>
</openerp>

View File

@ -116,6 +116,7 @@ class account_followup_print_all(osv.osv_memory):
"AND (l.state<>'draft') "\
"AND (l.partner_id is NOT NULL) "\
"AND (a.active) "\
"AND (l.debit > 0) "\
"ORDER BY l.date")
move_lines = cr.fetchall()
old = None
@ -294,4 +295,4 @@ class account_followup_print_all(osv.osv_memory):
account_followup_print_all()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -268,6 +268,18 @@ class payment_line(osv.osv):
else:
return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
def _get_date(self, cr, uid, context=None):
if context is None:
context = {}
date = False
if context.get('order_id') and context['order_id']:
order = self.pool.get('payment.order').browse(cr, uid, context['order_id'], context)
if order.date_prefered == 'fixed':
date = order.date_scheduled
else:
date = time.strftime('%Y-%m-%d')
return date
def _get_ml_inv_ref(self, cr, uid, ids, *a):
res={}
for id in self.browse(cr, uid, ids):
@ -328,6 +340,7 @@ class payment_line(osv.osv):
'state': lambda *args: 'normal',
'currency': _get_currency,
'company_currency': _get_currency,
'date': _get_date,
}
_sql_constraints = [
('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'),

View File

@ -88,7 +88,7 @@
<field name="date_scheduled" select="1" attrs="{'readonly':[('date_prefered','!=','fixed')]}" />
<button colspan="2" name="%(action_create_payment_order)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
</group>
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1">
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1" default_get="{'order_id': active_id}" >
<form string="Payment Line">
<notebook>
<page string="Payment">

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,10 +15,12 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import voucher
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -42,6 +42,7 @@
"voucher_workflow.xml",
"voucher_report.xml",
"wizard/account_voucher_unreconcile_view.xml",
"wizard/account_statement_from_invoice_view.xml",
"voucher_view.xml",
"voucher_payment_receipt_view.xml",
"voucher_sales_purchase_view.xml",
@ -50,8 +51,8 @@
],
"test" : [
# "test/account_voucher.yml",
# "test/sales_receipt.yml",
# "test/sales_payment.yml",
"test/sales_receipt.yml",
"test/sales_payment.yml",
"test/account_voucher_report.yml"
],
'certificate': '0037580727101',

View File

@ -1,24 +1,5 @@
-
In order to test account voucher i will create an invoice and pay it through account voucher.
-
I create a new Partner
-
!record {model: res.partner, id: res_partner_micropc0}:
address:
- country_id: base.be
name: Jenifer
street: 69 rue de Chimay
type: default
zip: '5478'
category_id:
- base.res_partner_category_8
credit_limit: 0.0
name: Micro PC
property_account_payable: account.a_pay
property_account_receivable: account.a_recv
-
Create an invoice for the partner
Create an invoice for the partner Seagate with amount 450.0
-
!record {model: account.invoice, id: account_invoice_0}:
account_id: account.a_recv
@ -34,7 +15,7 @@
product_id: product.product_product_pc1
uos_id: product.product_uom_unit
journal_id: account.sales_journal
partner_id: res_partner_micropc0
partner_id: base.res_partner_seagate
-
I check that the customer invoice is in draft state
@ -55,20 +36,20 @@
assert(acc_id.move_id)
-
I will create and post an account voucher for the partner.
I will create and post an account voucher of amount 450.0 for the partner Seagate.
-
!python {model: account.voucher}: |
import netsvc
vals = {}
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
res = self.onchange_partner_id(cr, uid, [], ref("res_partner_micropc0"), journal_id, price=0.0, ttype='receipt')
res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt')
vals = {
'account_id': ref('account.cash'),
'amount': 450.0,
'company_id': ref('base.main_company'),
'currency_id': ref('base.EUR'),
'journal_id': ref('account.bank_journal'),
'partner_id': ref('res_partner_micropc0'),
'partner_id': ref('base.res_partner_seagate'),
'period_id': ref('account.period_8'),
'type': 'receipt',
}

View File

@ -1,74 +1,91 @@
-
In order to test sales receipt i will create a sale receipt and pay it through sales payment
-
First of all I create a voucher
-
!record {model: account.voucher, id: account_voucher_chinaexport_0}:
-
Creating a Voucher Receipt for partner Seagate with amount 30000.0
-
!record {model: account.voucher, id: account_voucher_seagate_0}:
account_id: account.a_recv
amount: 30000.0
amount: 0.0
company_id: base.main_company
currency_id: base.EUR
journal_id: account.sales_journal
line_cr_ids:
- account_id: account.a_sale
amount: 30000.0
partner_id: base.res_partner_3
period_id: account.period_8
type: cr
partner_id: base.res_partner_seagate
period_id: account.period_9
tax_amount: 0.0
type: sale
-
I check that the voucher state is Draft
-
!assert {model: account.voucher, id: account_voucher_chinaexport_0}:
!assert {model: account.voucher, id: account_voucher_seagate_0}:
- state == 'draft'
-
I clicked on post button to post the voucher
I click on post button to post the voucher
-
!workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_chinaexport_0}
!workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_seagate_0}
-
Check the voucher state is Posted
Check that the voucher state is Posted
-
!assert {model: account.voucher, id: account_voucher_chinaexport_0}:
!assert {model: account.voucher, id: account_voucher_seagate_0}:
- state == 'posted'
-
I check that move lines are validated but not reconciled
-
!python {model: account.voucher}: |
reconciled = False
for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
if l.reconcile_id:
reconciled = True
break
if not reconciled:
print "Info: Voucher is not paid"
else:
print "Info: Voucher is paid"
-
I create a voucher record for the same partner
I create and post a voucher payment of amount 30000.0 for the partner Seagate
-
!record {model: account.voucher, id: account_voucher_chinaexport_1}:
account_id: account.cash
amount: 30000.0
company_id: base.main_company
currency_id: base.EUR
journal_id: account.bank_journal
line_cr_ids:
- account_id: account.a_recv
amount: 0.0
name: 2010/003
type: cr
- account_id: account.a_recv
amount: 30000.0
name: 2010/003
type: cr
partner_id: base.res_partner_3
period_id: account.period_8
type: receipt
!python {model: account.voucher}: |
import netsvc
vals = {}
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt')
vals = {
'account_id': ref('account.cash'),
'amount': 30000.0,
'company_id': ref('base.main_company'),
'currency_id': ref('base.EUR'),
'journal_id': ref('account.bank_journal'),
'partner_id': ref('base.res_partner_seagate'),
'period_id': ref('account.period_8'),
'type': 'receipt',
}
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
res['value']['line_cr_ids'][0]['amount'] = 30000.0
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
id = self.create(cr, uid, vals)
voucher_id = self.browse(cr, uid, id)
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr)
-
Check the voucher state is draft
I check that move lines are reconciled meaning voucher is paid
-
!assert {model: account.voucher, id: account_voucher_chinaexport_1}:
- state == 'draft'
-
I clicked on Post button to post the voucher
-
!workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_chinaexport_1}
-
Check the voucher state is Posted
-
!assert {model: account.voucher, id: account_voucher_chinaexport_1}:
- state == 'posted'
!python {model: account.voucher}: |
reconciled = False
for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
if l.reconcile_id:
reconciled = True
break
if not reconciled:
print "Info: Voucher is not paid"
else:
print "Info: Voucher is paid"

View File

@ -20,6 +20,8 @@
##############################################################################
import time
from lxml import etree
import netsvc
from osv import fields
from osv import osv
@ -61,6 +63,8 @@ class account_voucher(osv.osv):
return context.get('search_default_journal_id')
ttype = context.get('type', 'bank')
if ttype in ('payment', 'receipt'):
ttype = 'bank'
res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
return res and res[0] or False
@ -92,21 +96,35 @@ class account_voucher(osv.osv):
if journal.currency:
currency_id = journal.currency.id
return False
def _get_partner(self, cr, uid, context={}):
return context.get('partner_id', False)
def _get_reference(self, cr, uid, context={}):
return context.get('reference', False)
def _get_narration(self, cr, uid, context={}):
return context.get('narration', False)
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
return [(r['id'], (str(r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
res = super(account_voucher,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'])
nodes = doc.xpath("//field[@name='partner_id']")
if context.get('type', 'sale') in ('purchase', 'payment'):
for node in nodes:
node.set('domain', "[('supplier', '=', True)]")
res['arch'] = etree.tostring(doc)
return res
_name = 'account.voucher'
_description = 'Accounting Voucher'
_order = "date desc, id desc"
_rec_name = 'number'
# _rec_name = 'number'
_columns = {
'type':fields.selection([
('sale','Sale'),
@ -141,7 +159,7 @@ class account_voucher(osv.osv):
'amount': fields.float('Total', digits=(16, 2), required=True, readonly=True, states={'draft':[('readonly',False)]}),
'tax_amount':fields.float('Tax Amount', digits=(14,2), readonly=True, states={'draft':[('readonly',False)]}),
'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
'number': fields.related('move_id', 'name', type="char", readonly=True, string='Number'),
'number': fields.char('Number', size=32, readonly=True,),
'move_id':fields.many2one('account.move', 'Account Entry'),
'move_ids': fields.related('move_id','line_id', type='one2many', relation='account.move.line', string='Journal Items', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', change_default=1, readonly=True, states={'draft':[('readonly',False)]}),
@ -162,10 +180,10 @@ class account_voucher(osv.osv):
'reference': _get_reference,
'narration':_get_narration,
'type':_get_type,
'state': lambda *a: 'draft',
'pay_now':lambda *a: 'pay_later',
'name': lambda *a: '',
'date' : lambda *a: time.strftime('%Y-%m-%d'),
'state': 'draft',
'pay_now': 'pay_later',
'name': '',
'date' : time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
'tax_id': _get_tax,
}
@ -529,7 +547,7 @@ class account_voucher(osv.osv):
return {'value':res}
def action_move_line_create(self, cr, uid, ids, context=None):
def _get_payment_term_lines(term_id, amount):
term_pool = self.pool.get('account.payment.term')
if term_id and amount:
@ -546,9 +564,8 @@ class account_voucher(osv.osv):
for inv in self.browse(cr, uid, ids):
if inv.move_id:
continue
if 'force_name' in context and context['force_name']:
name = context['force_name']
if inv.number:
name = inv.number
elif inv.journal_id.sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, inv.journal_id.sequence_id.id)
else:
@ -648,7 +665,7 @@ class account_voucher(osv.osv):
if line.move_line_id.id:
rec_ids = [master_line, line.move_line_id.id]
rec_list_ids.append(rec_ids)
if not self.pool.get('res.currency').is_zero(cr, uid, inv.currency_id, line_total):
diff = line_total
move_line = {
@ -671,7 +688,8 @@ class account_voucher(osv.osv):
self.write(cr, uid, [inv.id], {
'move_id': move_id,
'state':'posted'
'state': 'posted',
'number': name,
})
move_pool.post(cr, uid, [move_id], context={})
for rec_ids in rec_list_ids:
@ -819,10 +837,9 @@ class account_bank_statement(osv.osv):
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None):
st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line_id, context=context)
if st_line.voucher_id:
res = self.pool.get('account.voucher').proforma_voucher(cr, uid, [st_line.voucher_id.id], context={'force_name': next_number})
#force refresh of the cache
#st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line.id, context=context)
self.pool.get('account.voucher').write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)
return self.pool.get('account.move.line').write(cr, uid, [x.id for x in st_line.voucher_id.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context=context)
@ -856,4 +873,12 @@ class account_bank_statement_line(osv.osv):
}
def unlink(self, cr, uid, ids, context=None):
statement_line = self.browse(cr, uid, ids, context)
unlink_ids = []
for st_line in statement_line:
unlink_ids.append(st_line.voucher_id.id)
self.pool.get('account.voucher').unlink(cr, uid, unlink_ids, context=context)
return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
account_bank_statement_line()

View File

@ -23,13 +23,6 @@
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
@ -37,6 +30,13 @@
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
</search>
</field>
</record>
@ -63,13 +63,6 @@
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
@ -77,6 +70,13 @@
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
</search>
</field>
</record>
@ -151,7 +151,7 @@
<field name="arch" type="xml">
<form string="Bill Payment">
<group col="6" colspan="4">
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)" context="{'invoice_currency':currency_id}" string="Vendor"/>
<field name="partner_id" domain="[('supplier','=',True)]" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)" context="{'invoice_currency':currency_id}" string="Vendor"/>
<field name="journal_id"
domain="[('type','in',['bank', 'cash'])]"
widget="selection" select="1"
@ -225,7 +225,7 @@
</form>
</field>
</record>
<record id="action_vendor_payment" model="ir.actions.act_window">
<field name="name">Vendor Payment</field>
<field name="res_model">account.voucher</field>
@ -331,7 +331,7 @@
</form>
</field>
</record>
<record id="action_vendor_receipt" model="ir.actions.act_window">
<field name="name">Sales Payment</field>
<field name="res_model">account.voucher</field>

View File

@ -22,13 +22,6 @@
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Supplier" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
@ -36,6 +29,13 @@
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
</search>
</field>
</record>
@ -61,13 +61,6 @@
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Customer" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
@ -75,6 +68,13 @@
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
</search>
</field>
</record>
@ -122,7 +122,7 @@
<group col="2" colspan="1">
<separator string="Payment Options" colspan="2"/>
<field name="pay_now" on_change="onchange_payment(pay_now, journal_id, partner_id)" required="1"/>
<field name="account_id"
<field name="account_id"
attrs="{'invisible':[('pay_now','!=','pay_now')]}"
domain="[('type','=','liquidity')]"/>
<!-- should select income accounts only. Or use the journal for this ? -->
@ -159,7 +159,7 @@
</form>
</field>
</record>
<!-- Sales Voucher -->
<record id="action_sale_receipt" model="ir.actions.act_window">
<field name="name">Sales Receipt</field>
@ -205,7 +205,7 @@
<field name="arch" type="xml">
<form string="Vendor Bills">
<group col="6" colspan="4">
<field name="partner_id" required="1" string="Vendor" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
<field name="partner_id" domain="[('supplier','=',True)]" required="1" string="Vendor" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type)"/>
<field name="journal_id" domain="[('type','in',['purchase','purchase_refund'])]" widget="selection" select="1" on_change="onchange_journal(journal_id, line_dr_ids, tax_id, partner_id)"/>
<field name="number"/>
<field name="name" colspan="4"/>
@ -284,8 +284,8 @@
<field name="act_window_id" ref="action_purchase_receipt"/>
</record>
<menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>
<menuitem id="menu_action_purchase_receipt" icon="STOCK_JUSTIFY_FILL"
action="action_purchase_receipt" parent="account.menu_finance_payables" sequence="10"/>
</data>
</openerp>

View File

@ -20,7 +20,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_voucher_form">
<field name="name">account.voucher.form</field>
<field name="model">account.voucher</field>
@ -43,7 +43,7 @@
<field name="name"/>
<field name="amount" sum="Total Amount"/>
<field name="type"/>
<field name="account_analytic_id" groups="base.group_extended"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
</tree>
</field>
<group col="2" colspan="3">
@ -107,13 +107,6 @@
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" />
<field name="period_id" groups="base.group_extended"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
@ -121,6 +114,13 @@
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." col='8' colspan='4'>
<field name="reference"/>
<field name="name"/>
<field name="narration"/>
<field name="amount"/>
</group>
</search>
</field>
</record>
@ -179,6 +179,20 @@
<field name="search_view_id" ref="view_voucher_filter"/>
</record>
<record id="view_bank_statement_form_invoice" model="ir.ui.view">
<field name="name">account.bank.statement.invoice.form.inherit</field>
<field name="model">account.bank.statement</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml">
<field name="currency" invisible="1" position="after">
<button name="%(action_view_account_statement_from_invoice_lines)d"
string="Import Invoices" type="action" icon="gtk-execute"
attrs="{'invisible':[('state','=','confirm')]}"/>
</field>
</field>
</record>
<record id="view_bank_statement_form_voucher" model="ir.ui.view">
<field name="name">account.bank.statement.voucher.form.inherit</field>

View File

@ -20,3 +20,6 @@
##############################################################################
import account_voucher_unreconcile
import account_statement_from_invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -47,12 +47,14 @@ class account_statement_from_invoice_lines(osv.osv_memory):
statement_obj = self.pool.get('account.bank.statement')
statement_line_obj = self.pool.get('account.bank.statement.line')
currency_obj = self.pool.get('res.currency')
statement_reconcile_obj = self.pool.get('account.bank.statement.reconcile')
voucher_obj = self.pool.get('account.voucher')
voucher_line_obj = self.pool.get('account.voucher.line')
line_date = time.strftime('%Y-%m-%d')
statement = statement_obj.browse(cr, uid, statement_id, context=context)
# for each selected move lines
for line in line_obj.browse(cr, uid, line_ids, context=context):
voucher_res = {}
ctx = context.copy()
# take the date for computation of currency => use payment date
ctx['date'] = line_date
@ -69,10 +71,29 @@ class account_statement_from_invoice_lines(osv.osv_memory):
elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id):
amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id,
statement.currency.id, amount, context=ctx)
voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt') ,
'name': line.name,
'partner_id': line.partner_id.id,
'journal_id': statement.journal_id.id,
'account_id': line.account_id.id,
'company_id':statement.company_id.id,
'currency_id':statement.currency.id,
'date':line.date,
'amount':abs(amount),
'period_id':statement.period_id.id}
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'))
voucher_line_dict = False
if result['value']['line_ids']:
for line_dict in result['value']['line_ids']:
move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context)
if line.move_id.id == move_line.move_id.id:
voucher_line_dict = line_dict
reconcile_id = statement_reconcile_obj.create(cr, uid, {
'line_ids': [(6, 0, [line.id])]
}, context=context)
if voucher_line_dict:
voucher_line_dict.update({'voucher_id':voucher_id})
voucher_line_obj.create(cr, uid, voucher_line_dict, context=context)
if line.journal_id.type == 'sale':
type = 'customer'
elif line.journal_id.type == 'purchase':
@ -87,7 +108,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
'account_id': line.account_id.id,
'statement_id': statement_id,
'ref': line.ref,
'reconcile_id': reconcile_id,
'voucher_id': voucher_id,
'date': time.strftime('%Y-%m-%d'), #time.strftime('%Y-%m-%d'), #line.date_maturity or,
}, context=context)
return {}