Merge with trunk-dev-addons2.
bzr revid: ysa@tinyerp.com-20110106112001-wh6d4y46mpm0bf5h
This commit is contained in:
@@ -33,5 +33,6 @@ import report
|
||||
import product
|
||||
import sequence
|
||||
import company
|
||||
import res_currency
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -48,7 +48,10 @@ module named account_voucher.
|
||||
'security/account_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'account_menuitem.xml',
|
||||
'account_wizard.xml',
|
||||
'report/account_invoice_report_view.xml',
|
||||
'report/account_entries_report_view.xml',
|
||||
'report/account_report_view.xml',
|
||||
'report/account_analytic_entries_report_view.xml',
|
||||
'wizard/account_move_bank_reconcile_view.xml',
|
||||
'wizard/account_use_model_view.xml',
|
||||
'account_installer.xml',
|
||||
@@ -106,10 +109,6 @@ module named account_voucher.
|
||||
'process/supplier_invoice_process.xml',
|
||||
'sequence_view.xml',
|
||||
'company_view.xml',
|
||||
'report/account_invoice_report_view.xml',
|
||||
'report/account_entries_report_view.xml',
|
||||
'report/account_report_view.xml',
|
||||
'report/account_analytic_entries_report_view.xml',
|
||||
'board_account_view.xml',
|
||||
"wizard/account_report_profit_loss_view.xml",
|
||||
"wizard/account_report_balance_sheet_view.xml"
|
||||
@@ -119,7 +118,7 @@ module named account_voucher.
|
||||
'project/project_demo.xml',
|
||||
'project/analytic_account_demo.xml',
|
||||
'demo/account_minimal.xml',
|
||||
'account_unit_test.xml',
|
||||
# 'account_unit_test.xml',
|
||||
],
|
||||
'test': [
|
||||
'test/account_customer_invoice.yml',
|
||||
@@ -131,8 +130,12 @@ module named account_voucher.
|
||||
'test/account_use_model.yml',
|
||||
'test/account_validate_account_move.yml',
|
||||
'test/account_fiscalyear_close.yml',
|
||||
'test/account_bank_statement.yml',
|
||||
'test/account_cash_statement.yml',
|
||||
'test/account_report.yml',
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0080331923549',
|
||||
|
||||
+452
-305
File diff suppressed because it is too large
Load Diff
@@ -24,19 +24,17 @@ import time
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
import tools
|
||||
from tools import config
|
||||
|
||||
class account_analytic_line(osv.osv):
|
||||
_inherit = 'account.analytic.line'
|
||||
_description = 'Analytic Line'
|
||||
_columns = {
|
||||
'product_uom_id' : fields.many2one('product.uom', 'UoM'),
|
||||
'product_id' : fields.many2one('product.product', 'Product'),
|
||||
'general_account_id' : fields.many2one('account.account', 'General Account', required=True, ondelete='cascade'),
|
||||
'move_id' : fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True),
|
||||
'journal_id' : fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='cascade', select=True),
|
||||
'code' : fields.char('Code', size=8),
|
||||
'product_uom_id': fields.many2one('product.uom', 'UoM'),
|
||||
'product_id': fields.many2one('product.product', 'Product'),
|
||||
'general_account_id': fields.many2one('account.account', 'General Account', required=True, ondelete='restrict'),
|
||||
'move_id': fields.many2one('account.move.line', 'Move Line', ondelete='restrict', select=True),
|
||||
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='restrict', select=True),
|
||||
'code': fields.char('Code', size=8),
|
||||
'ref': fields.char('Ref.', size=64),
|
||||
'currency_id': fields.related('move_id', 'currency_id', type='many2one', relation='res.currency', string='Account currency', store=True, help="The related account currency if not equal to the company one.", readonly=True),
|
||||
'amount_currency': fields.related('move_id', 'amount_currency', type='float', string='Amount currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True),
|
||||
@@ -52,22 +50,19 @@ class account_analytic_line(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('from_date',False):
|
||||
args.append(['date', '>=',context['from_date']])
|
||||
args.append(['date', '>=', context['from_date']])
|
||||
|
||||
if context.get('to_date',False):
|
||||
args.append(['date','<=',context['to_date']])
|
||||
|
||||
args.append(['date','<=', context['to_date']])
|
||||
return super(account_analytic_line, self).search(cr, uid, args, offset, limit,
|
||||
order, context=context, count=count)
|
||||
|
||||
def _check_company(self, cr, uid, ids):
|
||||
lines = self.browse(cr, uid, ids)
|
||||
def _check_company(self, cr, uid, ids, context=None):
|
||||
lines = self.browse(cr, uid, ids, context=context)
|
||||
for l in lines:
|
||||
if l.move_id and not l.account_id.company_id.id == l.move_id.account_id.company_id.id:
|
||||
return False
|
||||
return True
|
||||
_constraints = [
|
||||
]
|
||||
|
||||
# Compute the cost based on the price type define into company
|
||||
# property_valuation_price_type property
|
||||
@@ -77,18 +72,16 @@ class account_analytic_line(osv.osv):
|
||||
context={}
|
||||
if not journal_id:
|
||||
j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')])
|
||||
j_id = j_ids and j_ids[0] or False
|
||||
journal_id = j_ids and j_ids[0] or False
|
||||
if not journal_id or not prod_id:
|
||||
return {}
|
||||
product_obj = self.pool.get('product.product')
|
||||
analytic_journal_obj =self.pool.get('account.analytic.journal')
|
||||
product_price_type_obj = self.pool.get('product.price.type')
|
||||
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
|
||||
prod = product_obj.browse(cr, uid, prod_id, context=context)
|
||||
result = 0.0
|
||||
is_purchase = False
|
||||
|
||||
|
||||
if j_id.type <> 'sale':
|
||||
a = prod.product_tmpl_id.property_account_expense.id
|
||||
if not a:
|
||||
@@ -98,9 +91,6 @@ class account_analytic_line(osv.osv):
|
||||
_('There is no expense account defined ' \
|
||||
'for this product: "%s" (id:%d)') % \
|
||||
(prod.name, prod.id,))
|
||||
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:
|
||||
@@ -110,21 +100,41 @@ class account_analytic_line(osv.osv):
|
||||
_('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]
|
||||
|
||||
flag = False
|
||||
# Compute based on pricetype
|
||||
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','standard_price')], context=context)
|
||||
pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context=context)[0]
|
||||
if journal_id:
|
||||
journal = analytic_journal_obj.browse(cr, uid, journal_id, context=context)
|
||||
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=context)[0]
|
||||
# Take the company currency as the reference one
|
||||
if pricetype.field == 'list_price':
|
||||
flag = True
|
||||
ctx = context.copy()
|
||||
if unit:
|
||||
# price_get() will respect a 'uom' in its context, in order
|
||||
# to return a default price for those units
|
||||
ctx['uom'] = unit
|
||||
amount_unit = prod.price_get(pricetype.field, context=ctx)[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:
|
||||
if not flag:
|
||||
result *= -1
|
||||
return {
|
||||
'value': {
|
||||
'amount': result,
|
||||
'general_account_id': a,
|
||||
|
||||
return {'value': {
|
||||
'amount': result,
|
||||
'general_account_id': a,
|
||||
}
|
||||
}
|
||||
|
||||
def view_header_get(self, cr, user, view_id, view_type, context):
|
||||
def view_header_get(self, cr, user, view_id, view_type, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('account_id', False):
|
||||
# account_id in context may also be pointing to an account.account.id
|
||||
cr.execute('select name from account_analytic_account where id=%s', (context['account_id'],))
|
||||
@@ -141,11 +151,10 @@ class res_partner(osv.osv):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
_columns = {
|
||||
'contract_ids': fields.one2many('account.analytic.account', \
|
||||
'contract_ids': fields.one2many('account.analytic.account', \
|
||||
'partner_id', 'Contracts', readonly=True),
|
||||
}
|
||||
}
|
||||
|
||||
res_partner()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -21,9 +21,7 @@
|
||||
|
||||
import time
|
||||
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
from tools.misc import currency
|
||||
from tools.translate import _
|
||||
import decimal_precision as dp
|
||||
|
||||
@@ -40,34 +38,17 @@ class account_bank_statement(osv.osv):
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
res = super(account_bank_statement, self).write(cr, uid, ids, vals, context=context)
|
||||
account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
|
||||
for statement in self.browse(cr, uid, ids, context):
|
||||
seq = 0
|
||||
for line in statement.line_ids:
|
||||
seq += 1
|
||||
if not line.sequence:
|
||||
self.pool.get('account.bank.statement.line').write(cr, uid, [line.id], {'sequence': seq}, context=context)
|
||||
account_bank_statement_line_obj.write(cr, uid, [line.id], {'sequence': seq}, context=context)
|
||||
return res
|
||||
|
||||
def button_import_invoice(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
def _default_journal_id(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_statement_from_invoice')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
context.update({'statement_id': ids[0]})
|
||||
return {
|
||||
'name': _('Import Invoice'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.statement.from.invoice',
|
||||
'views': [(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'nodestroy': True
|
||||
}
|
||||
|
||||
def _default_journal_id(self, cr, uid, context={}):
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
journal_type = context.get('journal_type', False)
|
||||
journal_id = False
|
||||
@@ -77,17 +58,16 @@ class account_bank_statement(osv.osv):
|
||||
journal_id = ids[0]
|
||||
return journal_id
|
||||
|
||||
def _default_balance_start(self, cr, uid, context={}):
|
||||
def _default_balance_start(self, cr, uid, context=None):
|
||||
cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,))
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
return self.browse(cr, uid, [res[0]], context)[0].balance_end
|
||||
return self.browse(cr, uid, res[0], context=context).balance_end
|
||||
return 0.0
|
||||
|
||||
def _end_balance(self, cursor, user, ids, name, attr, context=None):
|
||||
res_currency_obj = self.pool.get('res.currency')
|
||||
res_users_obj = self.pool.get('res.users')
|
||||
|
||||
res = {}
|
||||
|
||||
company_currency_id = res_users_obj.browse(cursor, user, user,
|
||||
@@ -117,7 +97,7 @@ class account_bank_statement(osv.osv):
|
||||
res[r] = round(res[r], 2)
|
||||
return res
|
||||
|
||||
def _get_period(self, cr, uid, context={}):
|
||||
def _get_period(self, cr, uid, context=None):
|
||||
periods = self.pool.get('account.period').find(cr, uid)
|
||||
if periods:
|
||||
return periods[0]
|
||||
@@ -143,7 +123,7 @@ class account_bank_statement(osv.osv):
|
||||
res[statement_id] = (currency_id, currency_names[currency_id])
|
||||
return res
|
||||
|
||||
_order = "date desc"
|
||||
_order = "date desc, id desc"
|
||||
_name = "account.bank.statement"
|
||||
_description = "Bank Statement"
|
||||
_columns = {
|
||||
@@ -171,11 +151,12 @@ class account_bank_statement(osv.osv):
|
||||
\n* And after getting confirmation from the bank it will be in \'Confirmed\' state.'),
|
||||
'currency': fields.function(_currency, method=True, string='Currency',
|
||||
type='many2one', relation='res.currency'),
|
||||
'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'name': "/",
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'state': 'draft',
|
||||
'balance_start': _default_balance_start,
|
||||
'journal_id': _default_journal_id,
|
||||
@@ -216,13 +197,13 @@ class account_bank_statement(osv.osv):
|
||||
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):
|
||||
if context is None:
|
||||
context = {}
|
||||
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')
|
||||
st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context)
|
||||
st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context)
|
||||
st = st_line.statement_id
|
||||
|
||||
context.update({'date': st_line.date})
|
||||
@@ -242,10 +223,13 @@ class account_bank_statement(osv.osv):
|
||||
account_id = st.journal_id.default_credit_account_id.id
|
||||
else:
|
||||
account_id = st.journal_id.default_debit_account_id.id
|
||||
|
||||
acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id
|
||||
context.update({
|
||||
'res.currency.compute.account': acc_cur,
|
||||
})
|
||||
amount = res_currency_obj.compute(cr, uid, st.currency.id,
|
||||
company_currency_id, st_line.amount, context=context,
|
||||
account=acc_cur)
|
||||
company_currency_id, st_line.amount, context=context)
|
||||
|
||||
val = {
|
||||
'name': st_line.name,
|
||||
@@ -263,26 +247,18 @@ class account_bank_statement(osv.osv):
|
||||
'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False
|
||||
}
|
||||
|
||||
amount = res_currency_obj.compute(cr, uid, st.currency.id,
|
||||
company_currency_id, st_line.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)
|
||||
st.currency.id, amount, context=context)
|
||||
val['amount_currency'] = -amount_cur
|
||||
|
||||
if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id:
|
||||
val['currency_id'] = st_line.account_id.currency_id.id
|
||||
if company_currency_id==st_line.account_id.currency_id.id:
|
||||
amount_cur = st_line.amount
|
||||
else:
|
||||
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
|
||||
st_line.account_id.currency_id.id, amount, context=context,
|
||||
account=acc_cur)
|
||||
val['amount_currency'] = amount_cur
|
||||
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
|
||||
st_line.account_id.currency_id.id, amount, context=context)
|
||||
val['amount_currency'] = -amount_cur
|
||||
|
||||
move_line_id = account_move_line_obj.create(cr, uid, val , context=context)
|
||||
move_line_id = account_move_line_obj.create(cr, uid, val, context=context)
|
||||
torec.append(move_line_id)
|
||||
|
||||
# Fill the secondary amount/currency
|
||||
@@ -321,10 +297,10 @@ class account_bank_statement(osv.osv):
|
||||
return move_id
|
||||
|
||||
def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None):
|
||||
return st_number + ' - ' + str(st_line.sequence)
|
||||
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)
|
||||
st = self.browse(cr, uid, st_id, context=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') +
|
||||
@@ -343,7 +319,7 @@ class account_bank_statement(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
for st in self.browse(cr, uid, ids, context):
|
||||
for st in self.browse(cr, uid, ids, context=context):
|
||||
j_type = st.journal_id.type
|
||||
company_currency_id = st.journal_id.company_id.currency_id.id
|
||||
if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
|
||||
@@ -378,35 +354,35 @@ class account_bank_statement(osv.osv):
|
||||
self.create_move_from_st_line(cr, uid, st_line.id, company_currency_id, st_line_number, context)
|
||||
|
||||
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)
|
||||
self.log(cr, uid, st.id, _('Statement %s is confirmed, journal items are created.') % (st_number,))
|
||||
done.append(st.id)
|
||||
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context=None):
|
||||
done = []
|
||||
for st in self.browse(cr, uid, ids, context):
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
for st in self.browse(cr, uid, ids, context=context):
|
||||
if st.state=='draft':
|
||||
continue
|
||||
ids = []
|
||||
for line in st.line_ids:
|
||||
ids += [x.id for x in line.move_ids]
|
||||
self.pool.get('account.move').unlink(cr, uid, ids, context)
|
||||
account_move_obj.unlink(cr, uid, ids, context)
|
||||
done.append(st.id)
|
||||
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')
|
||||
res_users_obj = self.pool.get('res.users')
|
||||
cursor.execute('SELECT balance_end_real \
|
||||
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
|
||||
cr.execute('SELECT balance_end_real \
|
||||
FROM account_bank_statement \
|
||||
WHERE journal_id = %s AND NOT state = %s \
|
||||
ORDER BY date DESC,id DESC LIMIT 1', (journal_id, 'draft'))
|
||||
res = cursor.fetchone()
|
||||
res = cr.fetchone()
|
||||
balance_start = res and res[0] or 0.0
|
||||
return {'value': {'balance_start': balance_start}}
|
||||
account_id = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id'], context=context)['default_debit_account_id']
|
||||
return {'value': {'balance_start': balance_start, 'account_id': account_id}}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
stat = self.read(cr, uid, ids, ['state'])
|
||||
stat = self.read(cr, uid, ids, ['state'], context=context)
|
||||
unlink_ids = []
|
||||
for t in stat:
|
||||
if t['state'] in ('draft'):
|
||||
@@ -429,9 +405,7 @@ account_bank_statement()
|
||||
|
||||
class account_bank_statement_line(osv.osv):
|
||||
|
||||
def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None):
|
||||
res_users_obj = self.pool.get('res.users')
|
||||
res_currency_obj = self.pool.get('res.currency')
|
||||
def onchange_type(self, cr, uid, line_id, partner_id, type, context=None):
|
||||
res = {'value': {}}
|
||||
obj_partner = self.pool.get('res.partner')
|
||||
if context is None:
|
||||
@@ -439,41 +413,23 @@ class account_bank_statement_line(osv.osv):
|
||||
if not partner_id:
|
||||
return res
|
||||
account_id = False
|
||||
line = self.browse(cursor, user, line_id)
|
||||
line = self.browse(cr, uid, line_id, context=context)
|
||||
if not line or (line and not line[0].account_id):
|
||||
part = obj_partner.browse(cursor, user, partner_id, context=context)
|
||||
part = obj_partner.browse(cr, uid, partner_id, context=context)
|
||||
if type == 'supplier':
|
||||
account_id = part.property_account_payable.id
|
||||
else:
|
||||
account_id = part.property_account_receivable.id
|
||||
res['value']['account_id'] = account_id
|
||||
|
||||
if account_id and (not line or (line and not line[0].amount)) and not context.get('amount', False):
|
||||
company_currency_id = res_users_obj.browse(cursor, user, user,
|
||||
context=context).company_id.currency_id.id
|
||||
if not currency_id:
|
||||
currency_id = company_currency_id
|
||||
|
||||
cursor.execute('SELECT sum(debit-credit) \
|
||||
FROM account_move_line \
|
||||
WHERE (reconcile_id is null) \
|
||||
AND partner_id = %s \
|
||||
AND account_id=%s', (partner_id, account_id))
|
||||
pgres = cursor.fetchone()
|
||||
balance = pgres and pgres[0] or 0.0
|
||||
|
||||
balance = res_currency_obj.compute(cursor, user, company_currency_id,
|
||||
currency_id, balance, context=context)
|
||||
res['value']['amount'] = balance
|
||||
return res
|
||||
|
||||
_order = "statement_id desc, sequence"
|
||||
_name = "account.bank.statement.line"
|
||||
_description = "Bank Statement Line"
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=64, required=True),
|
||||
'name': fields.char('Communication', size=64, required=True),
|
||||
'date': fields.date('Date', required=True),
|
||||
'amount': fields.float('Amount'),
|
||||
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
|
||||
'type': fields.selection([
|
||||
('supplier','Supplier'),
|
||||
('customer','Customer'),
|
||||
@@ -495,10 +451,10 @@ 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': time.strftime('%Y-%m-%d'),
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'type': 'general',
|
||||
}
|
||||
|
||||
account_bank_statement_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
from decimal import Decimal
|
||||
from tools.translate import _
|
||||
import decimal_precision as dp
|
||||
|
||||
@@ -41,26 +41,27 @@ class account_cashbox_line(osv.osv):
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
for obj in self.browse(cr, uid, ids):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
res[obj.id] = obj.pieces * obj.number
|
||||
return res
|
||||
|
||||
def on_change_sub(self, cr, uid, ids, pieces, number,*a):
|
||||
def on_change_sub(self, cr, uid, ids, pieces, number, *a):
|
||||
|
||||
""" Calculates Sub total on change of number
|
||||
@param pieces: Names of fields.
|
||||
@param number:
|
||||
"""
|
||||
sub=pieces*number
|
||||
return {'value':{'subtotal': sub or 0.0}}
|
||||
sub = pieces * number
|
||||
return {'value': {'subtotal': sub or 0.0}}
|
||||
|
||||
_columns = {
|
||||
'pieces': fields.float('Values', digits_compute=dp.get_precision('Account')),
|
||||
'number': fields.integer('Number'),
|
||||
'subtotal': fields.function(_sub_total, method=True, string='Sub Total', type='float', digits_compute=dp.get_precision('Account')),
|
||||
'starting_id': fields.many2one('account.bank.statement',ondelete='cascade'),
|
||||
'ending_id': fields.many2one('account.bank.statement',ondelete='cascade'),
|
||||
'starting_id': fields.many2one('account.bank.statement', ondelete='cascade'),
|
||||
'ending_id': fields.many2one('account.bank.statement', ondelete='cascade'),
|
||||
}
|
||||
|
||||
account_cashbox_line()
|
||||
|
||||
class account_cash_statement(osv.osv):
|
||||
@@ -74,8 +75,8 @@ class account_cash_statement(osv.osv):
|
||||
@param arg: User defined arguments
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res ={}
|
||||
for statement in self.browse(cr, uid, ids):
|
||||
res = {}
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
amount_total = 0.0
|
||||
|
||||
if statement.journal_id.type not in('cash'):
|
||||
@@ -84,7 +85,7 @@ class account_cash_statement(osv.osv):
|
||||
for line in statement.starting_details_ids:
|
||||
amount_total+= line.pieces * line.number
|
||||
res[statement.id] = {
|
||||
'balance_start':amount_total
|
||||
'balance_start': amount_total
|
||||
}
|
||||
return res
|
||||
|
||||
@@ -94,12 +95,12 @@ class account_cash_statement(osv.osv):
|
||||
@param arg: User defined arguments
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res ={}
|
||||
for statement in self.browse(cr, uid, ids):
|
||||
amount_total=0.0
|
||||
res = {}
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
amount_total = 0.0
|
||||
for line in statement.ending_details_ids:
|
||||
amount_total+= line.pieces * line.number
|
||||
res[statement.id]=amount_total
|
||||
amount_total += line.pieces * line.number
|
||||
res[statement.id] = amount_total
|
||||
return res
|
||||
|
||||
def _get_sum_entry_encoding(self, cr, uid, ids, name, arg, context=None):
|
||||
@@ -109,18 +110,17 @@ class account_cash_statement(osv.osv):
|
||||
@param arg: User defined arguments
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res2={}
|
||||
for statement in self.browse(cr, uid, ids):
|
||||
res2 = {}
|
||||
for statement in self.browse(cr, uid, ids, context=context):
|
||||
encoding_total=0.0
|
||||
for line in statement.line_ids:
|
||||
encoding_total+= line.amount
|
||||
res2[statement.id]=encoding_total
|
||||
encoding_total += line.amount
|
||||
res2[statement.id] = encoding_total
|
||||
return res2
|
||||
|
||||
def _end_balance(self, cursor, user, ids, name, attr, context=None):
|
||||
res_currency_obj = self.pool.get('res.currency')
|
||||
res_users_obj = self.pool.get('res.users')
|
||||
|
||||
res = {}
|
||||
|
||||
company_currency_id = res_users_obj.browse(cursor, user, user,
|
||||
@@ -143,6 +143,7 @@ class account_cash_statement(osv.osv):
|
||||
res[statement.id] -= res_currency_obj.compute(cursor,
|
||||
user, company_currency_id, currency_id,
|
||||
line.credit, context=context)
|
||||
|
||||
if statement.state in ('draft', 'open'):
|
||||
for line in statement.line_ids:
|
||||
res[statement.id] += line.amount
|
||||
@@ -150,117 +151,122 @@ class account_cash_statement(osv.osv):
|
||||
res[r] = round(res[r], 2)
|
||||
return res
|
||||
|
||||
def _get_company(self, cr, uid, context={}):
|
||||
def _get_company(self, cr, uid, context=None):
|
||||
user_pool = self.pool.get('res.users')
|
||||
company_pool = self.pool.get('res.company')
|
||||
user = user_pool.browse(cr, uid, uid, context)
|
||||
company_id = user.company_id and user.company_id.id
|
||||
user = user_pool.browse(cr, uid, uid, context=context)
|
||||
company_id = user.company_id
|
||||
if not company_id:
|
||||
company_id = company_pool.search(cr, uid, [])[0]
|
||||
company_id = company_pool.search(cr, uid, [])
|
||||
return company_id and company_id[0] or False
|
||||
|
||||
return company_id
|
||||
|
||||
def _get_cash_open_box_lines(self, cr, uid, context={}):
|
||||
def _get_cash_open_box_lines(self, cr, uid, context=None):
|
||||
res = []
|
||||
curr = [1, 2, 5, 10, 20, 50, 100, 500]
|
||||
for rs in curr:
|
||||
dct = {
|
||||
'pieces':rs,
|
||||
'number':0
|
||||
'pieces': rs,
|
||||
'number': 0
|
||||
}
|
||||
res.append(dct)
|
||||
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','cash')], context=context)
|
||||
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')], context=context)
|
||||
if journal_ids:
|
||||
results = self.search(cr, uid, [('journal_id','in',journal_ids),('state','=','confirm')],context=context)
|
||||
results = self.search(cr, uid, [('journal_id', 'in', journal_ids),('state', '=', 'confirm')], context=context)
|
||||
if results:
|
||||
cash_st = self.browse(cr, uid, results, context)[0]
|
||||
cash_st = self.browse(cr, uid, results, context=context)[0]
|
||||
for cash_line in cash_st.ending_details_ids:
|
||||
for r in res:
|
||||
if cash_line.pieces == r['pieces']:
|
||||
r['number'] = cash_line.number
|
||||
return res
|
||||
|
||||
def _get_default_cash_close_box_lines(self, cr, uid, context={}):
|
||||
def _get_default_cash_close_box_lines(self, cr, uid, context=None):
|
||||
res = []
|
||||
curr = [1, 2, 5, 10, 20, 50, 100, 500]
|
||||
for rs in curr:
|
||||
dct = {
|
||||
'pieces':rs,
|
||||
'number':0
|
||||
'pieces': rs,
|
||||
'number': 0
|
||||
}
|
||||
res.append(dct)
|
||||
return res
|
||||
|
||||
def _get_cash_close_box_lines(self, cr, uid, context={}):
|
||||
def _get_cash_close_box_lines(self, cr, uid, context=None):
|
||||
res = []
|
||||
curr = [1, 2, 5, 10, 20, 50, 100, 500]
|
||||
for rs in curr:
|
||||
dct = {
|
||||
'pieces':rs,
|
||||
'number':0
|
||||
'pieces': rs,
|
||||
'number': 0
|
||||
}
|
||||
res.append((0,0,dct))
|
||||
res.append((0, 0, dct))
|
||||
return res
|
||||
|
||||
def _get_cash_open_close_box_lines(self, cr, uid, context={}):
|
||||
def _get_cash_open_close_box_lines(self, cr, uid, context=None):
|
||||
res = {}
|
||||
start_l = []
|
||||
end_l = []
|
||||
starting_details = self._get_cash_open_box_lines(cr, uid, context)
|
||||
starting_details = self._get_cash_open_box_lines(cr, uid, context=context)
|
||||
ending_details = self._get_default_cash_close_box_lines(cr, uid, context)
|
||||
for start in starting_details:
|
||||
start_l.append((0,0,start))
|
||||
start_l.append((0, 0, start))
|
||||
for end in ending_details:
|
||||
end_l.append((0,0,end))
|
||||
end_l.append((0, 0, end))
|
||||
res['start'] = start_l
|
||||
res['end'] = end_l
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'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"),
|
||||
'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'),
|
||||
('confirm', 'Closed'),
|
||||
('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
|
||||
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"),
|
||||
'closing_date':fields.datetime("Closed On"),
|
||||
'total_entry_encoding': fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"),
|
||||
'closing_date': fields.datetime("Closed On"),
|
||||
'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Starting Balance and Cash Transactions"),
|
||||
'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"),
|
||||
'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'),
|
||||
'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'),
|
||||
'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=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'),
|
||||
'user_id':fields.many2one('res.users', 'Responsible', required=False),
|
||||
'name': fields.char('Name', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=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'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', required=False),
|
||||
}
|
||||
_defaults = {
|
||||
'state': lambda *a: 'draft',
|
||||
'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'state': 'draft',
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'user_id': lambda self, cr, uid, context=None: uid,
|
||||
'starting_details_ids':_get_cash_open_box_lines,
|
||||
'ending_details_ids':_get_default_cash_close_box_lines
|
||||
'starting_details_ids': _get_cash_open_box_lines,
|
||||
'ending_details_ids': _get_default_cash_close_box_lines
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
sql = [
|
||||
('journal_id', '=', vals['journal_id']),
|
||||
('journal_id', '=', vals.get('journal_id', False)),
|
||||
('state', '=', 'open')
|
||||
]
|
||||
open_jrnl = self.search(cr, uid, sql)
|
||||
if open_jrnl:
|
||||
raise osv.except_osv('Error', _('You can not have two open register for the same journal'))
|
||||
raise osv.except_osv(_('Error'), _('You can not have two open register for the same journal'))
|
||||
|
||||
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash':
|
||||
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context).type == 'cash':
|
||||
open_close = self._get_cash_open_close_box_lines(cr, uid, context)
|
||||
if vals.get('starting_details_ids', False):
|
||||
for start in vals.get('starting_details_ids'):
|
||||
dict_val = start[2]
|
||||
for end in open_close['end']:
|
||||
if end[2]['pieces'] == dict_val['pieces']:
|
||||
end[2]['number'] += dict_val['number']
|
||||
vals.update({
|
||||
'ending_details_ids':open_close['start'],
|
||||
'starting_details_ids':open_close['end']
|
||||
# 'ending_details_ids': open_close['start'],
|
||||
'starting_details_ids': open_close['end']
|
||||
})
|
||||
else:
|
||||
vals.update({
|
||||
'ending_details_ids':False,
|
||||
'starting_details_ids':False
|
||||
'ending_details_ids': False,
|
||||
'starting_details_ids': False
|
||||
})
|
||||
res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
|
||||
#self.write(cr, uid, [res_id], {})
|
||||
self.write(cr, uid, [res_id], {})
|
||||
return res_id
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
@@ -277,7 +283,7 @@ class account_cash_statement(osv.osv):
|
||||
@return: True on success, False otherwise
|
||||
"""
|
||||
|
||||
super(account_cash_statement, self).write(cr, uid, ids, vals)
|
||||
super(account_cash_statement, self).write(cr, uid, ids, vals, context=context)
|
||||
res = self._get_starting_balance(cr, uid, ids)
|
||||
for rs in res:
|
||||
super(account_cash_statement, self).write(cr, uid, [rs], res.get(rs))
|
||||
@@ -289,20 +295,14 @@ class account_cash_statement(osv.osv):
|
||||
@param journal_id: Changed journal_id
|
||||
@return: Dictionary of changed values
|
||||
"""
|
||||
|
||||
cash_pool = self.pool.get('account.cashbox.line')
|
||||
statement_pool = self.pool.get('account.bank.statement')
|
||||
|
||||
res = {}
|
||||
balance_start = 0.0
|
||||
|
||||
if not journal_id:
|
||||
res.update({
|
||||
'balance_start': balance_start
|
||||
})
|
||||
return res
|
||||
res = super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context=context)
|
||||
return res
|
||||
return super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context=context)
|
||||
|
||||
def _equal_balance(self, cr, uid, cash_id, context=None):
|
||||
statement = self.browse(cr, uid, cash_id, context=context)
|
||||
@@ -310,39 +310,35 @@ class account_cash_statement(osv.osv):
|
||||
statement.balance_end_real = statement.balance_end
|
||||
if statement.balance_end != statement.balance_end_cash:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
return True
|
||||
|
||||
def _user_allow(self, cr, uid, ids, statement, context={}):
|
||||
def _user_allow(self, cr, uid, statement_id, context=None):
|
||||
return True
|
||||
|
||||
def button_open(self, cr, uid, ids, context=None):
|
||||
|
||||
""" Changes statement state to Running.
|
||||
@return: True
|
||||
"""
|
||||
cash_pool = self.pool.get('account.cashbox.line')
|
||||
if context is None:
|
||||
context = {}
|
||||
statement_pool = self.pool.get('account.bank.statement')
|
||||
for statement in statement_pool.browse(cr, uid, ids, context=context):
|
||||
vals = {}
|
||||
if not self._user_allow(cr, uid, statement.id, context=context):
|
||||
raise osv.except_osv(_('Error !'), (_('User %s does not have rights to access %s journal !') % (statement.user_id.name, statement.journal_id.name)))
|
||||
|
||||
statement = statement_pool.browse(cr, uid, ids[0])
|
||||
vals = {}
|
||||
if statement.name and statement.name == '/':
|
||||
number = self.pool.get('ir.sequence').get(cr, uid, 'account.cash.statement')
|
||||
vals.update({
|
||||
'name': number
|
||||
})
|
||||
|
||||
if not self._user_allow(cr, uid, ids, statement, context={}):
|
||||
raise osv.except_osv(_('Error !'), _('User %s does not have rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name)))
|
||||
|
||||
if statement.name and statement.name == '/':
|
||||
number = self.pool.get('ir.sequence').get(cr, uid, 'account.cash.statement')
|
||||
vals.update({
|
||||
'name': number
|
||||
'date': time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'state': 'open',
|
||||
|
||||
})
|
||||
|
||||
vals.update({
|
||||
'date':time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'state':'open',
|
||||
|
||||
})
|
||||
|
||||
self.write(cr, uid, ids, vals)
|
||||
self.write(cr, uid, [statement.id], vals, context=context)
|
||||
return True
|
||||
|
||||
def balance_check(self, cr, uid, cash_id, journal_type='bank', context=None):
|
||||
@@ -357,7 +353,7 @@ class account_cash_statement(osv.osv):
|
||||
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")
|
||||
'closing_date': time.strftime("%Y-%m-%d %H:%M:%S")
|
||||
}
|
||||
return self.write(cr, uid, ids, vals, context=context)
|
||||
|
||||
@@ -368,7 +364,15 @@ class account_cash_statement(osv.osv):
|
||||
|
||||
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)
|
||||
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=None):
|
||||
cash_box_line_pool = self.pool.get('account.cashbox.line')
|
||||
super(account_cash_statement, self).button_cancel(cr, uid, ids, context=context)
|
||||
for st in self.browse(cr, uid, ids, context):
|
||||
for end in st.ending_details_ids:
|
||||
cash_box_line_pool.write(cr, uid, [end.id], {'number': 0})
|
||||
return True
|
||||
|
||||
account_cash_statement()
|
||||
|
||||
|
||||
@@ -126,6 +126,9 @@
|
||||
<field eval="time.strftime('%Y')+'-12-31'" name="date_stop"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="base.user_demo" model="res.users">
|
||||
<field name="groups_id" eval="[(4,ref('account.group_account_user'))]"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<field name="name">Close a Period</field>
|
||||
<field name="res_model">account.period</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('state','=','draft')]</field>
|
||||
<field name="view_id" ref="view_account_period_tree"/>
|
||||
<field name="help"> After closing a period, you will no longer be able to post entries to the period once it has been closed.</field>
|
||||
<field name="context">{'search_default_draft': 1}</field>
|
||||
<field name="help">A period is a fiscal period of time during which accounting entries should be recorded for accounting related activities. Monthly period is the norm but depending on your countries or company needs, you could also have quarterly periods. Closing a period will make it impossible to record new accounting entries, all new entries should then be made on the following open period. Close a period when you do not want to record new entries and want to lock this period for tax related calculation.</field>
|
||||
</record>
|
||||
<menuitem
|
||||
action="action_account_period_tree"
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
<attribute name='string'></attribute>
|
||||
</xpath>
|
||||
<group colspan="8">
|
||||
<group colspan="4" height="450" width="600">
|
||||
<group colspan="4" width="600">
|
||||
<field name="charts"/>
|
||||
<group colspan="4">
|
||||
<group colspan="4" groups="base.group_extended">
|
||||
<separator col="4" colspan="4" string="Configure Fiscal Year"/>
|
||||
<field name="company_id" colspan="4" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="date_start" on_change="on_change_start_date(date_start)"/>
|
||||
@@ -34,24 +34,24 @@
|
||||
<field name="period" colspan="4"/>
|
||||
</group>
|
||||
<group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}">
|
||||
<separator col="4" colspan="4" string="Bank and Cost Account"/>
|
||||
<field name="sale_tax" on_change="on_change_tax(sale_tax)" attrs="{'required':[('charts','=','configurable')]}"/>
|
||||
<field name="purchase_tax" groups="base.group_extended"/>
|
||||
</group>
|
||||
<group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}">
|
||||
<separator col="4" colspan="4" string="Bank and Cash Accounts"/>
|
||||
<field colspan="4" mode="tree" height="200" name="bank_accounts_id" nolabel="1" widget="one2many_list">
|
||||
<form string="">
|
||||
<field name="acc_name"/>
|
||||
<field name="account_type"/>
|
||||
<field name="currency_id" widget="selection"/>
|
||||
<field name="currency_id" widget="selection" groups="base.group_extended"/>
|
||||
</form>
|
||||
<tree editable="bottom" string="">
|
||||
<tree editable="bottom" string="Your bank and cash accounts">
|
||||
<field name="acc_name"/>
|
||||
<field name="account_type"/>
|
||||
<field name="currency_id" widget="selection"/>
|
||||
<field name="currency_id" widget="selection" groups="base.group_extended"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}">
|
||||
<field name="sale_tax" colspan="2" on_change="on_change_tax(sale_tax)"/>
|
||||
<field name="purchase_tax" colspan="2" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</data>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--
|
||||
Invoices
|
||||
-->
|
||||
@@ -36,11 +35,11 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Invoice Line">
|
||||
<field name="name"/>
|
||||
<field name="account_id" groups="base.group_user"/>
|
||||
<field name="account_id" groups="account.group_account_user"/>
|
||||
<field name="quantity"/>
|
||||
<field name="uos_id"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="discount"/>
|
||||
<field name="discount" groups="base.group_extended"/>
|
||||
<field name="price_subtotal"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -55,18 +54,18 @@
|
||||
<notebook>
|
||||
<page string="Line">
|
||||
<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 name="uos_id" widget="selection" on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, {'company_id': parent.company_id})"/>
|
||||
<field name="uos_id" on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.address_invoice_id, parent.currency_id, {'company_id': parent.company_id})"/>
|
||||
<field name="quantity"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="discount"/>
|
||||
<field name="discount" groups="base.group_extended"/>
|
||||
<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', '<>', 'view')]" name="account_id" on_change="onchange_account_id(parent.fiscal_position,account_id)" groups="base.group_user"/>
|
||||
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id" on_change="onchange_account_id(parent.fiscal_position,account_id)"/>
|
||||
<field domain="[('type','<>','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"/>
|
||||
<field colspan="4" name="invoice_line_tax_id" context="{'type':parent.type}" domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]"/>
|
||||
<separator colspan="4" string="Taxes"/>
|
||||
<field colspan="4" name="invoice_line_tax_id" context="{'type':parent.type}" domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]"
|
||||
nolabel="1"/>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
<field colspan="4" name="note" nolabel="1"/>
|
||||
@@ -85,7 +84,7 @@
|
||||
<field name="sequence"/>
|
||||
<field name="manual"/>
|
||||
<field name="name"/>
|
||||
<field name="account_id" groups="base.group_user"/>
|
||||
<field name="account_id" groups="base.group_account_user"/>
|
||||
<field name="base"/>
|
||||
<field name="amount"/>
|
||||
</tree>
|
||||
@@ -100,7 +99,7 @@
|
||||
<form string="Manual Invoice Taxes">
|
||||
<field name="name"/>
|
||||
<field name="sequence"/>
|
||||
<field name="account_id" groups="base.group_user"/>
|
||||
<field name="account_id"/>
|
||||
<field name="manual"/>
|
||||
<field name="amount"/>
|
||||
<field name="base" readonly="0"/>
|
||||
@@ -148,15 +147,15 @@
|
||||
<field name="type">form</field>
|
||||
<field name="priority">2</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Supplier invoice">
|
||||
<form string="Supplier Invoice">
|
||||
<group col="8" colspan="4">
|
||||
<field name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection"/>
|
||||
<field name="number" readonly="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="currency_id" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
|
||||
<field name="currency_id" width="50"/>
|
||||
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/>
|
||||
<newline/>
|
||||
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0}"/>
|
||||
<field string="Supplier" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"/>
|
||||
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
|
||||
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
|
||||
<newline/>
|
||||
@@ -211,11 +210,11 @@
|
||||
<field name="state"/>
|
||||
<field name="residual"/>
|
||||
<group col="6" colspan="4">
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
|
||||
<button name="%(action_account_state_open)d" type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
@@ -236,14 +235,14 @@
|
||||
<page string="Payments" groups="base.group_extended">
|
||||
<field name="payment_ids" colspan="4" nolabel="1" >
|
||||
<tree string="Payments">
|
||||
<field name="date"/>
|
||||
<field name="date" string="Payment Date"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
<field name="name" groups="base.group_extended"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="amount_currency" groups="base.group_extended"/>
|
||||
<field name="currency_id" groups="base.group_extended"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
@@ -262,10 +261,10 @@
|
||||
<field name="journal_id" groups="base.group_user" on_change="onchange_journal_id(journal_id)" widget="selection"/>
|
||||
<field name="number"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="currency_id" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
|
||||
<field name="currency_id" width="50"/>
|
||||
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/>
|
||||
<newline/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" groups="base.group_user"/>
|
||||
<field string="Customer" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" groups="base.group_user" context="{'search_default_customer': 1}"/>
|
||||
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
|
||||
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
|
||||
<newline/>
|
||||
@@ -303,14 +302,15 @@
|
||||
<field name="amount_total"/>
|
||||
<field name="state"/>
|
||||
<field name="residual"/>
|
||||
<group col="7" colspan="4" groups="base.group_user">
|
||||
<group col="8" colspan="4" groups="base.group_user">
|
||||
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
|
||||
|
||||
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Create" icon="terp-camera_test"/>
|
||||
<button name="%(action_account_invoice_refund)d" type='action' string='Refund' states='open,paid' icon="gtk-execute"/>
|
||||
<button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert" groups="base.group_no_one"/>
|
||||
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="terp-gtk-media-pause" groups="account.group_account_user"/>
|
||||
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-go-forward"/>
|
||||
<button name="%(account_invoices)d" string="Print Invoice" type="action" icon="gtk-print"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
@@ -355,15 +355,15 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Invoice">
|
||||
<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="Proforma/Open/Paid Invoices"/>
|
||||
<filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
|
||||
<filter name="proforma" icon="terp-gtk-media-pause" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices"/>
|
||||
<filter name="invoices" icon="terp-dolar" 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"/>
|
||||
<field name="number"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="user_id" select="1" default="uid" widget="selection" string="Salesman">
|
||||
<field name="user_id" select="1" widget="selection" string="Salesman">
|
||||
<filter domain="[('user_id','=',uid)]" help="My invoices" icon="terp-personal" separator="1"/>
|
||||
</field>
|
||||
<field name="origin"/>
|
||||
@@ -433,9 +433,11 @@
|
||||
<field name="domain">[('type','=','out_invoice')]</field>
|
||||
<field name="context">{'type':'out_invoice', 'journal_type': 'sale'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="help">Most of customer invoices are automatically generated in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund your customers' invoices here. A manual invoice can be created here.</field>
|
||||
<field name="help">With Customer Invoices you can create and manage sales invoices issued to your customers. OpenERP can also generate draft invoices automatically from sales orders or deliveries. You should only confirm them before sending them to your customers.</field>
|
||||
<field name="groups_id" eval="[(6,0,[ref('account.group_account_manager'),ref('account.group_account_user')])]"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
@@ -448,10 +450,11 @@
|
||||
<field name="view_id" ref="invoice_form"/>
|
||||
<field name="act_window_id" ref="action_invoice_tree1"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_invoice_tree1" id="menu_action_invoice_tree1" parent="menu_finance_receivables"/>
|
||||
|
||||
<record id="action_invoice_tree2" model="ir.actions.act_window">
|
||||
<field name="name">Vendor Invoices</field>
|
||||
<field name="name">Supplier Invoices</field>
|
||||
<field name="res_model">account.invoice</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
@@ -459,7 +462,7 @@
|
||||
<field name="domain">[('type','=','in_invoice')]</field>
|
||||
<field name="context">{'type':'in_invoice', 'journal_type': 'purchase'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="help">Proposal for vendor invoices are usually automatically generate by OpenERP, following a procurement order or a production order for instance. To consult and to check for, or to manually create a customer invoice, use this menu. You can review, confirm or cancel, pay or refund an invoice from the view from of the invoices.</field>
|
||||
<field name="help">With Supplier Invoices you can enter and manage invoices issued by your suppliers. OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice from your supplier according to what you purchased or received.</field>
|
||||
</record>
|
||||
<menuitem action="action_invoice_tree2" id="menu_action_invoice_tree2" parent="menu_finance_payables"/>
|
||||
|
||||
@@ -472,7 +475,7 @@
|
||||
<field name="domain">[('type','=','out_refund')]</field>
|
||||
<field name="context">{'type':'out_refund', 'journal_type': 'sale_refund'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="help">A customer refund is a credit note to your customer that cancel invoice or a part of it.</field>
|
||||
<field name="help">With Customer Refunds you can manage the credit notes for your customers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field>
|
||||
</record>
|
||||
|
||||
<record id="action_invoice_tree3_view1" model="ir.actions.act_window.view">
|
||||
@@ -490,7 +493,7 @@
|
||||
<menuitem action="action_invoice_tree3" id="menu_action_invoice_tree3" parent="menu_finance_receivables"/>
|
||||
|
||||
<record id="action_invoice_tree4" model="ir.actions.act_window">
|
||||
<field name="name">Vendor Refunds</field>
|
||||
<field name="name">Supplier Refunds</field>
|
||||
<field name="res_model">account.invoice</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
@@ -498,7 +501,7 @@
|
||||
<field name="domain">[('type','=','in_refund')]</field>
|
||||
<field name="context">{'type':'in_refund', 'journal_type': 'purchase_refund'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="help">A vendor refund is a credit note from your supplier indicating that he refunds part or totality of the invoice sent to you.</field>
|
||||
<field name="help">With Supplier Refunds you can manage the credit notes you receive from your suppliers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form.</field>
|
||||
</record>
|
||||
<menuitem action="action_invoice_tree4" id="menu_action_invoice_tree4" parent="menu_finance_payables"/>
|
||||
|
||||
@@ -511,20 +514,5 @@
|
||||
res_model="account.invoice"
|
||||
src_model="account.journal"/>
|
||||
|
||||
<act_window
|
||||
domain="[('account_id.reconcile', '=', True)]"
|
||||
context="{'search_default_unreconciled':True,'search_default_partner_id':[partner_id]}"
|
||||
id="act_account_invoice_account_move_unreconciled"
|
||||
name="Items to Reconcile"
|
||||
res_model="account.move.line"
|
||||
src_model="account.invoice"/>
|
||||
|
||||
<act_window
|
||||
context="{'search_default_move_id':move_id}"
|
||||
id="act_account_invoice_account_move_invoice_link"
|
||||
name="Invoice Items"
|
||||
res_model="account.move.line"
|
||||
src_model="account.invoice"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="res_roles_invoice0" model="res.roles">
|
||||
<field eval=""""Invoice"""" name="name"/>
|
||||
<field name="description">Assign this role to the persons that should have the rights to confirm a draft invoice.</field>
|
||||
</record>
|
||||
|
||||
<record id="wkf" model="workflow">
|
||||
<field name="name">account.invoice.basic</field>
|
||||
<field name="osv">account.invoice</field>
|
||||
|
||||
@@ -2,47 +2,56 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem icon="terp-account" id="menu_finance" name="Accounting" sequence="13"/>
|
||||
<menuitem id="menu_finance_receivables" name="Customers" parent="menu_finance" sequence="1" groups="group_account_user,group_account_manager"/>
|
||||
<menuitem id="menu_finance_payables" name="Vendors" parent="menu_finance" sequence="2" groups="group_account_user,group_account_manager"/>
|
||||
<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,group_account_invoice"/>
|
||||
<menuitem icon="terp-account" id="menu_finance" name="Accounting" sequence="13"
|
||||
groups="group_account_user,group_account_manager,group_account_invoice"
|
||||
web_icon="images/accounting.png"
|
||||
web_icon_hover="images/accounting-hover.png"/>
|
||||
<menuitem id="menu_finance_receivables" name="Customers" parent="menu_finance" sequence="2"/>
|
||||
<menuitem id="menu_finance_payables" name="Suppliers" parent="menu_finance" sequence="3"/>
|
||||
<menuitem id="menu_finance_bank_and_cash" name="Bank and Cash" parent="menu_finance" sequence="4"
|
||||
groups="group_account_user,group_account_manager"/>
|
||||
<menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="9" groups="group_account_user,group_account_manager"/>
|
||||
<!-- This menu is used in account_code module -->
|
||||
<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"/>
|
||||
<menuitem id="periodical_processing_journal_entries_validation" name="Draft Entries" parent="menu_finance_periodical_processing"/>
|
||||
<menuitem id="periodical_processing_reconciliation" name="Reconciliation" parent="menu_finance_periodical_processing"/>
|
||||
<menuitem id="periodical_processing_invoicing" name="Invoicing" parent="menu_finance_periodical_processing"/>
|
||||
<menuitem id="menu_finance_charts" name="Charts" parent="menu_finance" sequence="5"/>
|
||||
<menuitem id="menu_finance_reporting" name="Reporting" parent="account.menu_finance" sequence="12" groups="group_account_manager,group_account_user"/>
|
||||
<menuitem id="menu_finance_reporting_budgets" name="Budgets" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_finance_charts" name="Charts" parent="menu_finance" sequence="6"/>
|
||||
<menuitem id="menu_finance_reporting" name="Reporting" parent="account.menu_finance" sequence="13"/>
|
||||
<menuitem id="menu_finance_reporting_budgets" name="Budgets" parent="menu_finance_reporting" groups="group_account_user"/>
|
||||
<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="group_account_manager"/>
|
||||
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration" groups="group_account_manager"/>
|
||||
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration" groups="group_account_manager"/>
|
||||
<menuitem id="menu_finance_configuration" name="Configuration" parent="menu_finance" sequence="14" groups="group_account_manager"/>
|
||||
<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="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" groups="group_account_manager"/>
|
||||
<menuitem id="menu_journals" sequence="9" name="Journals" parent="menu_finance_accounting" groups="group_account_manager"/>
|
||||
<menuitem id="menu_configuration_misc" name="Miscellaneous" parent="menu_finance_configuration" sequence="30"/>
|
||||
<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="group_account_manager"/>
|
||||
<menuitem id="menu_finance_entries" name="Accounting" parent="menu_finance" sequence="4"
|
||||
groups="group_account_user,group_account_manager"/>
|
||||
<menuitem id="account.menu_finance_recurrent_entries" name="Recurring Entries" parent="menu_finance_periodical_processing" sequence="15" groups="base.group_extended"/>
|
||||
<menuitem id="menu_finance_generic_reporting" name="Generic Reporting" parent="menu_finance_reporting" sequence="100"/>
|
||||
<menuitem id="menu_finance_entries" name="Journal Entries" parent="menu_finance" sequence="5" groups="group_account_user,group_account_manager"/>
|
||||
|
||||
<menuitem id="menu_account_end_year_treatments" name="End of Period" parent="menu_finance_periodical_processing" groups="group_account_user,group_account_manager" sequence="25"/>
|
||||
<menuitem id="account.menu_finance_recurrent_entries" name="Recurring Entries"
|
||||
parent="menu_finance_periodical_processing" sequence="15"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
<menuitem id="menu_account_end_year_treatments"
|
||||
name="End of Period" parent="menu_finance_periodical_processing"
|
||||
sequence="25"/>
|
||||
<menuitem id="menu_finance_periodical_processing_billing" name="Billing" parent="menu_finance_periodical_processing" sequence="35"/>
|
||||
|
||||
<menuitem id="menu_finance_statistic_report_statement" name="Statistic Reports" parent="menu_finance_reporting" sequence="300" groups="account.group_account_manager"/>
|
||||
<menuitem id="menu_finance_statistic_report_statement" name="Statistic Reports" parent="menu_finance_reporting" sequence="300"/>
|
||||
<menuitem id="next_id_22" name="Partners" parent="menu_finance_generic_reporting" sequence="1"/>
|
||||
<menuitem
|
||||
parent="account.menu_finance_legal_statement"
|
||||
id="final_accounting_reports"
|
||||
name="Accounting Reports"/>
|
||||
|
||||
<menuitem
|
||||
parent="account.menu_finance_legal_statement"
|
||||
id="final_accounting_reports"
|
||||
name="Accounting Reports"/>
|
||||
|
||||
<menuitem
|
||||
parent="account.menu_finance_legal_statement"
|
||||
id="menu_journals_report"
|
||||
name="Journals"/>
|
||||
parent="account.menu_finance_legal_statement"
|
||||
id="menu_journals_report"
|
||||
groups="group_account_user,group_account_manager"
|
||||
name="Journals"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
+400
-338
File diff suppressed because it is too large
Load Diff
@@ -3,22 +3,23 @@
|
||||
<data>
|
||||
<report auto="False" id="account_general_ledger" menu="False" model="account.account" name="account.general.ledger" rml="account/report/account_general_ledger.rml" string="General Ledger"/>
|
||||
<report auto="False" id="account_3rdparty_ledger" menu="False" model="res.partner" name="account.third_party_ledger" rml="account/report/account_partner_ledger.rml" string="Partner Ledger"/>
|
||||
<report auto="False" id="account_3rdparty_ledger_other" menu="False" model="res.partner" name="account.third_party_ledger_other" rml="account/report/account_partner_ledger_other.rml" string="Partner Other Ledger"/>
|
||||
<report auto="False" id="account_3rdparty_ledger_other" menu="False" model="res.partner" name="account.third_party_ledger_other" rml="account/report/account_partner_ledger_other.rml" string="Partner Ledger"/>
|
||||
<report auto="False" id="account_account_balance" menu="False" model="account.account" name="account.account.balance" rml="account/report/account_balance.rml" string="Trial Balance"/>
|
||||
<report auto="False" id="account_3rdparty_account_balance" menu="False" model="account.account" name="account.partner.balance" rml="account/report/account_partner_balance.rml" string="Partner Balance"/>
|
||||
<report auto="False" id="account_central_journal" model="account.journal.period" name="account.central.journal" rml="account/report/account_central_journal.rml" string="Central Journals" header="False"/>
|
||||
<report auto="False" id="account_general_journal" model="account.journal.period" name="account.general.journal" rml="account/report/account_general_journal.rml" string="General Journals" header="False"/>
|
||||
<report auto="False" id="account_journal" model="account.journal.period" name="account.journal.period.print" rml="account/report/account_journal.rml" string="Journals" header="False"/>
|
||||
<report auto="False" id="account_overdue" model="res.partner" name="account.overdue" rml="account/report/overdue.rml" string="Overdue Payments"/>
|
||||
<report auto="False" id="account_central_journal" model="account.journal.period" name="account.central.journal" rml="account/report/account_central_journal.rml" string="Central Journal" header="False"/>
|
||||
<report auto="False" id="account_general_journal" model="account.journal.period" name="account.general.journal" rml="account/report/account_general_journal.rml" string="General Journal" header="False"/>
|
||||
<report auto="False" id="account_journal" model="account.journal.period" name="account.journal.period.print" rml="account/report/account_journal.rml" string="Journal" header="False"/>
|
||||
<report auto="False" id="account_overdue" model="res.partner" name="account.overdue" rml="account/report/account_print_overdue.rml" string="Overdue Payments"/>
|
||||
<report
|
||||
auto="False"
|
||||
id="account_invoices"
|
||||
model="account.invoice"
|
||||
name="account.invoice"
|
||||
rml="account/report/invoice.rml"
|
||||
rml="account/report/account_print_invoice.rml"
|
||||
string="Invoices"
|
||||
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/',''))"
|
||||
attachment_use="1"/>
|
||||
attachment_use="1"
|
||||
multi="True"/>
|
||||
<report id="account_transfers" model="account.transfer" name="account.transfer" string="Transfers" xml="account/report/transfer.xml" xsl="account/report/transfer.xsl"/>
|
||||
<report auto="False" id="account_intracom" menu="False" model="account.move.line" name="account.intracom" string="IntraCom"/>
|
||||
|
||||
@@ -30,14 +31,14 @@
|
||||
menu="False"
|
||||
model="account.tax.code"
|
||||
name="account.vat.declaration"
|
||||
rml="account/report/tax_report.rml"
|
||||
rml="account/report/account_tax_report.rml"
|
||||
string="Taxes Report"/>
|
||||
|
||||
<report id="report_account_voucher_new"
|
||||
string="Print Voucher"
|
||||
model="account.move"
|
||||
name="account.move.voucher"
|
||||
rml="account/report/voucher_print.rml"
|
||||
rml="account/report/account_voucher_print.rml"
|
||||
auto="False"
|
||||
header = "False"
|
||||
menu="True"/>
|
||||
@@ -45,6 +46,7 @@
|
||||
<menuitem
|
||||
id="menu_tax_report"
|
||||
name="Taxes"
|
||||
groups="group_account_user,group_account_manager"
|
||||
parent="account.menu_finance_generic_reporting" sequence="3"/>
|
||||
|
||||
<report id="account_account_balance_landscape"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- This file must be loaded _after_ account_demo.xml ! -->
|
||||
<!-- This file must be loaded _after_ account_demo.xml ! -->
|
||||
<record id="test_invoice_1" model="account.invoice">
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
@@ -14,6 +14,13 @@
|
||||
<field name="name">Test invoice 1</field>
|
||||
<field name="address_contact_id" ref="base.res_partner_address_tang"/>
|
||||
</record>
|
||||
<record id="test_tax_line" model="account.invoice.tax">
|
||||
<field name="name">Test Tax</field>
|
||||
<field name="base">5.00</field>
|
||||
<field name="amount">100.00</field>
|
||||
<field name="account_id" ref="account.ova"/>
|
||||
<field name="invoice_id" ref="test_invoice_1"/>
|
||||
</record>
|
||||
<record id="test_invoice_1_line_1" model="account.invoice.line">
|
||||
<field name="name">Basic computer with Dvorak keyboard and left-handed mouse</field>
|
||||
<field name="invoice_id" ref="test_invoice_1"/>
|
||||
@@ -28,18 +35,18 @@
|
||||
<field name="quantity">2</field>
|
||||
<field name="account_id" ref="account.a_sale"/>
|
||||
</record>
|
||||
|
||||
|
||||
<assert id="test_invoice_1" model="account.invoice" string="The currency unit of Test invoice 1 is EUR">
|
||||
<test expr="currency_id.code">EUR</test>
|
||||
<test expr="currency_id.symbol">€</test>
|
||||
</assert>
|
||||
|
||||
|
||||
<assert id="test_invoice_1" model="account.invoice" severity="error" string="The amount of Test invoice 1 is correct">
|
||||
<test expr="sum([l.price_subtotal for l in invoice_line]) == 1850"/>
|
||||
<test expr="sum([l.price_subtotal for l in invoice_line]) == amount_untaxed"/>
|
||||
</assert>
|
||||
|
||||
|
||||
<workflow action="invoice_open" model="account.invoice" ref="test_invoice_1"/>
|
||||
|
||||
|
||||
<assert id="test_invoice_1" model="account.invoice" string="Test invoice 1 is now open">
|
||||
<test expr="state">open</test>
|
||||
</assert>
|
||||
@@ -55,7 +62,7 @@
|
||||
<!-- context = --> <value eval="{}"/>
|
||||
<!-- name = --> <value eval="str('Payment from ASUStek')"/>
|
||||
</function>
|
||||
|
||||
|
||||
<assert id="test_invoice_1" model="account.invoice" string="Test invoice 1 is now paid">
|
||||
<test expr="state">paid</test>
|
||||
</assert>
|
||||
|
||||
+342
-180
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -20,7 +20,22 @@
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="domain">[('type','=','income')]</field>
|
||||
</record>
|
||||
|
||||
<record id="action_company_analysis_tree" model="ir.actions.act_window">
|
||||
<field name="name">Company Analysis</field>
|
||||
<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':['user_type'], 'group_by_no_leaf':1}</field>
|
||||
<field name="view_id" ref="account.view_account_entries_report_tree"/>
|
||||
</record>
|
||||
<record id="action_treasory_graph" model="ir.actions.act_window">
|
||||
<field name="name">Treasury</field>
|
||||
<field name="res_model">account.account</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="domain">[('type','=','liquidity')]</field>
|
||||
<field name="view_id" ref="account.view_treasory_graph"/>
|
||||
</record>
|
||||
<record id="board_account_form" model="ir.ui.view">
|
||||
<field name="name">board.account.form</field>
|
||||
<field name="model">board.board</field>
|
||||
@@ -29,11 +44,13 @@
|
||||
<form string="Account Board">
|
||||
<hpaned>
|
||||
<child1>
|
||||
<action colspan="4" height="160" width="400" name="%(account.action_invoice_tree1)d" string="Draft Customer Invoices" domain="[('state','=','draft'),('type','=','out_invoice')]"/>
|
||||
<action colspan="4" height="160" width="400" name="%(account.action_invoice_tree1)d" string="Customer Invoices to Approve" domain="[('state','=','draft'),('type','=','out_invoice')]"/>
|
||||
<action colspan="4" height="160" width="400" name="%(action_company_analysis_tree)d" string="Company Analysis" groups="account.group_account_manager"/>
|
||||
</child1>
|
||||
<child2>
|
||||
<action colspan="4" height="220" name="%(action_aged_receivable)d" string="Aged receivables"/>
|
||||
<action colspan="4" height="220" name="%(action_aged_income)d" string="Aged income"/>
|
||||
<action colspan="4" height="220" name="%(action_treasory_graph)d" string="Treasury" groups="account.group_account_manager,account.group_account_user"/>
|
||||
<action colspan="4" height="220" name="%(action_aged_receivable)d" string="Aged Receivables" groups="account.group_account_manager,account.group_account_user"/>
|
||||
<!-- <action colspan="4" height="220" name="%(action_aged_income)d" string="Aged income"/> -->
|
||||
</child2>
|
||||
</hpaned>
|
||||
</form>
|
||||
@@ -51,6 +68,8 @@
|
||||
|
||||
<menuitem id="menu_dashboard_acc" name="Dashboard" sequence="2" parent="account.menu_finance_reporting" groups="group_account_user,group_account_manager"/>
|
||||
<menuitem action="open_board_account" icon="terp-graph" id="menu_board_account" parent="menu_dashboard_acc" sequence="1"/>
|
||||
<menuitem icon="terp-account" id="account.menu_finance" name="Accounting" sequence="13" action="open_board_account"/>
|
||||
<menuitem icon="terp-account" id="account.menu_finance" name="Accounting" sequence="14" action="open_board_account"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -32,14 +32,15 @@ class res_company(osv.osv):
|
||||
string="Reserve and Profit/Loss Account",
|
||||
method=True,
|
||||
view_load=True,
|
||||
domain="[('type', '=', 'payable')]",
|
||||
help="This Account is used for transferring Profit/Loss(If It is Profit : Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profit & Loss Report"),
|
||||
domain="[('type', '=', 'other')]",
|
||||
help="This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss : Amount will be deducted.), Which is calculated from Profit & Loss Report"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'overdue_msg': 'Would your payment have been carried \
|
||||
out after this mail was sent, please consider the present one as \
|
||||
void. Do not hesitate to contact our accounting department'
|
||||
'overdue_msg': 'Please note that the following payments are now due. If your payment \
|
||||
has been sent, kindly forward your payment details. If payment will be \
|
||||
delayed further, please contact us to discuss. \
|
||||
\nWould your payment have been carried out after this mail was sent, please consider the present one as void.'
|
||||
}
|
||||
|
||||
res_company()
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
<field name="code">1113</field>
|
||||
<field name="name">Reserve and Profit/Loss Account</field>
|
||||
<field ref="conf_cli" name="parent_id"/>
|
||||
<field name="type">payable</field>
|
||||
<field name="type">other</field>
|
||||
<field eval="True" name="reconcile"/>
|
||||
<field name="user_type" ref="conf_account_type_liability"/>
|
||||
</record>
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="analytic_journal_sale" model="account.analytic.journal">
|
||||
<field name="name">Sales</field>
|
||||
<field name="type">sale</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Payment term
|
||||
-->
|
||||
<record id="account_payment_term" model="account.payment.term">
|
||||
<field name="name">30 Days End of Month</field>
|
||||
<field name="note">30 Days End of Month</field>
|
||||
</record>
|
||||
<record id="account_payment_term_line" model="account.payment.term.line">
|
||||
<field name="name">30 Days End of Month</field>
|
||||
@@ -465,13 +471,42 @@
|
||||
<field eval="3" name="padding"/>
|
||||
<field name="prefix">SAJ/%(year)s/</field>
|
||||
</record>
|
||||
<record id="sequence_refund_sales_journal" model="ir.sequence">
|
||||
<field name="name">Sales Credit Note Journal</field>
|
||||
<field name="code">account.journal</field>
|
||||
<field eval="3" name="padding"/>
|
||||
<field name="prefix">SCNJ/%(year)s/</field>
|
||||
</record>
|
||||
<record id="sequence_purchase_journal" model="ir.sequence">
|
||||
<field name="name">Purchase Journal</field>
|
||||
<field name="code">account.journal</field>
|
||||
<field eval="3" name="padding"/>
|
||||
<field name="prefix">EXJ/%(year)s/</field>
|
||||
</record>
|
||||
|
||||
<record id="sequence_refund_purchase_journal" model="ir.sequence">
|
||||
<field name="name">Expenses Credit Notes Journal</field>
|
||||
<field name="code">account.journal</field>
|
||||
<field eval="3" name="padding"/>
|
||||
<field name="prefix">ECNJ/%(year)s/</field>
|
||||
</record>
|
||||
<record id="sequence_bank_journal" model="ir.sequence">
|
||||
<field name="name">Bank Journal</field>
|
||||
<field name="code">account.journal</field>
|
||||
<field eval="3" name="padding"/>
|
||||
<field name="prefix">BNK/%(year)s/</field>
|
||||
</record>
|
||||
<record id="sequence_check_journal" model="ir.sequence">
|
||||
<field name="name">Checks Journal</field>
|
||||
<field name="code">account.journal</field>
|
||||
<field eval="3" name="padding"/>
|
||||
<field name="prefix">CHK/%(year)s/</field>
|
||||
</record>
|
||||
<record id="sequence_cash_journal" model="ir.sequence">
|
||||
<field name="name">Cash Journal</field>
|
||||
<field name="code">account.journal</field>
|
||||
<field eval="3" name="padding"/>
|
||||
<field name="prefix">CSH/%(year)s/</field>
|
||||
</record>
|
||||
<!--
|
||||
Account Statement Sequences
|
||||
-->
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
<field ref="cas" name="parent_id"/>
|
||||
<field name="type">receivable</field>
|
||||
<field eval="True" name="reconcile"/>
|
||||
<field name="user_type" ref="account_type_asset"/>
|
||||
<field name="user_type" ref="account_type_receivable"/>
|
||||
</record>
|
||||
|
||||
<record id="ova" model="account.account">
|
||||
@@ -186,7 +186,7 @@
|
||||
<field ref="cli" name="parent_id"/>
|
||||
<field name="type">payable</field>
|
||||
<field eval="True" name="reconcile"/>
|
||||
<field name="user_type" ref="account_type_liability"/>
|
||||
<field name="user_type" ref="account_type_payable"/>
|
||||
</record>
|
||||
|
||||
<record id="iva" model="account.account">
|
||||
@@ -201,7 +201,7 @@
|
||||
<field name="code">X1113</field>
|
||||
<field name="name">Reserve and Profit/Loss - (test)</field>
|
||||
<field ref="cli" name="parent_id"/>
|
||||
<field name="type">payable</field>
|
||||
<field name="type">other</field>
|
||||
<field name="user_type" ref="account_type_liability"/>
|
||||
</record>
|
||||
|
||||
@@ -342,7 +342,7 @@
|
||||
|
||||
<record id="sales_journal" model="account.journal">
|
||||
<field name="name">Sales Journal - (test)</field>
|
||||
<field name="code">SAJ</field>
|
||||
<field name="code">TSAJ</field>
|
||||
<field name="type">sale</field>
|
||||
<field name="view_id" ref="account_sp_journal_view"/>
|
||||
<field name="sequence_id" ref="sequence_sale_journal"/>
|
||||
@@ -353,11 +353,11 @@
|
||||
</record>
|
||||
<record id="refund_sales_journal" model="account.journal">
|
||||
<field name="name">Sales Credit Note Journal - (test)</field>
|
||||
<field name="code">SCNJ</field>
|
||||
<field name="code">TSCNJ</field>
|
||||
<field name="type">sale_refund</field>
|
||||
<field eval="True" name="refund_journal"/>
|
||||
<field name="view_id" ref="account_sp_refund_journal_view"/>
|
||||
<field name="sequence_id" ref="sequence_sale_journal"/>
|
||||
<field name="sequence_id" ref="sequence_refund_sales_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"/>
|
||||
@@ -366,7 +366,7 @@
|
||||
|
||||
<record id="expenses_journal" model="account.journal">
|
||||
<field name="name">Expenses Journal - (test)</field>
|
||||
<field name="code">EXJ</field>
|
||||
<field name="code">TEXJ</field>
|
||||
<field name="type">purchase</field>
|
||||
<field name="view_id" ref="account_sp_journal_view"/>
|
||||
<field name="sequence_id" ref="sequence_purchase_journal"/>
|
||||
@@ -377,11 +377,11 @@
|
||||
</record>
|
||||
<record id="refund_expenses_journal" model="account.journal">
|
||||
<field name="name">Expenses Credit Notes Journal - (test)</field>
|
||||
<field name="code">ECNJ</field>
|
||||
<field name="code">TECNJ</field>
|
||||
<field name="type">purchase_refund</field>
|
||||
<field eval="True" name="refund_journal"/>
|
||||
<field name="view_id" ref="account_sp_refund_journal_view"/>
|
||||
<field name="sequence_id" ref="sequence_purchase_journal"/>
|
||||
<field name="sequence_id" ref="sequence_refund_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"/>
|
||||
@@ -390,10 +390,10 @@
|
||||
|
||||
<record id="bank_journal" model="account.journal">
|
||||
<field name="name">Bank Journal - (test)</field>
|
||||
<field name="code">BNK</field>
|
||||
<field name="code">TBNK</field>
|
||||
<field name="type">bank</field>
|
||||
<field name="view_id" ref="account_journal_bank_view"/>
|
||||
<field name="sequence_id" ref="sequence_journal"/>
|
||||
<field name="sequence_id" ref="sequence_bank_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"/>
|
||||
@@ -401,10 +401,10 @@
|
||||
</record>
|
||||
<record id="check_journal" model="account.journal">
|
||||
<field name="name">Checks Journal - (test)</field>
|
||||
<field name="code">CHK</field>
|
||||
<field name="code">TCHK</field>
|
||||
<field name="type">bank</field>
|
||||
<field name="view_id" ref="account_journal_bank_view"/>
|
||||
<field name="sequence_id" ref="sequence_journal"/>
|
||||
<field name="sequence_id" ref="sequence_check_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"/>
|
||||
@@ -412,10 +412,10 @@
|
||||
</record>
|
||||
<record id="cash_journal" model="account.journal">
|
||||
<field name="name">Cash Journal - (test)</field>
|
||||
<field name="code">CSH</field>
|
||||
<field name="code">TCSH</field>
|
||||
<field name="type">cash</field>
|
||||
<field name="view_id" ref="account_journal_bank_view"/>
|
||||
<field name="sequence_id" ref="sequence_journal"/>
|
||||
<field name="sequence_id" ref="sequence_cash_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"/>
|
||||
@@ -438,6 +438,5 @@
|
||||
<field eval="'account.account,'+str(ref('account.a_sale'))" model="account.account" name="value"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
+7595
-4633
File diff suppressed because it is too large
Load Diff
+8335
-5002
File diff suppressed because it is too large
Load Diff
+8910
-5264
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+9839
-5341
File diff suppressed because it is too large
Load Diff
+10036
-5261
File diff suppressed because it is too large
Load Diff
+8471
-5016
File diff suppressed because it is too large
Load Diff
+8402
-4996
File diff suppressed because it is too large
Load Diff
+10838
-5410
File diff suppressed because it is too large
Load Diff
+9888
-5528
File diff suppressed because it is too large
Load Diff
+10605
-5491
File diff suppressed because it is too large
Load Diff
+9774
-5509
File diff suppressed because it is too large
Load Diff
+10918
-5384
File diff suppressed because it is too large
Load Diff
+9040
-5170
File diff suppressed because it is too large
Load Diff
+8299
-5012
File diff suppressed because it is too large
Load Diff
+8293
-5025
File diff suppressed because it is too large
Load Diff
+9856
-5381
File diff suppressed because it is too large
Load Diff
+10619
-5366
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+8470
-5062
File diff suppressed because it is too large
Load Diff
+8331
-5035
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+9575
-5231
File diff suppressed because it is too large
Load Diff
+8573
-4986
File diff suppressed because it is too large
Load Diff
+8688
-5048
File diff suppressed because it is too large
Load Diff
+9415
-5071
File diff suppressed because it is too large
Load Diff
+8292
-5011
File diff suppressed because it is too large
Load Diff
+8447
-5053
File diff suppressed because it is too large
Load Diff
+9476
-5421
File diff suppressed because it is too large
Load Diff
+8867
-5214
File diff suppressed because it is too large
Load Diff
+10026
-5327
File diff suppressed because it is too large
Load Diff
+8291
-5020
File diff suppressed because it is too large
Load Diff
+10010
-5498
File diff suppressed because it is too large
Load Diff
+8918
-5150
File diff suppressed because it is too large
Load Diff
+8511
-5060
File diff suppressed because it is too large
Load Diff
+10293
-5578
File diff suppressed because it is too large
Load Diff
+9998
-5154
File diff suppressed because it is too large
Load Diff
+9972
-5604
File diff suppressed because it is too large
Load Diff
+10115
-5380
File diff suppressed because it is too large
Load Diff
+9333
-5208
File diff suppressed because it is too large
Load Diff
+8289
-5012
File diff suppressed because it is too large
Load Diff
+8337
-5020
File diff suppressed because it is too large
Load Diff
+9295
-5095
File diff suppressed because it is too large
Load Diff
+8521
-5074
File diff suppressed because it is too large
Load Diff
+9671
-5009
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+9723
-5048
File diff suppressed because it is too large
Load Diff
+8294
-5010
File diff suppressed because it is too large
Load Diff
+8406
-5052
File diff suppressed because it is too large
Load Diff
+8304
-5021
File diff suppressed because it is too large
Load Diff
+8285
-5013
File diff suppressed because it is too large
Load Diff
+20249
-5106
File diff suppressed because it is too large
Load Diff
+8298
-5011
File diff suppressed because it is too large
Load Diff
+8892
-5137
File diff suppressed because it is too large
Load Diff
+9469
-5270
File diff suppressed because it is too large
Load Diff
+9855
-5158
File diff suppressed because it is too large
Load Diff
+8311
-5025
File diff suppressed because it is too large
Load Diff
+8306
-5013
File diff suppressed because it is too large
Load Diff
+347
-299
@@ -35,55 +35,52 @@ class account_installer(osv.osv_memory):
|
||||
_inherit = 'res.config.installer'
|
||||
|
||||
def _get_default_accounts(self, cr, uid, context=None):
|
||||
accounts = [{'acc_name':'Current','account_type':'bank'},
|
||||
{'acc_name':'Deposit','account_type':'bank'},
|
||||
{'acc_name':'Cash','account_type':'cash'}]
|
||||
accounts = [{'acc_name': 'Current', 'account_type': 'bank'},
|
||||
{'acc_name': 'Deposit', 'account_type': 'bank'},
|
||||
{'acc_name': 'Cash', 'account_type': 'cash'}]
|
||||
return accounts
|
||||
|
||||
def _get_charts(self, cr, uid, context=None):
|
||||
modules = self.pool.get('ir.module.module')
|
||||
ids = modules.search(cr, uid, [('category_id','=','Account Charts')])
|
||||
ids = modules.search(cr, uid, [('category_id', '=', 'Account Charts')], context=context)
|
||||
charts = list(
|
||||
sorted(((m.name, m.shortdesc)
|
||||
for m in modules.browse(cr, uid, ids)),
|
||||
for m in modules.browse(cr, uid, ids, context=context)),
|
||||
key=itemgetter(1)))
|
||||
charts.insert(0,('configurable','Generic Chart Of Account'))
|
||||
charts.insert(0, ('configurable', 'Generic Chart Of Account'))
|
||||
return charts
|
||||
|
||||
_columns = {
|
||||
# Accounting
|
||||
'charts':fields.selection(_get_charts, 'Chart of Accounts',
|
||||
'charts': fields.selection(_get_charts, 'Chart of Accounts',
|
||||
required=True,
|
||||
help="Installs localized accounting charts to match as closely as "
|
||||
"possible the accounting needs of your company based on your "
|
||||
"country."),
|
||||
'date_start': fields.date('Start Date', required=True),
|
||||
'date_stop': fields.date('End Date', required=True),
|
||||
'period':fields.selection([('month','Monthly'), ('3months','3 Monthly')],
|
||||
'Periods', required=True),
|
||||
'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Bank Accounts',required=True),
|
||||
'sale_tax':fields.float('Sale Tax(%)'),
|
||||
'purchase_tax':fields.float('Purchase Tax(%)'),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'period': fields.selection([('month', 'Monthly'), ('3months','3 Monthly')], 'Periods', required=True),
|
||||
'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Your Bank and Cash Accounts'),
|
||||
'sale_tax': fields.float('Sale Tax(%)'),
|
||||
'purchase_tax': fields.float('Purchase Tax(%)'),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
}
|
||||
|
||||
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
|
||||
return user.company_id and user.company_id.id or False
|
||||
|
||||
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)
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
|
||||
address_id = self.pool.get('res.partner').address_get(cr, uid, [company.partner_id.id])
|
||||
if address_id['default']:
|
||||
address = self.pool.get('res.partner.address').browse(cr, uid, address_id['default'])
|
||||
address = self.pool.get('res.partner.address').browse(cr, uid, address_id['default'], context=context)
|
||||
code = address.country_id.code
|
||||
module_name = (code and 'l10n_' + code.lower()) or False
|
||||
if module_name:
|
||||
module_id = self.pool.get('ir.module.module').search(cr, uid, [('name', '=', module_name)])
|
||||
module_id = self.pool.get('ir.module.module').search(cr, uid, [('name', '=', module_name)], context=context)
|
||||
if module_id:
|
||||
return module_name
|
||||
return 'configurable'
|
||||
@@ -91,42 +88,71 @@ 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': 'month',
|
||||
'sale_tax': 0.0,
|
||||
'purchase_tax': 0.0,
|
||||
'company_id': _default_company,
|
||||
'bank_accounts_id': _get_default_accounts,
|
||||
'charts': _get_default_charts
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(account_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
|
||||
configured_cmp = []
|
||||
unconfigured_cmp = []
|
||||
cmp_select = []
|
||||
company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
|
||||
#display in the widget selection of companies, only the companies that haven't been configured yet (but don't care about the demo chart of accounts)
|
||||
cr.execute("SELECT company_id FROM account_account WHERE active = 't' AND account_account.parent_id IS NULL AND name != %s", ("Chart For Automated Tests",))
|
||||
configured_cmp = [r[0] for r in cr.fetchall()]
|
||||
unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
|
||||
for field in res['fields']:
|
||||
if field == 'company_id':
|
||||
res['fields'][field]['domain'] = unconfigured_cmp
|
||||
res['fields'][field]['selection'] = [('', '')]
|
||||
if unconfigured_cmp:
|
||||
cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
|
||||
res['fields'][field]['selection'] = cmp_select
|
||||
return res
|
||||
|
||||
def on_change_tax(self, cr, uid, id, tax):
|
||||
return {'value':{'purchase_tax':tax}}
|
||||
return {'value': {'purchase_tax': tax}}
|
||||
|
||||
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)
|
||||
return {'value':{'date_stop':end_date.strftime('%Y-%m-%d')}}
|
||||
return {'value': {'date_stop': end_date.strftime('%Y-%m-%d')}}
|
||||
return {}
|
||||
|
||||
def generate_configurable_chart(self, cr, uid, ids, context=None):
|
||||
obj_acc = self.pool.get('account.account')
|
||||
obj_acc_tax = self.pool.get('account.tax')
|
||||
obj_journal = self.pool.get('account.journal')
|
||||
obj_sequence = self.pool.get('ir.sequence')
|
||||
obj_acc_tax_code = self.pool.get('account.tax.code')
|
||||
obj_acc_template = self.pool.get('account.account.template')
|
||||
obj_acc_tax_template = self.pool.get('account.tax.code.template')
|
||||
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
|
||||
obj_fiscal_position = self.pool.get('account.fiscal.position')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
analytic_journal_obj = self.pool.get('account.analytic.journal')
|
||||
obj_acc_chart_template = self.pool.get('account.chart.template')
|
||||
obj_acc_journal_view = self.pool.get('account.journal.view')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
obj_sequence = self.pool.get('ir.sequence')
|
||||
property_obj = self.pool.get('ir.property')
|
||||
fields_obj = self.pool.get('ir.model.fields')
|
||||
obj_tax_fp = self.pool.get('account.fiscal.position.tax')
|
||||
obj_ac_fp = self.pool.get('account.fiscal.position.account')
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'configurable_chart_template')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
obj_multi = self.pool.get('account.chart.template').browse(cr, uid, id)
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'configurable_chart_template')
|
||||
id = result and result[1] or False
|
||||
obj_multi = obj_acc_chart_template.browse(cr, uid, id, context=context)
|
||||
|
||||
record = self.browse(cr, uid, ids, context=context)[0]
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
company_id = self.browse(cr, uid, ids, context)[0].company_id
|
||||
company_id = self.browse(cr, uid, ids, context=context)[0].company_id
|
||||
seq_journal = True
|
||||
|
||||
# Creating Account
|
||||
@@ -140,10 +166,10 @@ class account_installer(osv.osv_memory):
|
||||
todo_dict = {}
|
||||
|
||||
#create all the tax code
|
||||
children_tax_code_template = self.pool.get('account.tax.code.template').search(cr, uid, [('parent_id','child_of',[tax_code_root_id])], order='id')
|
||||
children_tax_code_template = obj_acc_tax_template.search(cr, uid, [('parent_id', 'child_of', [tax_code_root_id])], order='id')
|
||||
children_tax_code_template.sort()
|
||||
for tax_code_template in self.pool.get('account.tax.code.template').browse(cr, uid, children_tax_code_template):
|
||||
vals={
|
||||
for tax_code_template in obj_acc_tax_template.browse(cr, uid, children_tax_code_template, context=context):
|
||||
vals = {
|
||||
'name': (tax_code_root_id == tax_code_template.id) and company_id.name or tax_code_template.name,
|
||||
'code': tax_code_template.code,
|
||||
'info': tax_code_template.info,
|
||||
@@ -151,7 +177,7 @@ class account_installer(osv.osv_memory):
|
||||
'company_id': company_id.id,
|
||||
'sign': tax_code_template.sign,
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals)
|
||||
new_tax_code = obj_acc_tax_code.create(cr, uid, vals, context=context)
|
||||
#recording the new tax code to do the mapping
|
||||
tax_code_template_ref[tax_code_template.id] = new_tax_code
|
||||
|
||||
@@ -159,12 +185,12 @@ class account_installer(osv.osv_memory):
|
||||
for tax in obj_multi.tax_template_ids:
|
||||
#create it
|
||||
vals_tax = {
|
||||
'name':tax.name,
|
||||
'name': tax.name,
|
||||
'sequence': tax.sequence,
|
||||
'amount':tax.amount,
|
||||
'type':tax.type,
|
||||
'amount': tax.amount,
|
||||
'type': tax.type,
|
||||
'applicable_type': tax.applicable_type,
|
||||
'domain':tax.domain,
|
||||
'domain': tax.domain,
|
||||
'parent_id': tax.parent_id and ((tax.parent_id.id in tax_template_ref) and tax_template_ref[tax.parent_id.id]) or False,
|
||||
'child_depend': tax.child_depend,
|
||||
'python_compute': tax.python_compute,
|
||||
@@ -179,11 +205,12 @@ class account_installer(osv.osv_memory):
|
||||
'ref_base_sign': tax.ref_base_sign,
|
||||
'ref_tax_sign': tax.ref_tax_sign,
|
||||
'include_base_amount': tax.include_base_amount,
|
||||
'description':tax.description,
|
||||
'description': tax.description,
|
||||
'company_id': company_id.id,
|
||||
'type_tax_use': tax.type_tax_use
|
||||
'type_tax_use': tax.type_tax_use,
|
||||
'price_include': tax.price_include
|
||||
}
|
||||
new_tax = obj_acc_tax.create(cr, uid, vals_tax)
|
||||
new_tax = obj_acc_tax.create(cr, uid, vals_tax, context=context)
|
||||
#as the accounts have not been created yet, we have to wait before filling these fields
|
||||
todo_dict[new_tax] = {
|
||||
'account_collected_id': tax.account_collected_id and tax.account_collected_id.id or False,
|
||||
@@ -192,11 +219,12 @@ class account_installer(osv.osv_memory):
|
||||
tax_template_ref[tax.id] = new_tax
|
||||
|
||||
#deactivate the parent_store functionnality on account_account for rapidity purpose
|
||||
self.pool._init = True
|
||||
ctx = context and context.copy() or {}
|
||||
ctx['defer_parent_store_computation'] = True
|
||||
|
||||
children_acc_template = obj_acc_template.search(cr, uid, [('parent_id','child_of',[obj_acc_root.id]),('nocreate','!=',True)])
|
||||
children_acc_template = obj_acc_template.search(cr, uid, [('parent_id', 'child_of', [obj_acc_root.id]), ('nocreate', '!=', True)], context=context)
|
||||
children_acc_template.sort()
|
||||
for account_template in obj_acc_template.browse(cr, uid, children_acc_template):
|
||||
for account_template in obj_acc_template.browse(cr, uid, children_acc_template, context=context):
|
||||
tax_ids = []
|
||||
for tax in account_template.tax_ids:
|
||||
tax_ids.append(tax_template_ref[tax.id])
|
||||
@@ -205,9 +233,9 @@ class account_installer(osv.osv_memory):
|
||||
dig = 6
|
||||
code_main = account_template.code and len(account_template.code) or 0
|
||||
code_acc = account_template.code or ''
|
||||
if code_main>0 and code_main<=dig and account_template.type != 'view':
|
||||
code_acc=str(code_acc) + (str('0'*(dig-code_main)))
|
||||
vals={
|
||||
if code_main > 0 and code_main <= dig and account_template.type != 'view':
|
||||
code_acc = str(code_acc) + (str('0'*(dig-code_main)))
|
||||
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,
|
||||
@@ -218,13 +246,13 @@ class account_installer(osv.osv_memory):
|
||||
'shortcut': account_template.shortcut,
|
||||
'note': account_template.note,
|
||||
'parent_id': account_template.parent_id and ((account_template.parent_id.id in acc_template_ref) and acc_template_ref[account_template.parent_id.id]) or False,
|
||||
'tax_ids': [(6,0,tax_ids)],
|
||||
'tax_ids': [(6, 0, tax_ids)],
|
||||
'company_id': company_id.id,
|
||||
}
|
||||
new_account = obj_acc.create(cr, uid, vals)
|
||||
new_account = obj_acc.create(cr, uid, vals, context=ctx)
|
||||
acc_template_ref[account_template.id] = new_account
|
||||
if account_template.name == 'Bank Current Account':
|
||||
b_vals={
|
||||
b_vals = {
|
||||
'name': 'Bank Accounts',
|
||||
'code': '110500',
|
||||
'type': 'view',
|
||||
@@ -235,104 +263,113 @@ class account_installer(osv.osv_memory):
|
||||
'tax_ids': [(6,0,tax_ids)],
|
||||
'company_id': company_id.id,
|
||||
}
|
||||
bank_account = obj_acc.create(cr, uid, b_vals)
|
||||
bank_account = obj_acc.create(cr, uid, b_vals, context=ctx)
|
||||
|
||||
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
|
||||
view_id_cash = obj_acc_journal_view.search(cr, uid, [('name', '=', 'Bank/Cash Journal View')], context=context)[0] #why fixed name here?
|
||||
view_id_cur = obj_acc_journal_view.search(cr, uid, [('name', '=', 'Bank/Cash Journal (Multi-Currency) View')], context=context)[0] #Why Fixed name here?
|
||||
|
||||
cash_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_cash')
|
||||
cash_type_id = mod_obj.read(cr, uid, [cash_result], ['res_id'])[0]['res_id']
|
||||
cash_result = mod_obj.get_object_reference(cr, uid, 'account', 'conf_account_type_cash')
|
||||
cash_type_id = cash_result and cash_result[1] or False
|
||||
|
||||
bank_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_bnk')
|
||||
bank_type_id = mod_obj.read(cr, uid, [bank_result], ['res_id'])[0]['res_id']
|
||||
bank_result = mod_obj.get_object_reference(cr, uid, 'account', 'conf_account_type_bnk')
|
||||
bank_type_id = bank_result and bank_result[1] or False
|
||||
|
||||
check_result = mod_obj._get_id(cr, uid, 'account', 'conf_account_type_chk')
|
||||
check_type_id = mod_obj.read(cr, uid, [check_result], ['res_id'])[0]['res_id']
|
||||
check_result = mod_obj.get_object_reference(cr, uid, 'account', 'conf_account_type_chk')
|
||||
check_type_id = check_result and check_result[1] or False
|
||||
|
||||
record = self.browse(cr, uid, ids, context=context)[0]
|
||||
# record = self.browse(cr, uid, ids, context=context)[0]
|
||||
code_cnt = 1
|
||||
vals_seq = {
|
||||
'name': _('Bank Journal '),
|
||||
'code': 'account.journal',
|
||||
'prefix': 'BAN/',
|
||||
'padding': 5
|
||||
}
|
||||
seq_id = obj_sequence.create(cr,uid,vals_seq)
|
||||
'name': _('Bank Journal '),
|
||||
'code': 'account.journal',
|
||||
'prefix': 'BNK/%(year)s/',
|
||||
'company_id': company_id.id,
|
||||
'padding': 5
|
||||
}
|
||||
seq_id = obj_sequence.create(cr, uid, vals_seq, context=context)
|
||||
|
||||
#create the bank journals
|
||||
analitical_bank_ids = analytic_journal_obj.search(cr,uid,[('type','=','situation')])
|
||||
analitical_bank_ids = analytic_journal_obj.search(cr, uid, [('type', '=', 'situation')], context=context)
|
||||
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'] = 'bank'
|
||||
vals_journal['analytic_journal_id'] = analitical_journal_bank
|
||||
vals_journal = {
|
||||
'name': _('Bank Journal '),
|
||||
'code': _('BNK'),
|
||||
'sequence_id': seq_id,
|
||||
'type': 'bank',
|
||||
'company_id': company_id.id,
|
||||
'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)
|
||||
vals_journal.update({
|
||||
'view_id': view_id_cur,
|
||||
'currency': vals.get('currency_id', False)
|
||||
})
|
||||
else:
|
||||
vals_journal['view_id'] = view_id_cash
|
||||
vals_journal['default_credit_account_id'] = new_account
|
||||
vals_journal['default_debit_account_id'] = new_account
|
||||
obj_journal.create(cr,uid,vals_journal)
|
||||
vals_journal.update({'view_id': view_id_cash})
|
||||
vals_journal.update({
|
||||
'default_credit_account_id': new_account,
|
||||
'default_debit_account_id': new_account,
|
||||
})
|
||||
obj_journal.create(cr, uid, vals_journal, context=context)
|
||||
|
||||
for val in record.bank_accounts_id:
|
||||
seq_prefix = None
|
||||
seq_padding = 5
|
||||
if val.account_type == 'cash':
|
||||
type = cash_type_id
|
||||
seq_prefix = "CSH/"
|
||||
elif val.account_type == 'bank':
|
||||
type = bank_type_id
|
||||
seq_prefix = "BAN/"
|
||||
elif val.account_type == 'check':
|
||||
type = check_type_id
|
||||
seq_prefix = "CHK/"
|
||||
else:
|
||||
type = check_type_id
|
||||
seq_padding = None
|
||||
|
||||
vals_bnk = {'name': val.acc_name or '',
|
||||
vals_bnk = {
|
||||
'name': val.acc_name or '',
|
||||
'currency_id': val.currency_id.id or False,
|
||||
'code': str(110500 + code_cnt),
|
||||
'type': 'liquidity',
|
||||
'user_type': type,
|
||||
'parent_id':bank_account,
|
||||
'company_id': company_id.id }
|
||||
child_bnk_acc = obj_acc.create(cr, uid, vals_bnk)
|
||||
'parent_id': bank_account,
|
||||
'company_id': company_id.id
|
||||
}
|
||||
child_bnk_acc = obj_acc.create(cr, uid, vals_bnk, context=ctx)
|
||||
vals_seq_child = {
|
||||
'name': _(vals_bnk['name']),
|
||||
'name': _(vals_bnk['name'] + ' ' + 'Journal'),
|
||||
'code': 'account.journal',
|
||||
'prefix': seq_prefix,
|
||||
'prefix': _((vals_bnk['name'][:3].upper()) + '/%(year)s/'),
|
||||
'padding': seq_padding
|
||||
}
|
||||
seq_id = obj_sequence.create(cr, uid, vals_seq_child)
|
||||
}
|
||||
seq_id = obj_sequence.create(cr, uid, vals_seq_child, context=context)
|
||||
|
||||
#create the bank journal
|
||||
vals_journal = {}
|
||||
vals_journal['name']= vals_bnk['name'] + ' Journal'
|
||||
vals_journal['code']= _(vals_bnk['name'][:3])
|
||||
vals_journal['sequence_id'] = seq_id
|
||||
vals_journal['type'] = 'cash'
|
||||
vals_journal = {
|
||||
'name': vals_bnk['name'] + _(' Journal'),
|
||||
'code': _(vals_bnk['name'][:3]).upper(),
|
||||
'sequence_id': seq_id,
|
||||
'type': 'cash',
|
||||
'company_id': company_id.id
|
||||
}
|
||||
if vals.get('currency_id', False):
|
||||
vals_journal['view_id'] = view_id_cur
|
||||
vals_journal['currency'] = vals_bnk.get('currency_id', False)
|
||||
vals_journal.update({
|
||||
'view_id': view_id_cur,
|
||||
'currency': vals_bnk.get('currency_id', False),
|
||||
})
|
||||
else:
|
||||
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)
|
||||
vals_journal.update({'view_id': view_id_cash})
|
||||
vals_journal.update({
|
||||
'default_credit_account_id': child_bnk_acc,
|
||||
'default_debit_account_id': child_bnk_acc,
|
||||
'analytic_journal_id': analitical_journal_bank
|
||||
})
|
||||
obj_journal.create(cr, uid, vals_journal, context=context)
|
||||
code_cnt += 1
|
||||
|
||||
|
||||
#reactivate the parent_store functionality on account_account
|
||||
self.pool._init = False
|
||||
self.pool.get('account.account')._parent_store_compute(cr)
|
||||
obj_acc._parent_store_compute(cr)
|
||||
|
||||
for key,value in todo_dict.items():
|
||||
for key, value in todo_dict.items():
|
||||
if value['account_collected_id'] or value['account_paid_id']:
|
||||
obj_acc_tax.write(cr, uid, [key], {
|
||||
'account_collected_id': acc_template_ref[value['account_collected_id']],
|
||||
@@ -340,174 +377,193 @@ class account_installer(osv.osv_memory):
|
||||
})
|
||||
|
||||
# Creating Journals Sales and Purchase
|
||||
vals_journal={}
|
||||
data_id = mod_obj.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
|
||||
data = mod_obj.browse(cr, uid, data_id[0])
|
||||
vals_journal = {}
|
||||
data_id = mod_obj.search(cr, uid, [('model', '=', 'account.journal.view'), ('name', '=', 'account_sp_journal_view')], context=context)
|
||||
data = mod_obj.browse(cr, uid, data_id[0], context=context)
|
||||
view_id = data.res_id
|
||||
|
||||
seq_id = obj_sequence.search(cr,uid,[('name','=','Account Journal')])[0]
|
||||
seq_id = obj_sequence.search(cr,uid,[('name', '=', 'Account Journal')], context=context)[0]
|
||||
|
||||
if seq_journal:
|
||||
seq_sale = {
|
||||
'name': 'Sale Journal',
|
||||
'code': 'account.journal',
|
||||
'prefix': '%(year)s/',
|
||||
'padding': 3
|
||||
}
|
||||
seq_id_sale = obj_sequence.create(cr, uid, seq_sale)
|
||||
'name': 'Sale Journal',
|
||||
'code': 'account.journal',
|
||||
'prefix': 'SAJ/%(year)s/',
|
||||
'padding': 3,
|
||||
'company_id': company_id.id
|
||||
}
|
||||
seq_id_sale = obj_sequence.create(cr, uid, seq_sale, context=context)
|
||||
seq_purchase = {
|
||||
'name': 'Purchase Journal',
|
||||
'code': 'account.journal',
|
||||
'prefix': '%(year)s/',
|
||||
'padding': 3
|
||||
}
|
||||
seq_id_purchase = obj_sequence.create(cr, uid, seq_purchase)
|
||||
'name': 'Purchase Journal',
|
||||
'code': 'account.journal',
|
||||
'prefix': 'EXJ/%(year)s/',
|
||||
'padding': 3,
|
||||
'company_id': company_id.id
|
||||
}
|
||||
seq_id_purchase = obj_sequence.create(cr, uid, seq_purchase, context=context)
|
||||
seq_refund_sale = {
|
||||
'name': 'Sales Refund Journal',
|
||||
'code': 'account.journal',
|
||||
'prefix': 'SCNJ/%(year)s/',
|
||||
'padding': 3,
|
||||
'company_id': company_id.id
|
||||
}
|
||||
seq_id_sale_refund = obj_sequence.create(cr, uid, seq_refund_sale, context=context)
|
||||
seq_refund_purchase = {
|
||||
'name': 'Purchase Refund Journal',
|
||||
'code': 'account.journal',
|
||||
'prefix': 'ECNJ/%(year)s/',
|
||||
'padding': 3,
|
||||
'company_id': company_id.id
|
||||
}
|
||||
seq_id_purchase_refund = obj_sequence.create(cr, uid, seq_refund_purchase, context=context)
|
||||
else:
|
||||
seq_id_sale = seq_id
|
||||
seq_id_purchase = seq_id
|
||||
seq_id_sale_refund = seq_id
|
||||
seq_id_purchase_refund = seq_id
|
||||
|
||||
vals_journal['view_id'] = view_id
|
||||
|
||||
#Sales Journal
|
||||
analitical_sale_ids = analytic_journal_obj.search(cr,uid,[('type','=','sale')])
|
||||
analitical_sale_ids = analytic_journal_obj.search(cr, uid, [('type','=','sale')], context=context)
|
||||
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
|
||||
|
||||
vals_journal.update({
|
||||
'name': _('Sales Journal'),
|
||||
'type': 'sale',
|
||||
'code': _('SAJ'),
|
||||
'sequence_id': seq_id_sale,
|
||||
'analytic_journal_id': analitical_journal_sale,
|
||||
'company_id': company_id.id
|
||||
})
|
||||
|
||||
if obj_multi.property_account_receivable:
|
||||
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
|
||||
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
|
||||
|
||||
obj_journal.create(cr,uid,vals_journal)
|
||||
vals_journal.update({
|
||||
'default_credit_account_id': acc_template_ref[obj_multi.property_account_income_categ.id],
|
||||
'default_debit_account_id': acc_template_ref[obj_multi.property_account_income_categ.id],
|
||||
})
|
||||
obj_journal.create(cr, uid, vals_journal, context=context)
|
||||
|
||||
# Purchase Journal
|
||||
analitical_purchase_ids = analytic_journal_obj.search(cr,uid,[('type','=','purchase')])
|
||||
analitical_purchase_ids = analytic_journal_obj.search(cr, uid, [('type', '=', 'purchase')], context=context)
|
||||
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
|
||||
vals_journal.update({
|
||||
'name': _('Purchase Journal'),
|
||||
'type': 'purchase',
|
||||
'code': _('EXJ'),
|
||||
'sequence_id': seq_id_purchase,
|
||||
'analytic_journal_id': analitical_journal_purchase,
|
||||
'company_id': company_id.id
|
||||
})
|
||||
|
||||
if obj_multi.property_account_payable:
|
||||
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
|
||||
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
|
||||
|
||||
obj_journal.create(cr,uid,vals_journal)
|
||||
vals_journal.update({
|
||||
'default_credit_account_id': acc_template_ref[obj_multi.property_account_expense_categ.id],
|
||||
'default_debit_account_id': acc_template_ref[obj_multi.property_account_expense_categ.id]
|
||||
})
|
||||
|
||||
obj_journal.create(cr, uid, vals_journal, context=context)
|
||||
# Creating Journals Sales Refund and Purchase Refund
|
||||
vals_journal={}
|
||||
data_id = mod_obj.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_refund_journal_view')])
|
||||
data = mod_obj.browse(cr, uid, data_id[0])
|
||||
vals_journal = {}
|
||||
data_id = mod_obj.search(cr, uid, [('model', '=', 'account.journal.view'), ('name', '=', 'account_sp_refund_journal_view')], context=context)
|
||||
data = mod_obj.browse(cr, uid, data_id[0], context=context)
|
||||
view_id = data.res_id
|
||||
|
||||
seq_id_sale_refund = seq_id_sale
|
||||
seq_id_purchase_refund = seq_id_purchase
|
||||
|
||||
vals_journal['view_id'] = view_id
|
||||
|
||||
#Sales Refund Journal
|
||||
vals_journal['name'] = _('Sales Refund Journal')
|
||||
vals_journal['type'] = 'sale_refund'
|
||||
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
|
||||
|
||||
vals_journal = {
|
||||
'view_id': view_id,
|
||||
'name': _('Sales Refund Journal'),
|
||||
'type': 'sale_refund',
|
||||
'refund_journal': True,
|
||||
'code': _('SCNJ'),
|
||||
'sequence_id': seq_id_sale_refund,
|
||||
'analytic_journal_id': analitical_journal_sale,
|
||||
'company_id': company_id.id
|
||||
}
|
||||
if obj_multi.property_account_receivable:
|
||||
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
|
||||
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.property_account_income_categ.id]
|
||||
vals_journal.update({
|
||||
'default_credit_account_id': acc_template_ref[obj_multi.property_account_income_categ.id],
|
||||
'default_debit_account_id': acc_template_ref[obj_multi.property_account_income_categ.id]
|
||||
})
|
||||
|
||||
obj_journal.create(cr,uid,vals_journal)
|
||||
obj_journal.create(cr, uid, vals_journal, context=context)
|
||||
|
||||
# Purchase Refund Journal
|
||||
vals_journal['name'] = _('Purchase Refund Journal')
|
||||
vals_journal['type'] = 'purchase_refund'
|
||||
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
|
||||
vals_journal = {
|
||||
'view_id': view_id,
|
||||
'name': _('Purchase Refund Journal'),
|
||||
'type': 'purchase_refund',
|
||||
'refund_journal': True,
|
||||
'code': _('ECNJ'),
|
||||
'sequence_id': seq_id_purchase_refund,
|
||||
'analytic_journal_id': analitical_journal_purchase,
|
||||
'company_id': company_id.id
|
||||
}
|
||||
|
||||
if obj_multi.property_account_payable:
|
||||
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
|
||||
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.property_account_expense_categ.id]
|
||||
|
||||
obj_journal.create(cr,uid,vals_journal)
|
||||
vals_journal.update({
|
||||
'default_credit_account_id': acc_template_ref[obj_multi.property_account_expense_categ.id],
|
||||
'default_debit_account_id': acc_template_ref[obj_multi.property_account_expense_categ.id]
|
||||
})
|
||||
obj_journal.create(cr, uid, vals_journal, context=context)
|
||||
|
||||
# Bank Journals
|
||||
view_id_cash = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Bank/Cash Journal View')])[0] #TOFIX: Why put fixed name ?
|
||||
view_id_cur = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Bank/Cash Journal (Multi-Currency) View')])[0] #TOFIX: why put fixed name?
|
||||
ref_acc_bank = obj_multi.bank_account_view_id
|
||||
|
||||
view_id_cash = obj_acc_journal_view.search(cr, uid, [('name', '=', 'Bank/Cash Journal View')], context=context)[0] #TOFIX: Why put fixed name ?
|
||||
view_id_cur = obj_acc_journal_view.search(cr, uid, [('name', '=', 'Bank/Cash Journal (Multi-Currency) View')], context=context)[0] #TOFIX: why put fixed name?
|
||||
|
||||
#create the properties
|
||||
property_obj = self.pool.get('ir.property')
|
||||
fields_obj = self.pool.get('ir.model.fields')
|
||||
|
||||
todo_list = [
|
||||
('property_account_receivable','res.partner','account.account'),
|
||||
('property_account_payable','res.partner','account.account'),
|
||||
('property_account_expense_categ','product.category','account.account'),
|
||||
('property_account_income_categ','product.category','account.account'),
|
||||
('property_account_expense','product.template','account.account'),
|
||||
('property_account_income','product.template','account.account'),
|
||||
('property_reserve_and_surplus_account','res.company','account.account'),
|
||||
('property_account_receivable', 'res.partner', 'account.account'),
|
||||
('property_account_payable', 'res.partner', 'account.account'),
|
||||
('property_account_expense_categ', 'product.category', 'account.account'),
|
||||
('property_account_income_categ', 'product.category', 'account.account'),
|
||||
('property_account_expense', 'product.template', 'account.account'),
|
||||
('property_account_income', 'product.template', 'account.account'),
|
||||
('property_reserve_and_surplus_account', 'res.company', 'account.account'),
|
||||
]
|
||||
|
||||
for record in todo_list:
|
||||
r = []
|
||||
r = property_obj.search(cr, uid, [('name','=', record[0] ),('company_id','=',company_id.id)])
|
||||
r = property_obj.search(cr, uid, [('name', '=', record[0]), ('company_id', '=', company_id.id)], context=context)
|
||||
account = getattr(obj_multi, record[0])
|
||||
field = fields_obj.search(cr, uid, [('name','=',record[0]),('model','=',record[1]),('relation','=',record[2])])
|
||||
field = fields_obj.search(cr, uid, [('name', '=', record[0]), ('model', '=', record[1]), ('relation', '=', record[2])], context=context)
|
||||
vals = {
|
||||
'name': record[0],
|
||||
'company_id': company_id.id,
|
||||
'fields_id': field[0],
|
||||
'value': account and 'account.account,'+str(acc_template_ref[account.id]) or False,
|
||||
'value': account and 'account.account, '+str(acc_template_ref[account.id]) or False,
|
||||
}
|
||||
|
||||
if r:
|
||||
#the property exist: modify it
|
||||
property_obj.write(cr, uid, r, vals)
|
||||
property_obj.write(cr, uid, r, vals, context=context)
|
||||
else:
|
||||
#create the property
|
||||
property_obj.create(cr, uid, vals)
|
||||
|
||||
fp_ids = obj_fiscal_position_template.search(cr, uid,[('chart_template_id', '=', obj_multi.id)])
|
||||
property_obj.create(cr, uid, vals, context=context)
|
||||
|
||||
fp_ids = obj_fiscal_position_template.search(cr, uid, [('chart_template_id', '=', obj_multi.id)], context=context)
|
||||
if fp_ids:
|
||||
for position in obj_fiscal_position_template.browse(cr, uid, fp_ids):
|
||||
|
||||
for position in obj_fiscal_position_template.browse(cr, uid, fp_ids, context=context):
|
||||
vals_fp = {
|
||||
'company_id' : company_id.id,
|
||||
'name' : position.name,
|
||||
}
|
||||
new_fp = obj_fiscal_position.create(cr, uid, vals_fp)
|
||||
|
||||
obj_tax_fp = self.pool.get('account.fiscal.position.tax')
|
||||
obj_ac_fp = self.pool.get('account.fiscal.position.account')
|
||||
|
||||
'company_id': company_id.id,
|
||||
'name': position.name,
|
||||
}
|
||||
new_fp = obj_fiscal_position.create(cr, uid, vals_fp, context=context)
|
||||
for tax in position.tax_ids:
|
||||
vals_tax = {
|
||||
'tax_src_id' : tax_template_ref[tax.tax_src_id.id],
|
||||
'tax_dest_id' : tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False,
|
||||
'position_id' : new_fp,
|
||||
}
|
||||
obj_tax_fp.create(cr, uid, vals_tax)
|
||||
'tax_src_id': tax_template_ref[tax.tax_src_id.id],
|
||||
'tax_dest_id': tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False,
|
||||
'position_id': new_fp,
|
||||
}
|
||||
obj_tax_fp.create(cr, uid, vals_tax, context=context)
|
||||
|
||||
for acc in position.account_ids:
|
||||
vals_acc = {
|
||||
'account_src_id' : acc_template_ref[acc.account_src_id.id],
|
||||
'account_dest_id' : acc_template_ref[acc.account_dest_id.id],
|
||||
'position_id' : new_fp,
|
||||
}
|
||||
obj_ac_fp.create(cr, uid, vals_acc)
|
||||
'account_src_id': acc_template_ref[acc.account_src_id.id],
|
||||
'account_dest_id': acc_template_ref[acc.account_dest_id.id],
|
||||
'position_id': new_fp,
|
||||
}
|
||||
obj_ac_fp.create(cr, uid, vals_acc, context=context)
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
@@ -517,65 +573,65 @@ class account_installer(osv.osv_memory):
|
||||
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')
|
||||
obj_tax = self.pool.get('account.tax')
|
||||
obj_product = self.pool.get('product.product')
|
||||
ir_values = self.pool.get('ir.values')
|
||||
super(account_installer, self).execute(cr, uid, ids, context=context)
|
||||
record = self.browse(cr, uid, ids, context=context)[0]
|
||||
company_id = record.company_id
|
||||
for res in self.read(cr, uid, ids):
|
||||
for res in self.read(cr, uid, ids, context=context):
|
||||
if record.charts == 'configurable':
|
||||
fp = tools.file_open(opj('account','configurable_account_chart.xml'))
|
||||
tools.convert_xml_import(cr, 'account', fp, {}, 'init',True, None)
|
||||
fp = tools.file_open(opj('account', 'configurable_account_chart.xml'))
|
||||
tools.convert_xml_import(cr, 'account', fp, {}, 'init', True, None)
|
||||
fp.close()
|
||||
self.generate_configurable_chart(cr, uid, ids, context=context)
|
||||
obj_tax = self.pool.get('account.tax')
|
||||
obj_product = self.pool.get('product.product')
|
||||
ir_values = self.pool.get('ir.values')
|
||||
s_tax = (res.get('sale_tax',0.0))/100
|
||||
p_tax = (res.get('purchase_tax',0.0))/100
|
||||
s_tax = (res.get('sale_tax', 0.0))/100
|
||||
p_tax = (res.get('purchase_tax', 0.0))/100
|
||||
tax_val = {}
|
||||
default_tax = []
|
||||
|
||||
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_temp_tax = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_base_purchases')
|
||||
pur_temp_tax_id = pur_temp_tax and pur_temp_tax[1] or False
|
||||
|
||||
pur_temp_tax_names = obj_temp_tax_code.read(cr, uid, [pur_temp_tax_id], ['name'], context=context)
|
||||
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)])
|
||||
pur_taxcode_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', pur_tax_parent_name)], context=context)
|
||||
if pur_taxcode_parent_id:
|
||||
pur_taxcode_parent_id = pur_taxcode_parent_id[0]
|
||||
else:
|
||||
pur_taxcode_parent_id = False
|
||||
|
||||
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_temp_tax_paid = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_input')
|
||||
pur_temp_tax_paid_id = pur_temp_tax_paid and pur_temp_tax_paid[1] or False
|
||||
pur_temp_tax_paid_names = obj_temp_tax_code.read(cr, uid, [pur_temp_tax_paid_id], ['name'], context=context)
|
||||
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)])
|
||||
pur_taxcode_paid_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', pur_tax_paid_parent_name)], context=context)
|
||||
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_temp_tax = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_base_sales')
|
||||
sale_temp_tax_id = sale_temp_tax and sale_temp_tax[1] or False
|
||||
sale_temp_tax_names = obj_temp_tax_code.read(cr, uid, [sale_temp_tax_id], ['name'], context=context)
|
||||
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)])
|
||||
sale_taxcode_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', sale_tax_parent_name)], context=context)
|
||||
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_temp_tax_paid = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_output')
|
||||
sale_temp_tax_paid_id = sale_temp_tax_paid and sale_temp_tax_paid[1] or False
|
||||
sale_temp_tax_paid_names = obj_temp_tax_code.read(cr, uid, [sale_temp_tax_paid_id], ['name'], context=context)
|
||||
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)])
|
||||
sale_taxcode_paid_parent_id = obj_tax_code.search(cr, uid, [('name', 'ilike', sale_tax_paid_parent_name)], context=context)
|
||||
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)
|
||||
tax_account_ids = obj_acc.search(cr, uid, [('name', '=', 'Tax Received')], context=context)
|
||||
sales_tax_account_id = tax_account_ids and tax_account_ids[0] or False
|
||||
vals_tax_code = {
|
||||
'name': 'TAX%s%%'%(s_tax*100),
|
||||
@@ -583,8 +639,8 @@ class account_installer(osv.osv_memory):
|
||||
'company_id': company_id.id,
|
||||
'sign': 1,
|
||||
'parent_id': sale_taxcode_parent_id
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_tax_code)
|
||||
}
|
||||
new_tax_code = obj_tax_code.create(cr, uid, vals_tax_code, context=context)
|
||||
|
||||
vals_paid_tax_code = {
|
||||
'name': 'TAX Received %s%%'%(s_tax*100),
|
||||
@@ -593,25 +649,24 @@ class account_installer(osv.osv_memory):
|
||||
'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)
|
||||
new_paid_tax_code = obj_tax_code.create(cr, uid, vals_paid_tax_code, context=context)
|
||||
|
||||
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_paid_tax_code,
|
||||
'type_tax_use':'sale',
|
||||
'account_collected_id':sales_tax_account_id,
|
||||
'account_paid_id':sales_tax_account_id
|
||||
})
|
||||
default_account_ids = obj_acc.search(cr, uid, [('name','=','Product Sales')],context=context)
|
||||
{'name': 'TAX %s%%'%(s_tax*100),
|
||||
'amount': s_tax,
|
||||
'base_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
|
||||
}, context=context)
|
||||
default_account_ids = obj_acc.search(cr, uid, [('name', '=', 'Product Sales')], context=context)
|
||||
if default_account_ids:
|
||||
obj_acc.write(cr, uid, default_account_ids, {'tax_ids':[(6,0,[sales_tax])]})
|
||||
tax_val.update({'taxes_id':[(6,0,[sales_tax])]})
|
||||
default_tax.append(('taxes_id',sales_tax))
|
||||
obj_acc.write(cr, uid, default_account_ids, {'tax_ids': [(6, 0, [sales_tax])]}, context=context)
|
||||
tax_val.update({'taxes_id': [(6, 0, [sales_tax])]})
|
||||
default_tax.append(('taxes_id', sales_tax))
|
||||
if p_tax*100 > 0.0:
|
||||
tax_account_ids = obj_acc.search(cr, uid, [('name','=','Tax Paid')], context=context)
|
||||
tax_account_ids = obj_acc.search(cr, uid, [('name', '=', 'Tax Paid')], context=context)
|
||||
purchase_tax_account_id = tax_account_ids and tax_account_ids[0] or False
|
||||
vals_tax_code = {
|
||||
'name': 'TAX%s%%'%(p_tax*100),
|
||||
@@ -620,8 +675,7 @@ class account_installer(osv.osv_memory):
|
||||
'sign': 1,
|
||||
'parent_id': pur_taxcode_parent_id
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_tax_code)
|
||||
|
||||
new_tax_code = obj_tax_code.create(cr, uid, vals_tax_code, context=context)
|
||||
vals_paid_tax_code = {
|
||||
'name': 'TAX Paid %s%%'%(p_tax*100),
|
||||
'code': 'TAX Paid %s%%'%(p_tax*100),
|
||||
@@ -629,43 +683,44 @@ class account_installer(osv.osv_memory):
|
||||
'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)
|
||||
new_paid_tax_code = obj_tax_code.create(cr, uid, vals_paid_tax_code, context=context)
|
||||
|
||||
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_paid_tax_code,
|
||||
'type_tax_use':'purchase',
|
||||
'account_collected_id':purchase_tax_account_id,
|
||||
'account_paid_id':purchase_tax_account_id
|
||||
})
|
||||
default_account_ids = obj_acc.search(cr, uid, [('name','=','Expenses')], context=context)
|
||||
{'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_paid_tax_code,
|
||||
'type_tax_use': 'purchase',
|
||||
'account_collected_id': purchase_tax_account_id,
|
||||
'account_paid_id': purchase_tax_account_id
|
||||
}, context=context)
|
||||
default_account_ids = obj_acc.search(cr, uid, [('name', '=', 'Expenses')], context=context)
|
||||
if default_account_ids:
|
||||
obj_acc.write(cr, uid, default_account_ids, {'tax_ids':[(6,0,[purchase_tax])]})
|
||||
tax_val.update({'supplier_taxes_id':[(6,0,[purchase_tax])]})
|
||||
default_tax.append(('supplier_taxes_id',purchase_tax))
|
||||
if len(tax_val):
|
||||
product_ids = obj_product.search(cr, uid, [])
|
||||
for product in obj_product.browse(cr, uid, product_ids):
|
||||
obj_product.write(cr, uid, product.id, tax_val)
|
||||
obj_acc.write(cr, uid, default_account_ids, {'tax_ids': [(6, 0, [purchase_tax])]}, context=context)
|
||||
tax_val.update({'supplier_taxes_id': [(6 ,0, [purchase_tax])]})
|
||||
default_tax.append(('supplier_taxes_id', purchase_tax))
|
||||
if tax_val:
|
||||
product_ids = obj_product.search(cr, uid, [], context=context)
|
||||
for product in obj_product.browse(cr, uid, product_ids, context=context):
|
||||
obj_product.write(cr, uid, product.id, tax_val, context=context)
|
||||
for name, value in default_tax:
|
||||
ir_values.set(cr, uid, key='default', key2=False, name=name, models =[('product.product',False)], value=[value])
|
||||
ir_values.set(cr, uid, key='default', key2=False, name=name, models =[('product.product', False)], value=[value])
|
||||
|
||||
if 'date_start' in res and 'date_stop' in res:
|
||||
f_ids = fy_obj.search(cr, uid, [('date_start', '<=', res['date_start']), ('date_stop', '>=', res['date_stop']), ('company_id','=',res['company_id'])])
|
||||
f_ids = fy_obj.search(cr, uid, [('date_start', '<=', res['date_start']), ('date_stop', '>=', res['date_stop']), ('company_id', '=', res['company_id'])], context=context)
|
||||
if not f_ids:
|
||||
name = code = res['date_start'][:4]
|
||||
if int(name) != int(res['date_stop'][:4]):
|
||||
name = res['date_start'][:4] +'-'+ res['date_stop'][:4]
|
||||
code = res['date_start'][2:4] +'-'+ res['date_stop'][2:4]
|
||||
vals = {'name': name,
|
||||
'code': code,
|
||||
'date_start': res['date_start'],
|
||||
'date_stop': res['date_stop'],
|
||||
'company_id': res['company_id']
|
||||
}
|
||||
vals = {
|
||||
'name': name,
|
||||
'code': code,
|
||||
'date_start': res['date_start'],
|
||||
'date_stop': res['date_stop'],
|
||||
'company_id': res['company_id']
|
||||
}
|
||||
fiscal_id = fy_obj.create(cr, uid, vals, context=context)
|
||||
if res['period'] == 'month':
|
||||
fy_obj.create_period(cr, uid, [fiscal_id])
|
||||
@@ -690,13 +745,10 @@ class account_bank_accounts_wizard(osv.osv_memory):
|
||||
|
||||
_columns = {
|
||||
'acc_name': fields.char('Account Name.', size=64, required=True),
|
||||
'bank_account_id': fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
|
||||
'bank_account_id': fields.many2one('account.installer', 'Bank Account', required=True),
|
||||
'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),
|
||||
'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,
|
||||
# }
|
||||
|
||||
account_bank_accounts_wizard()
|
||||
|
||||
@@ -704,26 +756,22 @@ class account_installer_modules(osv.osv_memory):
|
||||
_name = 'account.installer.modules'
|
||||
_inherit = 'res.config.installer'
|
||||
_columns = {
|
||||
# Accounting
|
||||
'account_analytic_plans':fields.boolean('Multiple Analytic Plans',
|
||||
'account_analytic_plans': fields.boolean('Multiple Analytic Plans',
|
||||
help="Allows invoice lines to impact multiple analytic accounts "
|
||||
"simultaneously."),
|
||||
'account_payment':fields.boolean('Suppliers Payment Management',
|
||||
'account_payment': fields.boolean('Suppliers Payment Management',
|
||||
help="Streamlines invoice payment and creates hooks to plug "
|
||||
"automated payment systems in."),
|
||||
'account_followup':fields.boolean('Followups Management',
|
||||
'account_followup': fields.boolean('Followups Management',
|
||||
help="Helps you generate reminder letters for unpaid invoices, "
|
||||
"including multiple levels of reminding and customized "
|
||||
"per-partner policies."),
|
||||
'account_voucher':fields.boolean('Voucher Management',
|
||||
'account_voucher': fields.boolean('Voucher Management',
|
||||
help="Account Voucher module includes all the basic requirements of "
|
||||
"Voucher Entries for Bank, Cash, Sales, Purchase, Expenses, Contra, etc... "),
|
||||
'account_anglo_saxon': fields.boolean('Anglo-Saxon Accounting',
|
||||
help="This module will support the Anglo-Saxons accounting methodology by "
|
||||
"changing the accounting logic with stock transactions."),
|
||||
# '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 = {
|
||||
|
||||
+180
-197
@@ -20,14 +20,12 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from operator import itemgetter
|
||||
import decimal_precision as dp
|
||||
from lxml import etree
|
||||
import decimal_precision as dp
|
||||
|
||||
import netsvc
|
||||
from osv import fields, osv, orm
|
||||
import pooler
|
||||
from tools import config
|
||||
from osv import fields, osv, orm
|
||||
from tools.translate import _
|
||||
|
||||
class account_invoice(osv.osv):
|
||||
@@ -59,17 +57,13 @@ class account_invoice(osv.osv):
|
||||
('company_id', '=', company_id),
|
||||
('refund_journal', '=', refund_journal.get(type_inv, False))],
|
||||
limit=1)
|
||||
if res:
|
||||
return res[0]
|
||||
else:
|
||||
return False
|
||||
return res and res[0] or False
|
||||
|
||||
def _get_currency(self, cr, uid, context=None):
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0]
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid], context=context)[0]
|
||||
if user.company_id:
|
||||
return user.company_id.currency_id.id
|
||||
else:
|
||||
return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
|
||||
return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=', 1.0)])[0]
|
||||
|
||||
def _get_journal_analytic(self, cr, uid, type_inv, context=None):
|
||||
type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale', 'in_refund': 'purchase'}
|
||||
@@ -94,50 +88,14 @@ class account_invoice(osv.osv):
|
||||
return [('none', _('Free Reference'))]
|
||||
|
||||
def _amount_residual(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
data_inv = self.browse(cr, uid, ids)
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
for inv in data_inv:
|
||||
debit = credit = 0.0
|
||||
context.update({'date':inv.date_invoice})
|
||||
context_unreconciled=context.copy()
|
||||
for lines in inv.move_lines:
|
||||
debit_tmp = lines.debit
|
||||
credit_tmp = lines.credit
|
||||
# If currency conversion needed
|
||||
if inv.company_id.currency_id.id <> inv.currency_id.id:
|
||||
# If invoice paid, compute currency amount according to invoice date
|
||||
# otherwise, take the line date
|
||||
if not inv.reconciled:
|
||||
context.update({'date':lines.date})
|
||||
context_unreconciled.update({'date':lines.date})
|
||||
# If amount currency setted, compute for debit and credit in company currency
|
||||
if lines.amount_currency < 0:
|
||||
credit_tmp=abs(cur_obj.compute(cr, uid, lines.currency_id.id, inv.company_id.currency_id.id, lines.amount_currency, round=False, context=context_unreconciled))
|
||||
elif lines.amount_currency > 0:
|
||||
debit_tmp=abs(cur_obj.compute(cr, uid, lines.currency_id.id, inv.company_id.currency_id.id, lines.amount_currency, round=False, context=context_unreconciled))
|
||||
# Then, recomput into invoice currency to avoid rounding trouble !
|
||||
debit += cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id, debit_tmp, round=False, context=context)
|
||||
credit += cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id, credit_tmp, round=False, context=context)
|
||||
else:
|
||||
debit+=debit_tmp
|
||||
credit+=credit_tmp
|
||||
|
||||
if not inv.amount_total:
|
||||
result = 0.0
|
||||
elif inv.type in ('out_invoice','in_refund'):
|
||||
amount = credit-debit
|
||||
result = inv.amount_total - amount
|
||||
else:
|
||||
amount = debit-credit
|
||||
result = inv.amount_total - amount
|
||||
# Use is_zero function to avoid rounding trouble => should be fixed into ORM
|
||||
res[inv.id] = not self.pool.get('res.currency').is_zero(cr, uid, inv.company_id.currency_id, result) and result or 0.0
|
||||
|
||||
return res
|
||||
result = {}
|
||||
for invoice in self.browse(cr, uid, ids, context=context):
|
||||
result[invoice.id] = 0.0
|
||||
if invoice.move_id:
|
||||
for m in invoice.move_id.line_id:
|
||||
if m.account_id.type in ('receivable','payable'):
|
||||
result[invoice.id] = m.amount_residual_currency
|
||||
return result
|
||||
|
||||
# Give Journal Items related to the payment reconciled to this invoice
|
||||
# Return ids of partial and total payments related to the selected invoices
|
||||
@@ -148,7 +106,7 @@ class account_invoice(osv.osv):
|
||||
res[id] = []
|
||||
if not invoice.move_id:
|
||||
continue
|
||||
data_lines = invoice.move_id.line_id
|
||||
data_lines = [x for x in invoice.move_id.line_id if x.account_id.id == invoice.account_id.id]
|
||||
partial_ids = []
|
||||
for line in data_lines:
|
||||
ids_line = []
|
||||
@@ -175,7 +133,7 @@ class account_invoice(osv.osv):
|
||||
|
||||
def _compute_lines(self, cr, uid, ids, name, args, context=None):
|
||||
result = {}
|
||||
for invoice in self.browse(cr, uid, ids, context):
|
||||
for invoice in self.browse(cr, uid, ids, context=context):
|
||||
src = []
|
||||
lines = []
|
||||
if invoice.move_id:
|
||||
@@ -194,7 +152,7 @@ class account_invoice(osv.osv):
|
||||
|
||||
def _get_invoice_from_line(self, cr, uid, ids, context=None):
|
||||
move = {}
|
||||
for line in self.pool.get('account.move.line').browse(cr, uid, ids):
|
||||
for line in self.pool.get('account.move.line').browse(cr, uid, ids, context=context):
|
||||
if line.reconcile_partial_id:
|
||||
for line2 in line.reconcile_partial_id.line_partial_ids:
|
||||
move[line2.move_id.id] = True
|
||||
@@ -208,7 +166,7 @@ class account_invoice(osv.osv):
|
||||
|
||||
def _get_invoice_from_reconcile(self, cr, uid, ids, context=None):
|
||||
move = {}
|
||||
for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids):
|
||||
for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context):
|
||||
for line in r.line_partial_ids:
|
||||
move[line.move_id.id] = True
|
||||
for line in r.line_id:
|
||||
@@ -253,7 +211,7 @@ class account_invoice(osv.osv):
|
||||
\n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \
|
||||
\n* The \'Paid\' state is set automatically when invoice is paid.\
|
||||
\n* The \'Cancelled\' state is used when user cancel invoice.'),
|
||||
'date_invoice': fields.date('Date Invoiced', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, help="Keep empty to use the current date"),
|
||||
'date_invoice': fields.date('Invoice Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, help="Keep empty to use the current date"),
|
||||
'date_due': fields.date('Due Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]},
|
||||
help="If you use payment terms, the due date will be computed automatically at the generation "\
|
||||
"of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."),
|
||||
@@ -270,26 +228,26 @@ class account_invoice(osv.osv):
|
||||
'invoice_line': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'tax_line': fields.one2many('account.invoice.tax', 'invoice_id', 'Tax Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
||||
'move_id': fields.many2one('account.move', 'Journal Entry', readonly=True, help="Link to the automatically generated Journal Items."),
|
||||
'move_id': fields.many2one('account.move', 'Journal Entry', readonly=True, select=1, ondelete='restrict', help="Link to the automatically generated Journal Items."),
|
||||
'amount_untaxed': fields.function(_amount_all, method=True, digits_compute=dp.get_precision('Account'), string='Untaxed',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount'], 20),
|
||||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount','invoice_id'], 20),
|
||||
},
|
||||
multi='all'),
|
||||
'amount_tax': fields.function(_amount_all, method=True, digits_compute=dp.get_precision('Account'), string='Tax',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount'], 20),
|
||||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount','invoice_id'], 20),
|
||||
},
|
||||
multi='all'),
|
||||
'amount_total': fields.function(_amount_all, method=True, digits_compute=dp.get_precision('Account'), string='Total',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount'], 20),
|
||||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount','invoice_id'], 20),
|
||||
},
|
||||
multi='all'),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
@@ -304,12 +262,12 @@ class account_invoice(osv.osv):
|
||||
}, help="The Journal Entry of the invoice have been totally reconciled with one or several Journal Entries of payment."),
|
||||
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',
|
||||
help='Bank Account Number, Company bank account if Invoice is customer or supplier refund, otherwise Partner bank account number.', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'move_lines':fields.function(_get_lines , method=True, type='many2many', relation='account.move.line', string='Entry Lines'),
|
||||
'move_lines':fields.function(_get_lines, method=True, type='many2many', relation='account.move.line', string='Entry Lines'),
|
||||
'residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 50),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 50),
|
||||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount'], 50),
|
||||
'account.invoice.line': (_get_invoice_line, ['price_unit','invoice_line_tax_id','quantity','discount','invoice_id'], 50),
|
||||
'account.move.line': (_get_invoice_from_line, None, 50),
|
||||
'account.move.reconcile': (_get_invoice_from_reconcile, None, 50),
|
||||
},
|
||||
@@ -317,7 +275,7 @@ class account_invoice(osv.osv):
|
||||
'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'),
|
||||
'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'user_id': fields.many2one('res.users', 'Salesman', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Mapping', readonly=True, states={'draft':[('readonly',False)]})
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]})
|
||||
}
|
||||
_defaults = {
|
||||
'type': _get_type,
|
||||
@@ -333,44 +291,77 @@ 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 context is None:
|
||||
context = {}
|
||||
|
||||
if context.get('active_model', '') in ['res.partner'] and context.get('active_ids', False) and context['active_ids']:
|
||||
partner = self.pool.get(context['active_model']).read(cr, uid, context['active_ids'], ['supplier','customer'])[0]
|
||||
if not view_type:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.tree')])[0]
|
||||
view_id = self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'account.invoice.tree')])
|
||||
view_type = 'tree'
|
||||
if view_type == 'form':
|
||||
if partner['supplier'] and not partner['customer']:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.supplier.form')])[0]
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.supplier.form')])
|
||||
else:
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name','=','account.invoice.form')])[0]
|
||||
view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'account.invoice.form')])
|
||||
if view_id and isinstance(view_id, (list, tuple)):
|
||||
view_id = view_id[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']:
|
||||
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
|
||||
|
||||
if view_type == 'tree':
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='partner_id']")
|
||||
partner_string = _('Customer')
|
||||
if context.get('type', 'out_invoice') in ('in_invoice', 'in_refund'):
|
||||
partner_string = _('Supplier')
|
||||
for node in nodes:
|
||||
node.set('string', partner_string)
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def get_log_context(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
mob_obj = self.pool.get('ir.model.data')
|
||||
res = mob_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
|
||||
view_id = res and res[1] or False
|
||||
context.update({'view_id': view_id})
|
||||
return context
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
try:
|
||||
res = super(account_invoice, self).create(cr, uid, vals, context)
|
||||
for inv_id, name in self.name_get(cr, uid, [res], context=context):
|
||||
message = _('Invoice ') + " '" + name + "' "+ _("is waiting for validation.")
|
||||
self.log(cr, uid, inv_id, message)
|
||||
ctx = context.copy()
|
||||
if vals.get('type', 'in_invoice') in ('out_invoice', 'out_refund'):
|
||||
ctx = self.get_log_context(cr, uid, context=ctx)
|
||||
message = _("Invoice '%s' is waiting for validation.") % name
|
||||
self.log(cr, uid, inv_id, message, context=ctx)
|
||||
return res
|
||||
except Exception, e:
|
||||
if '"journal_id" viol' in e.args[0]:
|
||||
raise orm.except_orm(_('Configuration Error!'),
|
||||
_('There is no Accounting Journal of type Sale/Purchase defined!'))
|
||||
else:
|
||||
raise orm.except_orm(_('UnknownError'), str(e))
|
||||
raise orm.except_orm(_('Unknown Error'), str(e))
|
||||
|
||||
def confirm_paid(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'paid'}, context=context)
|
||||
for inv_id, name in self.name_get(cr, uid, ids, context=context):
|
||||
message = _("Invoice '%s' is paid.") % name
|
||||
self.log(cr, uid, inv_id, message)
|
||||
return True
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
invoices = self.read(cr, uid, ids, ['state'])
|
||||
invoices = self.read(cr, uid, ids, ['state'], context=context)
|
||||
unlink_ids = []
|
||||
for t in invoices:
|
||||
if t['state'] in ('draft', 'cancel'):
|
||||
@@ -453,14 +444,6 @@ class account_invoice(osv.osv):
|
||||
result['value'].update(to_update['value'])
|
||||
return result
|
||||
|
||||
def onchange_currency_id(self, cr, uid, ids, curr_id, company_id):
|
||||
if curr_id and company_id:
|
||||
currency = self.pool.get('res.currency').browse(cr, uid, curr_id)
|
||||
if currency.company_id.id != company_id:
|
||||
raise osv.except_osv(_('Configuration Error !'),
|
||||
_('Can not select currency that is not related to current company.\nPlease select accordingly !.'))
|
||||
return {}
|
||||
|
||||
def onchange_journal_id(self, cr, uid, ids, journal_id=False):
|
||||
result = {}
|
||||
if journal_id:
|
||||
@@ -488,7 +471,6 @@ class account_invoice(osv.osv):
|
||||
res = {'value':{'date_due': pterm_list[-1]}}
|
||||
else:
|
||||
raise osv.except_osv(_('Data Insufficient !'), _('The Payment Term of Supplier does not have Payment Term Lines(Computation) defined !'))
|
||||
|
||||
return res
|
||||
|
||||
def onchange_invoice_line(self, cr, uid, ids, lines):
|
||||
@@ -501,6 +483,8 @@ class account_invoice(osv.osv):
|
||||
val = {}
|
||||
dom = {}
|
||||
obj_journal = self.pool.get('account.journal')
|
||||
account_obj = self.pool.get('account.account')
|
||||
inv_line_obj = self.pool.get('account.invoice.line')
|
||||
if company_id and part_id and type:
|
||||
acc_id = False
|
||||
partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id)
|
||||
@@ -525,7 +509,6 @@ class account_invoice(osv.osv):
|
||||
else:
|
||||
acc_id = pay_res_id
|
||||
val= {'account_id': acc_id}
|
||||
account_obj = self.pool.get('account.account')
|
||||
if ids:
|
||||
if company_id:
|
||||
inv_obj = self.browse(cr,uid,ids)
|
||||
@@ -536,7 +519,7 @@ class account_invoice(osv.osv):
|
||||
if not result_id:
|
||||
raise osv.except_osv(_('Configuration Error !'),
|
||||
_('Can not find account chart for this company in invoice line account, Please Create account.'))
|
||||
r_id = self.pool.get('account.invoice.line').write(cr, uid, [line.id], {'account_id': result_id[0]})
|
||||
inv_line_obj.write(cr, uid, [line.id], {'account_id': result_id[0]})
|
||||
else:
|
||||
if invoice_line:
|
||||
for inv_line in invoice_line:
|
||||
@@ -559,7 +542,7 @@ class account_invoice(osv.osv):
|
||||
if journal_ids:
|
||||
val['journal_id'] = journal_ids[0]
|
||||
else:
|
||||
raise osv.except_osv(_('Configuration Error !'), _('Can\'t find any account journal of %s type for this company.\n\nYou can create one in the menu: \nConfiguration\Financial Accounting\Accounts\Journals.' % (journal_type)))
|
||||
raise osv.except_osv(_('Configuration Error !'), (_('Can\'t find any account journal of %s type for this company.\n\nYou can create one in the menu: \nConfiguration\Financial Accounting\Accounts\Journals.') % (journal_type)))
|
||||
dom = {'journal_id': [('id', 'in', journal_ids)]}
|
||||
else:
|
||||
journal_ids = obj_journal.search(cr, uid, [])
|
||||
@@ -577,26 +560,17 @@ class account_invoice(osv.osv):
|
||||
else:
|
||||
val['currency_id'] = company.currency_id.id
|
||||
|
||||
return {'value' : val, 'domain': dom }
|
||||
return {'value': val, 'domain': dom}
|
||||
|
||||
# go from canceled state to draft state
|
||||
def action_cancel_draft(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {'state':'draft'})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for inv_id in ids:
|
||||
wf_service.trg_delete(uid, 'account.invoice', inv_id, cr)
|
||||
wf_service.trg_create(uid, 'account.invoice', inv_id, cr)
|
||||
return True
|
||||
|
||||
def finalize_invoice_move_lines(self, cr, uid, invoice_browse, move_lines):
|
||||
"""finalize_invoice_move_lines(cr, uid, invoice, move_lines) -> move_lines
|
||||
Hook method to be overridden in additional modules to verify and possibly alter the
|
||||
move lines to be created by an invoice, for special cases.
|
||||
:param invoice_browse: browsable record of the invoice that is generating the move lines
|
||||
:param move_lines: list of dictionaries with the account.move.lines (as for create())
|
||||
:return: the (possibly updated) final move_lines to create for this invoice
|
||||
"""
|
||||
return move_lines
|
||||
|
||||
# Workflow stuff
|
||||
#################
|
||||
|
||||
@@ -650,23 +624,24 @@ class account_invoice(osv.osv):
|
||||
return ok
|
||||
|
||||
def button_reset_taxes(self, cr, uid, ids, context=None):
|
||||
if not context:
|
||||
if context is None:
|
||||
context = {}
|
||||
ctx = context.copy()
|
||||
ait_obj = self.pool.get('account.invoice.tax')
|
||||
for id in ids:
|
||||
cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,))
|
||||
partner = self.browse(cr, uid, id, context=context).partner_id
|
||||
cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s AND manual is False", (id,))
|
||||
partner = self.browse(cr, uid, id, context=ctx).partner_id
|
||||
if partner.lang:
|
||||
context.update({'lang': partner.lang})
|
||||
for taxe in ait_obj.compute(cr, uid, id, context=context).values():
|
||||
ctx.update({'lang': partner.lang})
|
||||
for taxe in ait_obj.compute(cr, uid, id, context=ctx).values():
|
||||
ait_obj.create(cr, uid, taxe)
|
||||
# Update the stored value (fields.function), so we write to trigger recompute
|
||||
self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context)
|
||||
self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx)
|
||||
return True
|
||||
|
||||
def button_compute(self, cr, uid, ids, context=None, set_total=False):
|
||||
self.button_reset_taxes(cr, uid, ids, context)
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
for inv in self.browse(cr, uid, ids, context=context):
|
||||
if set_total:
|
||||
self.pool.get('account.invoice').write(cr, uid, [inv.id], {'check_total': inv.amount_total})
|
||||
return True
|
||||
@@ -675,7 +650,7 @@ class account_invoice(osv.osv):
|
||||
return (ref or '').replace('/','')
|
||||
|
||||
def _get_analytic_lines(self, cr, uid, id):
|
||||
inv = self.browse(cr, uid, [id])[0]
|
||||
inv = self.browse(cr, uid, id)
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
|
||||
company_currency = inv.company_id.currency_id.id
|
||||
@@ -691,6 +666,8 @@ class account_invoice(osv.osv):
|
||||
ref = inv.reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, inv.number)
|
||||
if not inv.journal_id.analytic_journal_id:
|
||||
raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (inv.journal_id.name,))
|
||||
il['analytic_lines'] = [(0,0, {
|
||||
'name': il['name'],
|
||||
'date': inv['date_invoice'],
|
||||
@@ -700,7 +677,7 @@ class account_invoice(osv.osv):
|
||||
'product_id': il['product_id'],
|
||||
'product_uom_id': il['uos_id'],
|
||||
'general_account_id': il['account_id'],
|
||||
'journal_id': self._get_journal_analytic(cr, uid, inv.type),
|
||||
'journal_id': inv.journal_id.analytic_journal_id.id,
|
||||
'ref': ref,
|
||||
})]
|
||||
return iml
|
||||
@@ -796,7 +773,6 @@ class account_invoice(osv.osv):
|
||||
line = []
|
||||
for key, val in line2.items():
|
||||
line.append((0,0,val))
|
||||
|
||||
return line
|
||||
|
||||
def action_move_create(self, cr, uid, ids, *args):
|
||||
@@ -816,13 +792,12 @@ class account_invoice(osv.osv):
|
||||
self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')})
|
||||
company_currency = inv.company_id.currency_id.id
|
||||
# create the analytical lines
|
||||
line_ids = self.read(cr, uid, [inv.id], ['invoice_line'])[0]['invoice_line']
|
||||
# one move line per invoice line
|
||||
iml = self._get_analytic_lines(cr, uid, inv.id)
|
||||
# check if taxes are all computed
|
||||
|
||||
context.update({'lang': inv.partner_id.lang})
|
||||
compute_taxes = ait_obj.compute(cr, uid, inv.id, context=context)
|
||||
ctx = context.copy()
|
||||
ctx.update({'lang': inv.partner_id.lang})
|
||||
compute_taxes = ait_obj.compute(cr, uid, inv.id, context=ctx)
|
||||
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
|
||||
|
||||
if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0):
|
||||
@@ -835,7 +810,7 @@ class account_invoice(osv.osv):
|
||||
total_fixed += line.value_amount
|
||||
if line.value == 'procent':
|
||||
total_percent += line.value_amount
|
||||
total_fixed = (total_fixed * 100) / inv.amount_total
|
||||
total_fixed = (total_fixed * 100) / (inv.amount_total or 1.0)
|
||||
if (total_fixed + total_percent) > 100:
|
||||
raise osv.except_osv(_('Error !'), _("Cannot create the invoice !\nThe payment term defined gives a computed amount greater than the total invoiced amount."))
|
||||
|
||||
@@ -900,7 +875,7 @@ class account_invoice(osv.osv):
|
||||
'name': name,
|
||||
'price': total,
|
||||
'account_id': acc_id,
|
||||
'date_maturity' : inv.date_due or False,
|
||||
'date_maturity': inv.date_due or False,
|
||||
'amount_currency': diff_currency_p \
|
||||
and total_currency or False,
|
||||
'currency_id': diff_currency_p \
|
||||
@@ -911,7 +886,7 @@ class account_invoice(osv.osv):
|
||||
date = inv.date_invoice or time.strftime('%Y-%m-%d')
|
||||
part = inv.partner_id.id
|
||||
|
||||
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})) ,iml)
|
||||
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x, part, date, context={})),iml)
|
||||
|
||||
line = self.group_lines(cr, uid, iml, line, inv)
|
||||
|
||||
@@ -934,7 +909,7 @@ class account_invoice(osv.osv):
|
||||
period_id = inv.period_id and inv.period_id.id or False
|
||||
if not period_id:
|
||||
period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))])
|
||||
if len(period_ids):
|
||||
if period_ids:
|
||||
period_id = period_ids[0]
|
||||
if period_id:
|
||||
move['period_id'] = period_id
|
||||
@@ -954,29 +929,31 @@ class account_invoice(osv.osv):
|
||||
def line_get_convert(self, cr, uid, x, part, date, context=None):
|
||||
return {
|
||||
'date_maturity': x.get('date_maturity', False),
|
||||
'partner_id':part,
|
||||
'name':x['name'][:64],
|
||||
'partner_id': part,
|
||||
'name': x['name'][:64],
|
||||
'date': date,
|
||||
'debit':x['price']>0 and x['price'],
|
||||
'credit':x['price']<0 and -x['price'],
|
||||
'account_id':x['account_id'],
|
||||
'analytic_lines':x.get('analytic_lines', []),
|
||||
'amount_currency':x['price']>0 and abs(x.get('amount_currency', False)) or -abs(x.get('amount_currency', False)),
|
||||
'currency_id':x.get('currency_id', False),
|
||||
'debit': x['price']>0 and x['price'],
|
||||
'credit': x['price']<0 and -x['price'],
|
||||
'account_id': x['account_id'],
|
||||
'analytic_lines': x.get('analytic_lines', []),
|
||||
'amount_currency': x['price']>0 and abs(x.get('amount_currency', False)) or -abs(x.get('amount_currency', False)),
|
||||
'currency_id': x.get('currency_id', False),
|
||||
'tax_code_id': x.get('tax_code_id', False),
|
||||
'tax_amount': x.get('tax_amount', False),
|
||||
'ref':x.get('ref',False),
|
||||
'quantity':x.get('quantity',1.00),
|
||||
'product_id':x.get('product_id', False),
|
||||
'product_uom_id':x.get('uos_id',False),
|
||||
'analytic_account_id':x.get('account_analytic_id',False),
|
||||
'ref': x.get('ref', False),
|
||||
'quantity': x.get('quantity',1.00),
|
||||
'product_id': x.get('product_id', False),
|
||||
'product_uom_id': x.get('uos_id', False),
|
||||
'analytic_account_id': x.get('account_analytic_id', False),
|
||||
}
|
||||
|
||||
def action_number(self, cr, uid, ids, *args):
|
||||
def action_number(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
#TODO: not correct fix but required a frech values before reading it.
|
||||
self.write(cr, uid, ids, {})
|
||||
|
||||
for obj_inv in self.browse(cr, uid, ids):
|
||||
for obj_inv in self.browse(cr, uid, ids, context=context):
|
||||
id = obj_inv.id
|
||||
invtype = obj_inv.type
|
||||
number = obj_inv.number
|
||||
@@ -986,7 +963,10 @@ class account_invoice(osv.osv):
|
||||
self.write(cr, uid, ids, {'internal_number':number})
|
||||
|
||||
if invtype in ('in_invoice', 'in_refund'):
|
||||
ref = reference
|
||||
if not reference:
|
||||
ref = self._convert_ref(cr, uid, number)
|
||||
else:
|
||||
ref = reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, number)
|
||||
|
||||
@@ -1003,9 +983,11 @@ class account_invoice(osv.osv):
|
||||
(ref, move_id))
|
||||
|
||||
for inv_id, name in self.name_get(cr, uid, [id]):
|
||||
ctx = context.copy()
|
||||
if obj_inv.type in ('out_invoice', 'out_refund'):
|
||||
ctx = self.get_log_context(cr, uid, context=ctx)
|
||||
message = _('Invoice ') + " '" + name + "' "+ _("is validated.")
|
||||
self.log(cr, uid, inv_id, message)
|
||||
|
||||
self.log(cr, uid, inv_id, message, context=ctx)
|
||||
return True
|
||||
|
||||
def action_cancel(self, cr, uid, ids, *args):
|
||||
@@ -1020,7 +1002,7 @@ class account_invoice(osv.osv):
|
||||
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
|
||||
if i['payment_ids']:
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
pay_ids = account_move_line_obj.browse(cr, uid , i['payment_ids'])
|
||||
pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids'])
|
||||
for move_line in pay_ids:
|
||||
if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids:
|
||||
raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!'))
|
||||
@@ -1045,7 +1027,7 @@ class account_invoice(osv.osv):
|
||||
return True
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return []
|
||||
types = {
|
||||
'out_invoice': 'CI: ',
|
||||
@@ -1053,7 +1035,7 @@ class account_invoice(osv.osv):
|
||||
'out_refund': 'OR: ',
|
||||
'in_refund': 'SR: ',
|
||||
}
|
||||
return [(r['id'], types[r['type']]+(r['number'] or '')+' '+(r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')]
|
||||
return [(r['id'], (r['number']) or types[r['type']] + (r['name'] or '')) for r in self.read(cr, uid, ids, ['type', 'number', 'name'], context, load='_classic_write')]
|
||||
|
||||
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
|
||||
if not args:
|
||||
@@ -1062,9 +1044,9 @@ class account_invoice(osv.osv):
|
||||
context = {}
|
||||
ids = []
|
||||
if name:
|
||||
ids = self.search(cr, user, [('number','=',name)]+ args, limit=limit, context=context)
|
||||
ids = self.search(cr, user, [('number','=',name)] + args, limit=limit, context=context)
|
||||
if not ids:
|
||||
ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
|
||||
ids = self.search(cr, user, [('name',operator,name)] + args, limit=limit, context=context)
|
||||
return self.name_get(cr, user, ids, context)
|
||||
|
||||
def _refund_cleanup_lines(self, cr, uid, lines):
|
||||
@@ -1080,7 +1062,9 @@ class account_invoice(osv.osv):
|
||||
|
||||
def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None):
|
||||
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id'])
|
||||
|
||||
obj_invoice_line = self.pool.get('account.invoice.line')
|
||||
obj_invoice_tax = self.pool.get('account.invoice.tax')
|
||||
obj_journal = self.pool.get('account.journal')
|
||||
new_ids = []
|
||||
for invoice in invoices:
|
||||
del invoice['id']
|
||||
@@ -1092,20 +1076,20 @@ class account_invoice(osv.osv):
|
||||
'in_refund': 'in_invoice', # Supplier Refund
|
||||
}
|
||||
|
||||
invoice_lines = self.pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'])
|
||||
invoice_lines = obj_invoice_line.read(cr, uid, invoice['invoice_line'])
|
||||
invoice_lines = self._refund_cleanup_lines(cr, uid, invoice_lines)
|
||||
|
||||
tax_lines = self.pool.get('account.invoice.tax').read(cr, uid, invoice['tax_line'])
|
||||
tax_lines = obj_invoice_tax.read(cr, uid, invoice['tax_line'])
|
||||
tax_lines = filter(lambda l: l['manual'], tax_lines)
|
||||
tax_lines = self._refund_cleanup_lines(cr, uid, tax_lines)
|
||||
if journal_id:
|
||||
refund_journal_ids = [journal_id]
|
||||
elif invoice['type'] == 'in_invoice':
|
||||
refund_journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase_refund')])
|
||||
refund_journal_ids = obj_journal.search(cr, uid, [('type','=','purchase_refund')])
|
||||
else:
|
||||
refund_journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')])
|
||||
refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')])
|
||||
|
||||
if not date :
|
||||
if not date:
|
||||
date = time.strftime('%Y-%m-%d')
|
||||
invoice.update({
|
||||
'type': type_dict[invoice['type']],
|
||||
@@ -1116,11 +1100,11 @@ class account_invoice(osv.osv):
|
||||
'tax_line': tax_lines,
|
||||
'journal_id': refund_journal_ids
|
||||
})
|
||||
if period_id :
|
||||
if period_id:
|
||||
invoice.update({
|
||||
'period_id': period_id,
|
||||
})
|
||||
if description :
|
||||
if description:
|
||||
invoice.update({
|
||||
'name': description,
|
||||
})
|
||||
@@ -1130,6 +1114,7 @@ class account_invoice(osv.osv):
|
||||
invoice[field] = invoice[field] and invoice[field][0]
|
||||
# create the new invoice
|
||||
new_ids.append(self.create(cr, uid, invoice))
|
||||
|
||||
return new_ids
|
||||
|
||||
def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''):
|
||||
@@ -1137,7 +1122,7 @@ class account_invoice(osv.osv):
|
||||
context = {}
|
||||
#TODO check if we can use different period for payment and the writeoff line
|
||||
assert len(ids)==1, "Can only pay one invoice at a time"
|
||||
invoice = self.browse(cr, uid, ids[0])
|
||||
invoice = self.browse(cr, uid, ids[0], context=context)
|
||||
src_account_id = invoice.account_id.id
|
||||
# Take the seq as name for move
|
||||
types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}
|
||||
@@ -1218,17 +1203,19 @@ class account_invoice(osv.osv):
|
||||
|
||||
inv_id, name = self.name_get(cr, uid, [invoice.id], context=context)[0]
|
||||
if (not round(total,self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))) or writeoff_acc_id:
|
||||
self.log(cr, uid, inv_id, _('Invoice ') + " '" + name + "' "+ _("is totally paid."))
|
||||
self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context)
|
||||
else:
|
||||
code = invoice.currency_id.code
|
||||
amt = str(pay_amount) + code + ' on ' + str(invoice.amount_total) + code + ' (' + str(total) + code + ' remaining)'
|
||||
self.log(cr, uid, inv_id, _('Invoice ') + " '" + name + "' "+ _("is paid partially: ") + amt)
|
||||
code = invoice.currency_id.symbol
|
||||
# TODO: use currency's formatting function
|
||||
msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining)") % \
|
||||
(name, pay_amount, code, invoice.amount_total, code, total, code)
|
||||
self.log(cr, uid, inv_id, msg)
|
||||
self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)
|
||||
|
||||
# Update the stored value (fields.function), so we write to trigger recompute
|
||||
self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context)
|
||||
return True
|
||||
|
||||
account_invoice()
|
||||
|
||||
class account_invoice_line(osv.osv):
|
||||
@@ -1289,14 +1276,6 @@ class account_invoice_line(osv.osv):
|
||||
'price_unit': _price_unit_default,
|
||||
}
|
||||
|
||||
def product_id_change_unit_price_inv(self, cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=None):
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
if price_unit:
|
||||
taxes = tax_obj.browse(cr, uid, tax_id)
|
||||
for tax in tax_obj.compute_inv(cr, uid, taxes, price_unit, qty, address_invoice_id, product, partner_id):
|
||||
price_unit = price_unit - tax['amount']
|
||||
return {'price_unit': price_unit,'invoice_line_tax_id': tax_id}
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
@@ -1308,9 +1287,9 @@ class account_invoice_line(osv.osv):
|
||||
return {'value': {'categ_id': False}, 'domain':{'product_uom':[]}}
|
||||
else:
|
||||
return {'value': {'price_unit': 0.0, 'categ_id': False}, 'domain':{'product_uom':[]}}
|
||||
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
|
||||
fpos_obj = self.pool.get('account.fiscal.position')
|
||||
fpos = fposition_id and fpos_obj.browse(cr, uid, fposition_id) or False
|
||||
fpos = fposition_id and fpos_obj.browse(cr, uid, fposition_id, context=context) or False
|
||||
|
||||
if part.lang:
|
||||
context.update({'lang': part.lang})
|
||||
@@ -1340,7 +1319,7 @@ class account_invoice_line(osv.osv):
|
||||
# Parse the value_reference field to get the ID of the account.account record
|
||||
account_id = int (my_value[0]["value_reference"].split(",")[1])
|
||||
# Use the ID of the account.account record in the browse for the account.account record
|
||||
app_acc_in = account_obj.browse(cr, uid, [account_id])[0]
|
||||
app_acc_in = account_obj.browse(cr, uid, account_id, context=context)
|
||||
if not exp_pro_id:
|
||||
ex_acc = res.product_tmpl_id.property_account_expense
|
||||
ex_acc_cate = res.categ_id.property_account_expense_categ
|
||||
@@ -1349,7 +1328,7 @@ class account_invoice_line(osv.osv):
|
||||
else:
|
||||
app_acc_exp = ex_acc_cate
|
||||
else:
|
||||
app_acc_exp = account_obj.browse(cr, uid, exp_pro_id)[0]
|
||||
app_acc_exp = account_obj.browse(cr, uid, exp_pro_id, context=context)[0]
|
||||
if not in_pro_id and not exp_pro_id:
|
||||
in_acc = res.product_tmpl_id.property_account_income
|
||||
in_acc_cate = res.categ_id.property_account_income_categ
|
||||
@@ -1361,14 +1340,14 @@ class account_invoice_line(osv.osv):
|
||||
else:
|
||||
app_acc_in = in_acc_cate
|
||||
app_acc_exp = ex_acc_cate
|
||||
if app_acc_in.company_id.id != company_id and app_acc_exp.company_id.id != company_id:
|
||||
if app_acc_in and app_acc_in.company_id.id != company_id and app_acc_exp and app_acc_exp.company_id.id != company_id:
|
||||
in_res_id = account_obj.search(cr, uid, [('name','=',app_acc_in.name),('company_id','=',company_id)])
|
||||
exp_res_id = account_obj.search(cr, uid, [('name','=',app_acc_exp.name),('company_id','=',company_id)])
|
||||
if not in_res_id and not exp_res_id:
|
||||
raise osv.except_osv(_('Configuration Error !'),
|
||||
_('Can not find account chart for this company, Please Create account.'))
|
||||
in_obj_acc = account_obj.browse(cr, uid, in_res_id)
|
||||
exp_obj_acc = account_obj.browse(cr, uid, exp_res_id)
|
||||
in_obj_acc = account_obj.browse(cr, uid, in_res_id, context=context)
|
||||
exp_obj_acc = account_obj.browse(cr, uid, exp_res_id, context=context)
|
||||
if in_acc or ex_acc:
|
||||
res.product_tmpl_id.property_account_income = in_obj_acc[0]
|
||||
res.product_tmpl_id.property_account_expense = exp_obj_acc[0]
|
||||
@@ -1384,33 +1363,27 @@ class account_invoice_line(osv.osv):
|
||||
a = res.product_tmpl_id.property_account_expense.id
|
||||
if not a:
|
||||
a = res.categ_id.property_account_expense_categ.id
|
||||
|
||||
a = fpos_obj.map_account(cr, uid, fpos, a)
|
||||
if a:
|
||||
result['account_id'] = a
|
||||
|
||||
taxep = None
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
if type in ('out_invoice', 'out_refund'):
|
||||
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
|
||||
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False)
|
||||
else:
|
||||
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
|
||||
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a, context=context).tax_ids or False)
|
||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
|
||||
|
||||
if type in ('in_invoice', 'in_refund'):
|
||||
to_update = self.product_id_change_unit_price_inv(cr, uid, tax_id, price_unit or res.standard_price, qty, address_invoice_id, product, partner_id, context=context)
|
||||
result.update(to_update)
|
||||
result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} )
|
||||
else:
|
||||
result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})
|
||||
|
||||
# if not name:
|
||||
result['name'] = res.partner_ref
|
||||
|
||||
domain = {}
|
||||
result['uos_id'] = res.uom_id.id or uom or False
|
||||
if result['uos_id']:
|
||||
res2 = res.uom_id.category_id.id
|
||||
if res2 :
|
||||
if res2:
|
||||
domain = {'uos_id':[('category_id','=',res2 )]}
|
||||
|
||||
result['categ_id'] = res.categ_id.id
|
||||
@@ -1419,8 +1392,8 @@ class account_invoice_line(osv.osv):
|
||||
if not company_id or not currency_id:
|
||||
return res_final
|
||||
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id)
|
||||
currency = self.pool.get('res.currency').browse(cr, uid, currency_id)
|
||||
company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
|
||||
currency = self.pool.get('res.currency').browse(cr, uid, currency_id, context=context)
|
||||
|
||||
if company.currency_id.id != currency.id:
|
||||
new_price = res_final['value']['price_unit'] * currency.rate
|
||||
@@ -1434,22 +1407,31 @@ class account_invoice_line(osv.osv):
|
||||
return res_final
|
||||
|
||||
def uos_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
||||
res = self.product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context)
|
||||
warning = {}
|
||||
res = self.product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, currency_id, context=context)
|
||||
if 'uos_id' in res['value']:
|
||||
del res['value']['uos_id']
|
||||
if not uom:
|
||||
res['value']['price_unit'] = 0.0
|
||||
if product and uom:
|
||||
prod = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||
prod_uom = self.pool.get('product.uom').browse(cr, uid, uom, context=context)
|
||||
if prod.uom_id.category_id.id != prod_uom.category_id.id:
|
||||
warning = {
|
||||
'title': _('Warning!'),
|
||||
'message': _('You selected an Unit of Measure which is not compatible with the product.')
|
||||
}
|
||||
return {'value': res['value'], 'warning': warning}
|
||||
return res
|
||||
|
||||
def move_line_get(self, cr, uid, invoice_id, context=None):
|
||||
res = []
|
||||
tax_grouped = {}
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
ait_obj = self.pool.get('account.invoice.tax')
|
||||
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id)
|
||||
if context is None:
|
||||
context = {}
|
||||
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
|
||||
company_currency = inv.company_id.currency_id.id
|
||||
cur = inv.currency_id
|
||||
|
||||
for line in inv.invoice_line:
|
||||
mres = self.move_line_get_item(cr, uid, line, context)
|
||||
@@ -1505,8 +1487,8 @@ class account_invoice_line(osv.osv):
|
||||
taxes = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids
|
||||
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
|
||||
res = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||
r = {'value':{'invoice_line_tax_id': res}}
|
||||
return r
|
||||
return {'value':{'invoice_line_tax_id': res}}
|
||||
|
||||
account_invoice_line()
|
||||
|
||||
class account_invoice_tax(osv.osv):
|
||||
@@ -1538,14 +1520,13 @@ class account_invoice_tax(osv.osv):
|
||||
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
|
||||
'manual': fields.boolean('Manual'),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of invoice tax."),
|
||||
|
||||
'base_code_id': fields.many2one('account.tax.code', 'Base Code', help="The account basis of the tax declaration."),
|
||||
'base_amount': fields.float('Base Code Amount', digits_compute=dp.get_precision('Account')),
|
||||
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."),
|
||||
'tax_amount': fields.float('Tax Code Amount', digits_compute=dp.get_precision('Account')),
|
||||
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True),
|
||||
'factor_base' : fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"),
|
||||
'factor_tax' : fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all")
|
||||
'factor_base': fields.function(_count_factor, method=True, string='Multipication factor for Base code', type='float', multi="all"),
|
||||
'factor_tax': fields.function(_count_factor, method=True, string='Multipication factor Tax code', type='float', multi="all")
|
||||
}
|
||||
|
||||
def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False):
|
||||
@@ -1576,15 +1557,15 @@ class account_invoice_tax(osv.osv):
|
||||
|
||||
_order = 'sequence'
|
||||
_defaults = {
|
||||
'manual': lambda *a: 1,
|
||||
'base_amount': lambda *a: 0.0,
|
||||
'tax_amount': lambda *a: 0.0,
|
||||
'manual': 1,
|
||||
'base_amount': 0.0,
|
||||
'tax_amount': 0.0,
|
||||
}
|
||||
def compute(self, cr, uid, invoice_id, context={}):
|
||||
def compute(self, cr, uid, invoice_id, context=None):
|
||||
tax_grouped = {}
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context)
|
||||
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
|
||||
cur = inv.currency_id
|
||||
company_currency = inv.company_id.currency_id.id
|
||||
|
||||
@@ -1621,6 +1602,7 @@ class account_invoice_tax(osv.osv):
|
||||
tax_grouped[key]['tax_amount'] += val['tax_amount']
|
||||
|
||||
for t in tax_grouped.values():
|
||||
t['base'] = cur_obj.round(cr, uid, cur, t['base'])
|
||||
t['amount'] = cur_obj.round(cr, uid, cur, t['amount'])
|
||||
t['base_amount'] = cur_obj.round(cr, uid, cur, t['base_amount'])
|
||||
t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount'])
|
||||
@@ -1645,6 +1627,7 @@ class account_invoice_tax(osv.osv):
|
||||
'tax_amount': t['tax_amount']
|
||||
})
|
||||
return res
|
||||
|
||||
account_invoice_tax()
|
||||
|
||||
|
||||
|
||||
+23
-25
@@ -18,23 +18,23 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
from osv import fields, osv
|
||||
import ir
|
||||
|
||||
class account_fiscal_position(osv.osv):
|
||||
_name = 'account.fiscal.position'
|
||||
_description = 'Fiscal Mapping'
|
||||
_description = 'Fiscal Position'
|
||||
_columns = {
|
||||
'name': fields.char('Fiscal Mapping', size=64, translate=True, required=True),
|
||||
'name': fields.char('Fiscal Position', size=64, translate=True, required=True),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'account_ids': fields.one2many('account.fiscal.position.account', 'position_id', 'Account Mapping'),
|
||||
'tax_ids': fields.one2many('account.fiscal.position.tax', 'position_id', 'Tax Mapping'),
|
||||
'note': fields.text('Notes', translate=True),
|
||||
}
|
||||
|
||||
def map_tax(self, cr, uid, fposition_id, taxes, context={}):
|
||||
def map_tax(self, cr, uid, fposition_id, taxes, context=None):
|
||||
if not taxes:
|
||||
return []
|
||||
if not fposition_id:
|
||||
@@ -51,38 +51,39 @@ class account_fiscal_position(osv.osv):
|
||||
result.append(t.id)
|
||||
return result
|
||||
|
||||
def map_account(self, cr, uid, fposition_id, account_id, context={}):
|
||||
if not fposition_id :
|
||||
def map_account(self, cr, uid, fposition_id, account_id, context=None):
|
||||
if not fposition_id:
|
||||
return account_id
|
||||
for pos in fposition_id.account_ids:
|
||||
if pos.account_src_id.id == account_id:
|
||||
account_id = pos.account_dest_id.id
|
||||
break
|
||||
return account_id
|
||||
account_fiscal_position()
|
||||
|
||||
account_fiscal_position()
|
||||
|
||||
class account_fiscal_position_tax(osv.osv):
|
||||
_name = 'account.fiscal.position.tax'
|
||||
_description = 'Taxes Fiscal Mapping'
|
||||
_description = 'Taxes Fiscal Position'
|
||||
_rec_name = 'position_id'
|
||||
_columns = {
|
||||
'position_id': fields.many2one('account.fiscal.position', 'Fiscal Mapping', required=True, ondelete='cascade'),
|
||||
'position_id': fields.many2one('account.fiscal.position', 'Fiscal Position', required=True, ondelete='cascade'),
|
||||
'tax_src_id': fields.many2one('account.tax', 'Tax Source', required=True),
|
||||
'tax_dest_id': fields.many2one('account.tax', 'Replacement Tax')
|
||||
}
|
||||
account_fiscal_position_tax()
|
||||
|
||||
account_fiscal_position_tax()
|
||||
|
||||
class account_fiscal_position_account(osv.osv):
|
||||
_name = 'account.fiscal.position.account'
|
||||
_description = 'Accounts Fiscal Mapping'
|
||||
_description = 'Accounts Fiscal Position'
|
||||
_rec_name = 'position_id'
|
||||
_columns = {
|
||||
'position_id': fields.many2one('account.fiscal.position', 'Fiscal Mapping', required=True, ondelete='cascade'),
|
||||
'position_id': fields.many2one('account.fiscal.position', 'Fiscal Position', required=True, ondelete='cascade'),
|
||||
'account_src_id': fields.many2one('account.account', 'Account Source', domain=[('type','<>','view')], required=True),
|
||||
'account_dest_id': fields.many2one('account.account', 'Account Destination', domain=[('type','<>','view')], required=True)
|
||||
}
|
||||
|
||||
account_fiscal_position_account()
|
||||
|
||||
class res_partner(osv.osv):
|
||||
@@ -90,7 +91,7 @@ class res_partner(osv.osv):
|
||||
_inherit = 'res.partner'
|
||||
_description = 'Partner'
|
||||
|
||||
def _credit_debit_get(self, cr, uid, ids, field_names, arg, context):
|
||||
def _credit_debit_get(self, cr, uid, ids, field_names, arg, context=None):
|
||||
query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
|
||||
cr.execute("""SELECT l.partner_id, a.type, SUM(l.debit-l.credit)
|
||||
FROM account_move_line l
|
||||
@@ -102,10 +103,6 @@ class res_partner(osv.osv):
|
||||
GROUP BY l.partner_id, a.type
|
||||
""",
|
||||
(tuple(ids),))
|
||||
tinvert = {
|
||||
'credit': 'receivable',
|
||||
'debit': 'payable'
|
||||
}
|
||||
maps = {'receivable':'credit', 'payable':'debit' }
|
||||
res = {}
|
||||
for id in ids:
|
||||
@@ -116,7 +113,7 @@ class res_partner(osv.osv):
|
||||
return res
|
||||
|
||||
def _asset_difference_search(self, cr, uid, obj, name, type, args, context=None):
|
||||
if not len(args):
|
||||
if not args:
|
||||
return []
|
||||
having_values = tuple(map(itemgetter(2), args))
|
||||
where = ' AND '.join(
|
||||
@@ -133,14 +130,14 @@ class res_partner(osv.osv):
|
||||
'GROUP BY partner_id HAVING '+where),
|
||||
(type,) + having_values)
|
||||
res = cr.fetchall()
|
||||
if not len(res):
|
||||
if not res:
|
||||
return [('id','=','0')]
|
||||
return [('id','in',map(itemgetter(0), res))]
|
||||
|
||||
def _credit_search(self, cr, uid, obj, name, args, context):
|
||||
def _credit_search(self, cr, uid, obj, name, args, context=None):
|
||||
return self._asset_difference_search(cr, uid, obj, name, 'receivable', args, context=context)
|
||||
|
||||
def _debit_search(self, cr, uid, obj, name, args, context):
|
||||
def _debit_search(self, cr, uid, obj, name, args, context=None):
|
||||
return self._asset_difference_search(cr, uid, obj, name, 'payable', args, context=context)
|
||||
|
||||
_columns = {
|
||||
@@ -172,10 +169,10 @@ class res_partner(osv.osv):
|
||||
'account.fiscal.position',
|
||||
type='many2one',
|
||||
relation='account.fiscal.position',
|
||||
string="Fiscal Mapping",
|
||||
string="Fiscal Position",
|
||||
method=True,
|
||||
view_load=True,
|
||||
help="The fiscal Mapping will determine taxes and the accounts used for the partner.",
|
||||
help="The fiscal position will determine taxes and the accounts used for the partner.",
|
||||
),
|
||||
'property_payment_term': fields.property(
|
||||
'account.payment.term',
|
||||
@@ -187,8 +184,9 @@ class res_partner(osv.osv):
|
||||
help="This payment term will be used instead of the default one for the current partner"),
|
||||
'ref_companies': fields.one2many('res.company', 'partner_id',
|
||||
'Companies that refers to partner'),
|
||||
'last_reconciliation_date': fields.datetime('Last Reconciliation Date', help='Date on which the partner accounting entries were reconciled last time')
|
||||
'last_reconciliation_date': fields.datetime('Latest Reconciliation Date', help='Date on which the partner accounting entries were reconciled last time')
|
||||
}
|
||||
|
||||
res_partner()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="model">account.fiscal.position</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Fiscal Mapping">
|
||||
<form string="Fiscal Position">
|
||||
<field name="name" select="1"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<separator string="Mapping" colspan="4"/>
|
||||
@@ -42,7 +42,7 @@
|
||||
<field name="model">account.fiscal.position</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Fiscal Mapping">
|
||||
<tree string="Fiscal Position">
|
||||
<field name="name"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</tree>
|
||||
@@ -50,7 +50,7 @@
|
||||
</record>
|
||||
|
||||
<record id="action_account_fiscal_position_form" model="ir.actions.act_window">
|
||||
<field name="name">Fiscal Mappings</field>
|
||||
<field name="name">Fiscal Positions</field>
|
||||
<field name="res_model">account.fiscal.position</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
@@ -143,7 +143,7 @@
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="credit_limit" position="after">
|
||||
<field name="last_reconciliation_date"/>
|
||||
<field name="last_reconciliation_date" groups="base.group_extended"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
</record>
|
||||
|
||||
<record id="process_node_reconciliation0" model="process.node">
|
||||
<field name="menu_id" ref="account.menu_eaction_account_moves_all"/>
|
||||
<field name="model_id" ref="account.model_account_move_reconcile"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Reconciliation"""" name="name"/>
|
||||
@@ -105,7 +104,6 @@
|
||||
</record>
|
||||
|
||||
<record id="process_node_accountingstatemententries0" model="process.node">
|
||||
<field name="menu_id" ref="account.menu_eaction_account_moves_all"/>
|
||||
<field name="model_id" ref="account.model_account_move_line"/>
|
||||
<field eval=""""subflow"""" name="kind"/>
|
||||
<field eval=""""Bank Statement"""" name="name"/>
|
||||
|
||||
@@ -72,7 +72,6 @@
|
||||
</record>
|
||||
|
||||
<record id="process_node_supplierpaymentorder0" model="process.node">
|
||||
<field name="menu_id" ref="account.menu_eaction_account_moves_all"/>
|
||||
<field name="model_id" ref="account.model_account_move_line"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Payment Order"""" name="name"/>
|
||||
@@ -83,7 +82,6 @@
|
||||
</record>
|
||||
|
||||
<record id="process_node_supplierreconciliation0" model="process.node">
|
||||
<field name="menu_id" ref="account.menu_eaction_account_moves_all"/>
|
||||
<field name="model_id" ref="account.model_account_move_reconcile"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Reconciliation"""" name="name"/>
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
|
||||
class product_category(osv.osv):
|
||||
@@ -75,5 +73,7 @@ class product_template(osv.osv):
|
||||
view_load=True,
|
||||
help="This account will be used for invoices instead of the default one to value expenses for the current product"),
|
||||
}
|
||||
|
||||
product_template()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<notebook position="inside">
|
||||
<page string="Accounting">
|
||||
<group groups="base.group_extended">
|
||||
<group name="properties" groups="base.group_extended">
|
||||
<separator string="Sales Properties" colspan="2"/>
|
||||
<separator string="Purchase Properties" colspan="2"/>
|
||||
<field name="property_account_income" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" groups="base.group_extended"/>
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
<field name="parent_id" ref="analytic_project_1"/>
|
||||
</record>
|
||||
<record id="analytic_administratif" model="account.analytic.account">
|
||||
<field name="name">Administratif</field>
|
||||
<field name="name">Administrative</field>
|
||||
<field name="code">1</field>
|
||||
<field name="parent_id" ref="analytic_internal"/>
|
||||
</record>
|
||||
|
||||
@@ -19,36 +19,35 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import operator
|
||||
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
|
||||
class account_analytic_journal(osv.osv):
|
||||
_name = 'account.analytic.journal'
|
||||
_description = 'Analytic Journal'
|
||||
_columns = {
|
||||
'name' : fields.char('Journal Name', size=64, required=True),
|
||||
'code' : fields.char('Journal Code', size=8),
|
||||
'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the analytic journal without removing it."),
|
||||
'name': fields.char('Journal Name', size=64, required=True),
|
||||
'code': fields.char('Journal Code', size=8),
|
||||
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the analytic journal without removing it."),
|
||||
'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True, help="Gives the type of the analytic journal. When it needs for a document (eg: an invoice) to create analytic entries, OpenERP will look for a matching journal of the same type."),
|
||||
'line_ids' : fields.one2many('account.analytic.line', 'journal_id', 'Lines'),
|
||||
'line_ids': fields.one2many('account.analytic.line', 'journal_id', 'Lines'),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *a: True,
|
||||
'type': lambda *a: 'general',
|
||||
'active': True,
|
||||
'type': 'general',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
}
|
||||
|
||||
account_analytic_journal()
|
||||
|
||||
class account_journal(osv.osv):
|
||||
_inherit="account.journal"
|
||||
|
||||
_columns = {
|
||||
'analytic_journal_id':fields.many2one('account.analytic.journal','Analytic Journal',help="Journal for analytic entries"),
|
||||
'analytic_journal_id':fields.many2one('account.analytic.journal','Analytic Journal', help="Journal for analytic entries"),
|
||||
}
|
||||
|
||||
account_journal()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<report auto="False" id="analytic_journal_print" menu="False" model="account.analytic.journal" name="account.analytic.account.journal" rml="account/project/report/analytic_journal.rml" string="Analytic Journal"/>
|
||||
<report auto="False" id="analytic_journal_print" menu="False"
|
||||
model="account.analytic.journal" name="account.analytic.account.journal"
|
||||
rml="account/project/report/analytic_journal.rml" string="Analytic Journal"/>
|
||||
|
||||
<report auto="False" id="account_analytic_account_balance" menu="False" model="account.analytic.account" name="account.analytic.account.balance" rml="account/project/report/analytic_balance.rml" string="Analytic Balance"/>
|
||||
<report auto="False" id="account_analytic_account_balance" menu="False"
|
||||
model="account.analytic.account" name="account.analytic.account.balance"
|
||||
rml="account/project/report/analytic_balance.rml" string="Analytic Balance"/>
|
||||
|
||||
<report auto="False" id="account_analytic_account_inverted_balance" menu="False" model="account.analytic.account" name="account.analytic.account.inverted.balance" rml="account/project/report/inverted_analytic_balance.rml" string="Inverted Analytic Balance"/>
|
||||
<report auto="False" id="account_analytic_account_inverted_balance"
|
||||
menu="False" model="account.analytic.account"
|
||||
name="account.analytic.account.inverted.balance"
|
||||
rml="account/project/report/inverted_analytic_balance.rml"
|
||||
string="Inverted Analytic Balance"/>
|
||||
|
||||
<report auto="False" id="account_analytic_account_cost_ledger" menu="False" model="account.analytic.account" name="account.analytic.account.cost_ledger" rml="account/project/report/cost_ledger.rml" string="Cost Ledger"/>
|
||||
<report auto="False" id="account_analytic_account_cost_ledger" menu="False"
|
||||
model="account.analytic.account" name="account.analytic.account.cost_ledger"
|
||||
rml="account/project/report/cost_ledger.rml" string="Cost Ledger"/>
|
||||
|
||||
<report auto="False" id="account_analytic_account_quantity_cost_ledger" menu="False" model="account.analytic.account" name="account.analytic.account.quantity_cost_ledger" rml="account/project/report/quantity_cost_ledger.rml" string="Cost Ledger (Only quantities)"/>
|
||||
<report auto="False" id="account_analytic_account_quantity_cost_ledger"
|
||||
menu="False" model="account.analytic.account"
|
||||
name="account.analytic.account.quantity_cost_ledger"
|
||||
rml="account/project/report/quantity_cost_ledger.rml"
|
||||
string="Cost Ledger (Only quantities)"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<field name="quantity"/>
|
||||
<field name="quantity_max"/>
|
||||
<field name="date"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="parent_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -79,12 +82,13 @@
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="parent_id" on_change="on_change_parent(parent_id)" groups="base.group_extended"/>
|
||||
<field name="company_id" select="2" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="company_id" on_change="on_change_company(company_id)" select="2" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','<>','view')]}"/>
|
||||
<field name="type" select="2"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Account Data">
|
||||
<field name="partner_id" select="1"/>
|
||||
<field name="currency_id" select="1"/>
|
||||
<newline/>
|
||||
<field name="date_start"/>
|
||||
<field name="date" select="2"/>
|
||||
@@ -109,7 +113,9 @@
|
||||
<field name="view_id" ref="view_account_analytic_account_tree"/>
|
||||
<field name="search_view_id" ref="account.view_account_analytic_account_search"/>
|
||||
</record>
|
||||
<menuitem action="action_account_analytic_account_form" id="account_analytic_def_account" parent="menu_analytic_accounting" groups="analytic.group_analytic_accounting"/>
|
||||
<menuitem action="action_account_analytic_account_form" id="account_analytic_def_account"
|
||||
parent="menu_analytic_accounting"
|
||||
groups="analytic.group_analytic_accounting"/>
|
||||
|
||||
<record id="act_account_renew_view" model="ir.actions.act_window">
|
||||
<field name="name">Accounts to Renew</field>
|
||||
@@ -127,10 +133,12 @@
|
||||
<field name="view_type">tree</field>
|
||||
<field name="view_id" ref="view_account_analytic_account_tree"/>
|
||||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
<field name="help">Analytic Charts of Accounts allows you to access to reports by analytic accounts (or cost accounts) . From this menu you can access to analytic balance, a report that relates the analytic accounts to the general accounts. It is useful for analyzing the profitability of projects, giving you the profitability of a project for the different operations that you used to carry out the project.</field>
|
||||
<field name="help">The normal chart of accounts has a structure defined by the legal requirement of the country. The analytic chart of account structure should reflect your own business needs in term of costs/revenues reporting. They are usually structured by contracts, projects, products or departements. Most of the OpenERP operations (invoices, timesheets, expenses, etc) generate analytic entries on the related account.</field>
|
||||
</record>
|
||||
|
||||
<menuitem groups="analytic.group_analytic_accounting" id="next_id_40" name="Analytic" parent="account.menu_finance_generic_reporting" sequence="4"/>
|
||||
<menuitem groups="analytic.group_analytic_accounting" id="next_id_40"
|
||||
name="Analytic" parent="account.menu_finance_generic_reporting"
|
||||
sequence="4"/>
|
||||
|
||||
<record id="view_account_analytic_line_form" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.form</field>
|
||||
@@ -182,6 +190,7 @@
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" invisible="not context.get('to_invoice', False)"/>
|
||||
<field domain="[('type','=','normal')]" name="account_id"/>
|
||||
<field name="general_account_id" invisible="context.get('to_invoice', False)"/>
|
||||
<field name="user_id" invisible="1" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -192,9 +201,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Analytic Lines">
|
||||
<group col='6' colspan='4'>
|
||||
<filter name="sales" string="Sales" domain="[('journal_id.type','=','sale')]" icon="terp-sale" help="Analytic Journal Items related to a sale journal."/>
|
||||
<filter name="sales" string="Sales" domain="[('journal_id.type','=','sale')]" icon="terp-camera_test" help="Analytic Journal Items related to a sale journal."/>
|
||||
<filter name="purchases" string="Purchases" domain="[('journal_id.type','=','purchase')]" icon="terp-purchase" help="Analytic Journal Items related to a purchase journal."/>
|
||||
<filter name="others" string="Others" domain="[('journal_id.type','in',('cash','general','situation')]" icon="terp-folder-orange"/>
|
||||
<filter name="others" string="Others" domain="[('journal_id.type','in',('cash','general','situation'))]" icon="terp-folder-orange"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
@@ -202,10 +211,16 @@
|
||||
<field name="user_id">
|
||||
<filter string="My Entries" domain="[('user_id','=',uid)]" icon="terp-personal"/>
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended Filters...">
|
||||
<field name="journal_id" widget="selection"/>
|
||||
<field name="product_id" widget="selection"/>
|
||||
<field name="amount" select="1"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group string="Group By..." expand="0">
|
||||
<filter string="Account" context="{'group_by':'account_id'}" groups="base.group_extended" icon="terp-folder-blue"/>
|
||||
<filter string="Account" context="{'group_by':'account_id'}" groups="base.group_extended" icon="terp-folder-green"/>
|
||||
<filter string="Journal" context="{'group_by':'journal_id'}" icon="terp-folder-orange"/>
|
||||
<filter string="User" context="{'group_by':'user_id'}" icon="terp-personal"/>
|
||||
<separator orientation="vertical"/>
|
||||
@@ -213,12 +228,6 @@
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Product" context="{'group_by':'product_id'}" icon="terp-accessories-archiver"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options...">
|
||||
<field name="journal_id" widget="selection"/>
|
||||
<field name="product_id" widget="selection"/>
|
||||
<field name="amount" select="1"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -309,7 +318,7 @@
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Type" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'type'}"/>
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
@@ -333,7 +342,7 @@
|
||||
<field name="name">Analytic Journals</field>
|
||||
<field name="res_model">account.analytic.journal</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,search</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_analytic_journal_search" />
|
||||
</record>
|
||||
<menuitem groups="analytic.group_analytic_accounting" action="action_account_analytic_journal_form" id="account_def_analytic_journal" parent="menu_analytic_accounting" sequence="5"/>
|
||||
@@ -348,7 +357,10 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem groups="analytic.group_analytic_accounting" action="action_account_analytic_journal_open_form" id="account_analytic_journal_entries" parent="menu_finance_entries"/>
|
||||
<menuitem groups="analytic.group_analytic_accounting"
|
||||
action="action_account_analytic_journal_open_form"
|
||||
id="account_analytic_journal_entries"
|
||||
parent="menu_finance_entries"/>
|
||||
|
||||
#
|
||||
# Reporting
|
||||
@@ -360,7 +372,9 @@
|
||||
<field name="view_type">tree</field>
|
||||
<field name="help">To print an analytics (or costs) journal for a given period. The report give code, move name, account number, general amount and analytic amount.</field>
|
||||
</record>
|
||||
<menuitem groups="analytic.group_analytic_accounting" action="action_account_analytic_journal_tree" id="account_analytic_journal_print" parent="account.next_id_40"/>
|
||||
<menuitem groups="analytic.group_analytic_accounting"
|
||||
action="action_account_analytic_journal_tree"
|
||||
id="account_analytic_journal_print" parent="account.next_id_40"/>
|
||||
|
||||
#
|
||||
# Statistics
|
||||
@@ -430,13 +444,13 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
<act_window
|
||||
context="{'search_default_account_id': [active_id], 'search_default_user_id': False}"
|
||||
id="act_acc_analytic_acc_5_report_hr_timesheet_invoice_journal"
|
||||
name="All Analytic Entries"
|
||||
res_model="account.analytic.line"
|
||||
src_model="account.analytic.account"
|
||||
view_mode="tree,form"
|
||||
id="act_acc_analytic_acc_5_report_hr_timesheet_invoice_journal"
|
||||
name="All Analytic Entries"
|
||||
res_model="account.analytic.line"
|
||||
src_model="account.analytic.account"
|
||||
view_mode="tree,form"
|
||||
view_type="form"/>
|
||||
|
||||
<record id="view_account_journal_1" model="ir.ui.view">
|
||||
|
||||
@@ -100,14 +100,14 @@ class account_analytic_balance(report_sxw.rml_parse):
|
||||
ids = self.acc_data_dict[account_id]
|
||||
|
||||
query_params = (tuple(ids), date1, date2)
|
||||
if option == "credit" :
|
||||
if option == "credit":
|
||||
self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
|
||||
elif option == "debit" :
|
||||
elif option == "debit":
|
||||
self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \
|
||||
WHERE account_id IN %s\
|
||||
AND date>=%s AND date<=%s AND amount>0",query_params)
|
||||
elif option == "quantity" :
|
||||
elif option == "quantity":
|
||||
self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \
|
||||
WHERE account_id IN %s\
|
||||
AND date>=%s AND date<=%s",query_params)
|
||||
@@ -119,25 +119,25 @@ class account_analytic_balance(report_sxw.rml_parse):
|
||||
return (debit-credit)
|
||||
|
||||
def _sum_all(self, accounts, date1, date2, option):
|
||||
account_analytic_obj = self.pool.get('account.analytic.account')
|
||||
ids = map(lambda x: x['id'], accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
|
||||
if not self.acc_sum_list:
|
||||
account_analytic_obj = self.pool.get('account.analytic.account')
|
||||
ids2 = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', ids)])
|
||||
self.acc_sum_list = ids2
|
||||
else:
|
||||
ids2 = self.acc_sum_list
|
||||
|
||||
|
||||
query_params = (tuple(ids2), date1, date2)
|
||||
if option == "debit" :
|
||||
if option == "debit":
|
||||
self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",query_params)
|
||||
elif option == "credit" :
|
||||
elif option == "credit":
|
||||
self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
|
||||
elif option == "quantity" :
|
||||
elif option == "quantity":
|
||||
self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s",query_params)
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Analytic Balance" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
|
||||
<document filename="Analytic Balance.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Analytic 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"/>
|
||||
<frame id="first" x1="31.0" y1="30.0" width="531" height="779"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
@@ -34,13 +34,13 @@
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table3">
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table2">
|
||||
<blockTableStyle id="Table3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
|
||||
@@ -88,17 +88,9 @@
|
||||
<images/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<blockTable colWidths="482.0" style="Table_Header_analytic">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_header_Centre">Analytic Balance - [[ company.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_space">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="55.0,221.0,55.0,52.0,60.0,39.0" style="Table_Header_Tile">
|
||||
<pto>
|
||||
<pto_header>
|
||||
<blockTable colWidths="57.0,192.0,71.0,71.0,71.0,71.0" style="Table_Header_Tile">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Code</para>
|
||||
@@ -120,24 +112,55 @@
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
</pto_header>
|
||||
|
||||
<blockTable colWidths="532.0" style="Table_Header_analytic">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_header_Centre">Analytic Balance - [[ company.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_space">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="54.0,222.0,56.0,51.0,62.0,38.0" style="Table1">
|
||||
<blockTable colWidths="57.0,192.0,71.0,71.0,71.0,71.0" style="Table_Header_Tile">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Account Name</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Balance</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Quantity</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="57.0,192.0,71.0,71.0,71.0,71.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Total</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">
|
||||
<font color="white"></font>
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">[[ formatLang(sum_all(get_objects(data['form']['empty_acc']),data['form']['date1'],data['form']['date2'],'debit')) ]]</para>
|
||||
<para style="terp_tblheader_Details_Right">[[ formatLang(sum_all(get_objects(data['form']['empty_acc']),data['form']['date1'],data['form']['date2'],'debit')) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">[[ formatLang(sum_all(get_objects(data['form']['empty_acc']),data['form']['date1'],data['form']['date2'],'credit')) ]]</para>
|
||||
<para style="terp_tblheader_Details_Right">[[ formatLang(sum_all(get_objects(data['form']['empty_acc']),data['form']['date1'],data['form']['date2'],'credit')) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">[[ formatLang(sum_balance(get_objects(data['form']['empty_acc']),data['form']['date1'],data['form']['date2'])) ]] [[ company.currency_id.symbol]]</para>
|
||||
@@ -148,8 +171,8 @@
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn(get_objects(data['form']['empty_acc']),'o') ]]</para>
|
||||
<blockTable colWidths="55.0,221.0,56.0,50.0,62.0,38.0" style="Table3">
|
||||
<para style="terp_default_2">[[ repeatIn(get_objects(data['form']['empty_acc']),'o') ]]</para>
|
||||
<blockTable colWidths="57.0,192.0,71.0,71.0,71.0,71.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">[[ o['code'] ]]</para>
|
||||
@@ -158,10 +181,10 @@
|
||||
<para style="terp_default_Bold_9">[[ o['complete_name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9_Bold">[[ formatLang(move_sum(o['id'],data['form']['date1'],data['form']['date2'],'debit')) ]]</para>
|
||||
<para style="terp_default_Right_9_Bold">[[ formatLang(move_sum(o['id'],data['form']['date1'],data['form']['date2'],'debit')) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9_Bold">[[ formatLang(move_sum(o['id'],data['form']['date1'],data['form']['date2'],'credit')) ]]</para>
|
||||
<para style="terp_default_Right_9_Bold">[[ formatLang(move_sum(o['id'],data['form']['date1'],data['form']['date2'],'credit')) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9_Bold">[[ formatLang(move_sum_balance(o['id'],data['form']['date1'],data['form']['date2'])) ]] [[ company.currency_id.symbol]]</para>
|
||||
@@ -171,12 +194,9 @@
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn(lines_g(o['id'],data['form']['date1'],data['form']['date2']),'move_g') ]]</para>
|
||||
<blockTable colWidths="55.0,222.0,56.0,49.0,63.0,37.0" style="Table2">
|
||||
<para style="terp_default_2">[[ repeatIn(lines_g(o['id'],data['form']['date1'],data['form']['date2']),'move_g') ]]</para>
|
||||
<blockTable colWidths="57.0,192.0,71.0,71.0,71.0,71.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ move_g['code'] ]]</para>
|
||||
@@ -188,7 +208,7 @@
|
||||
<para style="terp_default_Right_9">[[ formatLang(move_g['debit'])]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(move_g['credit']) ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(move_g['credit']) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(move_g['balance'])]] [[ company.currency_id.symbol ]]</para>
|
||||
@@ -202,21 +222,13 @@
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</pto>
|
||||
</story>
|
||||
</document>
|
||||
@@ -280,7 +280,7 @@
|
||||
<para style="terp_default_9">[[ move_a.code ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ move_a.name ]] asgfas</para>
|
||||
<para style="terp_default_9">[[ move_a.name ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ move_a.account_id.code ]] - [[ move_a.account_id.name ]]</para>
|
||||
|
||||
@@ -91,14 +91,14 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
||||
|
||||
def _sum_debit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0", (tuple(ids), date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Cost Ledger" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
|
||||
<document filename="Cost Ledger.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Cost Ledger" 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"/>
|
||||
<frame id="first" x1="28.0" y1="30.0" width="539" height="785"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
@@ -120,53 +120,9 @@
|
||||
<images/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<blockTable colWidths="161.0,161.0,161.0" repeatRows="1" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_header_Centre">Cost Ledger</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_header_Right">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="161.0,161.0,161.0" style="Table_Date_Sub_detail">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Period from </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Period to</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Printing date</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="161.0,161.0,161.0" style="Table_Sub_Content">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ formatLang(data['form']['date1'],date = True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ formatLang(data['form']['date2'],date = True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="63.0,249.0,57.0,57.0,57.0" style="Table_Header_Title">
|
||||
<pto>
|
||||
<pto_header>
|
||||
<blockTable colWidths="53.0,276.0,70.0,71.0,68.0" style="Table_Header_Title">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Date/Code</para>
|
||||
@@ -185,10 +141,73 @@
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
</pto_header>
|
||||
<blockTable colWidths="179.0,179.0,180.0" repeatRows="1" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_header_Centre">Cost Ledger</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_header_Right">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="179.0,179.0,179.0" style="Table_Date_Sub_detail">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Period from </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Period to</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Printing date</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="179.0,179.0,179.0" style="Table_Sub_Content">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ formatLang(data['form']['date1'],date = True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ formatLang(data['form']['date2'],date = True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="62.0,250.0,57.0,56.0,57.0" style="Table_Grant_Total">
|
||||
<blockTable colWidths="53.0,276.0,70.0,71.0,68.0" style="Table_Header_Title">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Date/Code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">J.C. /Move name</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Balance</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="56.0,273.0,70.0,70.0,70.0" style="Table_Grant_Total">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Total:</para>
|
||||
@@ -199,22 +218,19 @@
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (sum_debit(objects,data['form']['date1'],data['form']['date2'])) ]]</para>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (sum_debit(objects,data['form']['date1'],data['form']['date2'])) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (sum_credit(objects,data['form']['date1'],data['form']['date2'])) ]]</para>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (sum_credit(objects,data['form']['date1'],data['form']['date2'])) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (sum_balance(objects,data['form']['date1'],data['form']['date2'])) ]] [[ company.currency_id.symbol ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
|
||||
<blockTable colWidths="62.0,249.0,57.0,57.0,57.0" style="Table_Account_Detail">
|
||||
<para style="terp_default_2">[[ repeatIn(objects,'o') ]]</para>
|
||||
<blockTable colWidths="56.0,273.0,70.0,70.0,70.0" style="Table_Account_Detail">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">[[ o.code ]]</para>
|
||||
@@ -223,22 +239,19 @@
|
||||
<para style="terp_default_Bold_9">[[ o.complete_name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (account_sum_debit(o.id,data['form']['date1'],data['form']['date2'])) ]]</para>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (account_sum_debit(o.id,data['form']['date1'],data['form']['date2'])) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (account_sum_credit(o.id,data['form']['date1'],data['form']['date2'])) ]]</para>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (account_sum_credit(o.id,data['form']['date1'],data['form']['date2'])) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang (account_sum_balance(o.id,data['form']['date1'],data['form']['date2']))]] [[ company.currency_id.symbol ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="Standard">[[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2']),'move_g') ]]</para>
|
||||
<blockTable colWidths="62.0,249.0,58.0,56.0,57.0" style="Table_Move_Line_Detail">
|
||||
<para style="terp_default_2">[[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2']),'move_g') ]]</para>
|
||||
<blockTable colWidths="56.0,273.0,70.0,70.0,70.0" style="Table_Move_Line_Detail">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">[[ move_g['code'] ]]</para>
|
||||
@@ -247,22 +260,19 @@
|
||||
<para style="terp_default_Bold_9">[[ move_g['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang( move_g['debit']) ]]</para>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang( move_g['debit']) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang( move_g['credit']) ]]</para>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang( move_g['credit']) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_Default_Bold_Right_9_U">[[ formatLang( move_g['balance']) ]] [[ company.currency_id.symbol ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_default_9">[[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2']),'move_a') ]]</para>
|
||||
<blockTable colWidths="60.0,46.0,204.0,59.0,55.0,58.0" style="Table_Move_Line_Content">
|
||||
<para style="terp_default_2">[[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2']),'move_a') ]]</para>
|
||||
<blockTable colWidths="56.0,56.0,217.0,70.0,70.0,70.0" style="Table_Move_Line_Content">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9_Italic">[[ formatLang(move_a['date'],date = True) ]]</para>
|
||||
@@ -274,13 +284,13 @@
|
||||
<para style="terp_default_9_Italic">[[ move_a['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9_italic_Rignt">[[ formatLang( move_a['debit'] )]]</para>
|
||||
<para style="terp_default_9_italic_Rignt">[[ formatLang( move_a['debit'] )]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9_italic_Rignt">[[ formatLang( move_a['credit']) ]]</para>
|
||||
<para style="terp_default_9_italic_Rignt">[[ formatLang( move_a['credit']) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9_italic_Rignt">[[ formatLang( move_a['balance']) ]]</para>
|
||||
<para style="terp_default_9_italic_Rignt">[[ formatLang( move_a['balance']) ]] [[ company.currency_id.symbol]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
@@ -288,13 +298,8 @@
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</pto>
|
||||
</story>
|
||||
</document>
|
||||
</document>
|
||||
@@ -87,6 +87,31 @@
|
||||
<images/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<pto>
|
||||
<pto_header>
|
||||
<blockTable colWidths="58.0,238.0,62.0,62.0,60.0,59.0" style="Table_Header_table">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Code</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details">Name</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Debit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Credit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Balance</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Quantity</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</pto_header>
|
||||
<blockTable colWidths="539.0" style="Table_Title">
|
||||
<tr>
|
||||
<td>
|
||||
@@ -199,5 +224,6 @@
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
</pto>
|
||||
</story>
|
||||
</document>
|
||||
@@ -102,7 +102,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
|
||||
|
||||
def _sum_quantity(self, accounts, date1, date2, journals):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
if not ids:
|
||||
return 0.0
|
||||
if not journals:
|
||||
self.cr.execute("SELECT sum(unit_amount) \
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user