[MERGE] merged the dev3 branch for the last time :-). Contains few bugfixes and refactoring of account

bzr revid: qdp-launchpad@openerp.com-20110303155944-kzs2fjuxewwmnr7q
This commit is contained in:
Quentin (OpenERP) 2011-03-03 16:59:44 +01:00
commit 5a2123a9a0
42 changed files with 463 additions and 823 deletions

View File

@ -333,7 +333,7 @@ class account_account(osv.osv):
return result return result
def _get_level(self, cr, uid, ids, field_name, arg, context=None): def _get_level(self, cr, uid, ids, field_name, arg, context=None):
res={} res = {}
accounts = self.browse(cr, uid, ids, context=context) accounts = self.browse(cr, uid, ids, context=context)
for account in accounts: for account in accounts:
level = 0 level = 0
@ -395,7 +395,7 @@ class account_account(osv.osv):
'reconcile': False, 'reconcile': False,
'active': True, 'active': True,
'currency_mode': 'current', 'currency_mode': 'current',
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c), 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
} }
def _check_recursion(self, cr, uid, ids, context=None): def _check_recursion(self, cr, uid, ids, context=None):
@ -474,7 +474,7 @@ class account_account(osv.osv):
for record in reads: for record in reads:
name = record['name'] name = record['name']
if record['code']: if record['code']:
name = record['code'] + ' '+name name = record['code'] + ' ' + name
res.append((record['id'], name)) res.append((record['id'], name))
return res return res
@ -606,7 +606,6 @@ class account_journal(osv.osv):
" Select 'Cash' to be used at the time of making payment."\ " Select 'Cash' to be used at the time of making payment."\
" Select 'General' for miscellaneous operations."\ " Select 'General' for miscellaneous operations."\
" Select 'Opening/Closing Situation' to be used at the time of new fiscal year creation or end of year entries generation."), " Select 'Opening/Closing Situation' to be used at the time of new fiscal year creation or end of year entries generation."),
'refund_journal': fields.boolean('Refund Journal', help='Fill this if the journal is to be used for refunds of invoices.'),
'type_control_ids': fields.many2many('account.account.type', 'account_journal_type_rel', 'journal_id','type_id', 'Type Controls', domain=[('code','<>','view'), ('code', '<>', 'closed')]), 'type_control_ids': fields.many2many('account.account.type', 'account_journal_type_rel', 'journal_id','type_id', 'Type Controls', domain=[('code','<>','view'), ('code', '<>', 'closed')]),
'account_control_ids': fields.many2many('account.account', 'account_account_type_rel', 'journal_id','account_id', 'Account', domain=[('type','<>','view'), ('type', '<>', 'closed')]), 'account_control_ids': fields.many2many('account.account', 'account_account_type_rel', 'journal_id','account_id', 'Account', domain=[('type','<>','view'), ('type', '<>', 'closed')]),
'view_id': fields.many2one('account.journal.view', 'Display Mode', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tells OpenERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."), 'view_id': fields.many2one('account.journal.view', 'Display Mode', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tells OpenERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."),
@ -742,9 +741,7 @@ class account_journal(osv.osv):
} }
res = {} res = {}
view_id = type_map.get(type, 'account_journal_view') view_id = type_map.get(type, 'account_journal_view')
user = user_pool.browse(cr, uid, uid) user = user_pool.browse(cr, uid, uid)
if type in ('cash', 'bank') and currency and user.company_id.currency_id.id != currency: if type in ('cash', 'bank') and currency and user.company_id.currency_id.id != currency:
view_id = 'account_journal_bank_view_multi' view_id = 'account_journal_bank_view_multi'
@ -755,7 +752,6 @@ class account_journal(osv.osv):
'centralisation':type == 'situation', 'centralisation':type == 'situation',
'view_id':data.res_id, 'view_id':data.res_id,
}) })
return { return {
'value':res 'value':res
} }
@ -805,19 +801,28 @@ class account_fiscalyear(osv.osv):
(_check_fiscal_year, 'Error! You cannot define overlapping fiscal years',['date_start', 'date_stop']) (_check_fiscal_year, 'Error! You cannot define overlapping fiscal years',['date_start', 'date_stop'])
] ]
def create_period3(self,cr, uid, ids, context=None): def create_period3(self, cr, uid, ids, context=None):
return self.create_period(cr, uid, ids, context, 3) return self.create_period(cr, uid, ids, context, 3)
def create_period(self,cr, uid, ids, context=None, interval=1): def create_period(self, cr, uid, ids, context=None, interval=1):
period_obj = self.pool.get('account.period')
for fy in self.browse(cr, uid, ids, context=context): for fy in self.browse(cr, uid, ids, context=context):
ds = datetime.strptime(fy.date_start, '%Y-%m-%d') ds = datetime.strptime(fy.date_start, '%Y-%m-%d')
while ds.strftime('%Y-%m-%d')<fy.date_stop: period_obj.create(cr, uid, {
'name': _('Opening Period'),
'code': ds.strftime('00/%Y'),
'date_start': ds,
'date_stop': ds,
'special': True,
'fiscalyear_id': fy.id,
})
while ds.strftime('%Y-%m-%d') < fy.date_stop:
de = ds + relativedelta(months=interval, days=-1) de = ds + relativedelta(months=interval, days=-1)
if de.strftime('%Y-%m-%d')>fy.date_stop: if de.strftime('%Y-%m-%d') > fy.date_stop:
de = datetime.strptime(fy.date_stop, '%Y-%m-%d') de = datetime.strptime(fy.date_stop, '%Y-%m-%d')
self.pool.get('account.period').create(cr, uid, { period_obj.create(cr, uid, {
'name': ds.strftime('%m/%Y'), 'name': ds.strftime('%m/%Y'),
'code': ds.strftime('%m/%Y'), 'code': ds.strftime('%m/%Y'),
'date_start': ds.strftime('%Y-%m-%d'), 'date_start': ds.strftime('%Y-%m-%d'),
@ -1115,9 +1120,8 @@ class account_move(osv.osv):
res_ids = set(id[0] for id in cr.fetchall()) res_ids = set(id[0] for id in cr.fetchall())
ids = ids and (ids & res_ids) or res_ids ids = ids and (ids & res_ids) or res_ids
if ids: if ids:
return [('id','in',tuple(ids))] return [('id', 'in', tuple(ids))]
else: return [('id', '=', '0')]
return [('id', '=', '0')]
_columns = { _columns = {
'name': fields.char('Number', size=64, required=True), 'name': fields.char('Number', size=64, required=True),
@ -1201,7 +1205,6 @@ class account_move(osv.osv):
'SET state=%s '\ 'SET state=%s '\
'WHERE id IN %s', 'WHERE id IN %s',
('posted', tuple(valid_moves),)) ('posted', tuple(valid_moves),))
return True return True
def button_validate(self, cursor, user, ids, context=None): def button_validate(self, cursor, user, ids, context=None):
@ -1516,7 +1519,6 @@ class account_move_reconcile(osv.osv):
result.append((r.id,r.name)) result.append((r.id,r.name))
return result return result
account_move_reconcile() account_move_reconcile()
#---------------------------------------------------------- #----------------------------------------------------------
@ -1828,7 +1830,6 @@ class account_tax(osv.osv):
obj_partener_address = self.pool.get('res.partner.address') obj_partener_address = self.pool.get('res.partner.address')
for tax in taxes: for tax in taxes:
# we compute the amount for the current tax object and append it to the result # we compute the amount for the current tax object and append it to the result
data = {'id':tax.id, data = {'id':tax.id,
'name':tax.description and tax.description + " - " + tax.name or tax.name, 'name':tax.description and tax.description + " - " + tax.name or tax.name,
'account_collected_id':tax.account_collected_id.id, 'account_collected_id':tax.account_collected_id.id,
@ -1910,7 +1911,7 @@ class account_tax(osv.osv):
totalex -= r.get('amount', 0.0) totalex -= r.get('amount', 0.0)
totlex_qty = 0.0 totlex_qty = 0.0
try: try:
totlex_qty=totalex/quantity totlex_qty = totalex/quantity
except: except:
pass pass
tex = self._compute(cr, uid, tex, totlex_qty, quantity, address_id=address_id, product=product, partner=partner) tex = self._compute(cr, uid, tex, totlex_qty, quantity, address_id=address_id, product=product, partner=partner)
@ -2043,6 +2044,7 @@ class account_tax(osv.osv):
r['amount'] = round(r['amount'] * quantity, prec) r['amount'] = round(r['amount'] * quantity, prec)
total += r['amount'] total += r['amount']
return res return res
account_tax() account_tax()
# --------------------------------------------------------- # ---------------------------------------------------------
@ -2171,13 +2173,11 @@ class account_subscription(osv.osv):
'name': fields.char('Name', size=64, required=True), 'name': fields.char('Name', size=64, required=True),
'ref': fields.char('Reference', size=16), 'ref': fields.char('Reference', size=16),
'model_id': fields.many2one('account.model', 'Model', required=True), 'model_id': fields.many2one('account.model', 'Model', required=True),
'date_start': fields.date('Start Date', required=True), 'date_start': fields.date('Start Date', required=True),
'period_total': fields.integer('Number of Periods', required=True), 'period_total': fields.integer('Number of Periods', required=True),
'period_nbr': fields.integer('Period', required=True), 'period_nbr': fields.integer('Period', required=True),
'period_type': fields.selection([('day','days'),('month','month'),('year','year')], 'Period Type', required=True), 'period_type': fields.selection([('day','days'),('month','month'),('year','year')], 'Period Type', required=True),
'state': fields.selection([('draft','Draft'),('running','Running'),('done','Done')], 'State', required=True, readonly=True), 'state': fields.selection([('draft','Draft'),('running','Running'),('done','Done')], 'State', required=True, readonly=True),
'lines_id': fields.one2many('account.subscription.line', 'subscription_id', 'Subscription Lines') 'lines_id': fields.one2many('account.subscription.line', 'subscription_id', 'Subscription Lines')
} }
_defaults = { _defaults = {
@ -2232,6 +2232,7 @@ class account_subscription(osv.osv):
ds = (datetime.strptime(ds, '%Y-%m-%d') + relativedelta(years=sub.period_nbr)).strftime('%Y-%m-%d') ds = (datetime.strptime(ds, '%Y-%m-%d') + relativedelta(years=sub.period_nbr)).strftime('%Y-%m-%d')
self.write(cr, uid, ids, {'state':'running'}) self.write(cr, uid, ids, {'state':'running'})
return True return True
account_subscription() account_subscription()
class account_subscription_line(osv.osv): class account_subscription_line(osv.osv):
@ -2260,6 +2261,7 @@ class account_subscription_line(osv.osv):
return all_moves return all_moves
_rec_name = 'date' _rec_name = 'date'
account_subscription_line() account_subscription_line()
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -2346,9 +2348,9 @@ class account_add_tmpl_wizard(osv.osv_memory):
_name = 'account.addtmpl.wizard' _name = 'account.addtmpl.wizard'
def _get_def_cparent(self, cr, uid, context=None): def _get_def_cparent(self, cr, uid, context=None):
acc_obj=self.pool.get('account.account') acc_obj = self.pool.get('account.account')
tmpl_obj=self.pool.get('account.account.template') tmpl_obj = self.pool.get('account.account.template')
tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']], ['parent_id']) tids = tmpl_obj.read(cr, uid, [context['tmpl_ids']], ['parent_id'])
if not tids or not tids[0]['parent_id']: if not tids or not tids[0]['parent_id']:
return False return False
ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]], ['code']) ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]], ['code'])
@ -2356,7 +2358,6 @@ class account_add_tmpl_wizard(osv.osv_memory):
if not ptids or not ptids[0]['code']: if not ptids or not ptids[0]['code']:
raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!')) raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!'))
res = acc_obj.search(cr, uid, [('code','=',ptids[0]['code'])]) res = acc_obj.search(cr, uid, [('code','=',ptids[0]['code'])])
return res and res[0] or False return res and res[0] or False
_columns = { _columns = {
@ -2449,6 +2450,8 @@ class account_chart_template(osv.osv):
'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'), 'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),
'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'), 'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),
'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss: Amount will be deducted.), Which is calculated from Profilt & Loss Report'), 'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss: Amount will be deducted.), Which is calculated from Profilt & Loss Report'),
'property_account_income_opening': fields.many2one('account.account.template','Opening Entries Income Account'),
'property_account_expense_opening': fields.many2one('account.account.template','Opening Entries Expense Account'),
} }
account_chart_template() account_chart_template()
@ -2526,7 +2529,6 @@ class account_tax_template(osv.osv):
} }
_order = 'sequence' _order = 'sequence'
account_tax_template() account_tax_template()
# Fiscal Position Templates # Fiscal Position Templates
@ -2602,10 +2604,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
res['value']["sale_tax"] = False res['value']["sale_tax"] = False
res['value']["purchase_tax"] = False res['value']["purchase_tax"] = False
if chart_template_id: if chart_template_id:
# default tax is given by the lowesst sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account
sale_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id" sale_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id"
, "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence") , "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence, id desc")
purchase_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id" purchase_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id"
, "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence") , "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence, id desc")
res['value']["sale_tax"] = sale_tax_ids and sale_tax_ids[0] or False res['value']["sale_tax"] = sale_tax_ids and sale_tax_ids[0] or False
res['value']["purchase_tax"] = purchase_tax_ids and purchase_tax_ids[0] or False res['value']["purchase_tax"] = purchase_tax_ids and purchase_tax_ids[0] or False
return res return res
@ -2635,10 +2639,9 @@ class wizard_multi_charts_accounts(osv.osv_memory):
return False return False
def _get_default_accounts(self, cr, uid, context=None): def _get_default_accounts(self, cr, uid, context=None):
accounts = [{'acc_name':'Current','account_type':'bank'}, return [{'acc_name': _('Current'),'account_type':'bank'},
{'acc_name':'Deposit','account_type':'bank'}, {'acc_name': _('Deposit'),'account_type':'bank'},
{'acc_name':'Cash','account_type':'cash'}] {'acc_name': _('Cash'),'account_type':'cash'}]
return accounts
_defaults = { _defaults = {
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, [uid], c)[0].company_id.id, 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, [uid], c)[0].company_id.id,
@ -2681,6 +2684,10 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_data = self.pool.get('ir.model.data') obj_data = self.pool.get('ir.model.data')
analytic_journal_obj = self.pool.get('account.analytic.journal') analytic_journal_obj = self.pool.get('account.analytic.journal')
obj_tax_code = self.pool.get('account.tax.code') obj_tax_code = self.pool.get('account.tax.code')
obj_tax_code_template = self.pool.get('account.tax.code.template')
obj_acc_journal_view = self.pool.get('account.journal.view')
ir_values = self.pool.get('ir.values')
obj_product = self.pool.get('product.product')
# Creating Account # Creating Account
obj_acc_root = obj_multi.chart_template_id.account_root_id obj_acc_root = obj_multi.chart_template_id.account_root_id
tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id
@ -2693,10 +2700,10 @@ class wizard_multi_charts_accounts(osv.osv_memory):
todo_dict = {} todo_dict = {}
#create all the tax code #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_tax_code_template.search(cr, uid, [('parent_id','child_of',[tax_code_root_id])], order='id')
children_tax_code_template.sort() children_tax_code_template.sort()
for tax_code_template in self.pool.get('account.tax.code.template').browse(cr, uid, children_tax_code_template, context=context): for tax_code_template in obj_tax_code_template.browse(cr, uid, children_tax_code_template, context=context):
vals={ vals = {
'name': (tax_code_root_id == tax_code_template.id) and obj_multi.company_id.name or tax_code_template.name, 'name': (tax_code_root_id == tax_code_template.id) and obj_multi.company_id.name or tax_code_template.name,
'code': tax_code_template.code, 'code': tax_code_template.code,
'info': tax_code_template.info, 'info': tax_code_template.info,
@ -2746,14 +2753,13 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'account_paid_id': tax.account_paid_id and tax.account_paid_id.id or False, 'account_paid_id': tax.account_paid_id and tax.account_paid_id.id or False,
} }
tax_template_ref[tax.id] = new_tax tax_template_ref[tax.id] = new_tax
#deactivate the parent_store functionnality on account_account for rapidity purpose #deactivate the parent_store functionnality on account_account for rapidity purpose
ctx = context and context.copy() or {} ctx = context and context.copy() or {}
ctx['defer_parent_store_computation'] = True 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)])
children_acc_template.sort() children_acc_template.sort()
for account_template in obj_acc_template.browse(cr, uid, children_acc_template,context=context): for account_template in obj_acc_template.browse(cr, uid, children_acc_template, context=context):
tax_ids = [] tax_ids = []
for tax in account_template.tax_ids: for tax in account_template.tax_ids:
tax_ids.append(tax_template_ref[tax.id]) tax_ids.append(tax_template_ref[tax.id])
@ -2779,8 +2785,10 @@ class wizard_multi_charts_accounts(osv.osv_memory):
} }
new_account = obj_acc.create(cr, uid, vals, context=ctx) new_account = obj_acc.create(cr, uid, vals, context=ctx)
acc_template_ref[account_template.id] = new_account acc_template_ref[account_template.id] = new_account
#reactivate the parent_store functionnality on account_account #reactivate the parent_store functionnality on account_account
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']: if value['account_collected_id'] or value['account_paid_id']:
@ -2789,41 +2797,23 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'account_paid_id': acc_template_ref.get(value['account_paid_id'], False), 'account_paid_id': acc_template_ref.get(value['account_paid_id'], False),
}) })
# Creating Journals Sales and Purchase # Creating Journals
vals_journal={}
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')]) data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
data = obj_data.browse(cr, uid, data_id[0], context=context) data = obj_data.browse(cr, uid, data_id[0], context=context)
view_id = data.res_id view_id = data.res_id
seq_id = obj_sequence.search(cr, uid, [('name','=','Account Journal')])[0]
if obj_multi.seq_journal:
seq_id_sale = obj_sequence.search(cr, uid, [('name','=','Sale Journal')])[0]
seq_id_purchase = obj_sequence.search(cr, uid, [('name','=','Purchase Journal')])[0]
seq_id_sale_refund = obj_sequence.search(cr, uid, [('name','=','Sales Refund Journal')])
if seq_id_sale_refund:
seq_id_sale_refund = seq_id_sale_refund[0]
seq_id_purchase_refund = obj_sequence.search(cr, uid, [('name','=','Purchase Refund Journal')])
if seq_id_purchase_refund:
seq_id_purchase_refund = seq_id_purchase_refund[0]
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 #Sales Journal
analitical_sale_ids = analytic_journal_obj.search(cr,uid,[('type','=','sale')]) analytical_sale_ids = analytic_journal_obj.search(cr,uid,[('type','=','sale')])
analitical_journal_sale = analitical_sale_ids and analitical_sale_ids[0] or False analytical_journal_sale = analytical_sale_ids and analytical_sale_ids[0] or False
vals_journal['name'] = _('Sales Journal') vals_journal = {
vals_journal['type'] = 'sale' 'name': _('Sales Journal'),
vals_journal['code'] = _('SAJ') 'type': 'sale',
vals_journal['sequence_id'] = seq_id_sale 'code': _('SAJ'),
vals_journal['company_id'] = company_id 'view_id': view_id,
vals_journal['analytic_journal_id'] = analitical_journal_sale 'company_id': company_id,
'analytic_journal_id': analytical_journal_sale,
}
if obj_multi.chart_template_id.property_account_receivable: if obj_multi.chart_template_id.property_account_receivable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id] vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id]
@ -2832,38 +2822,35 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_journal.create(cr,uid,vals_journal) obj_journal.create(cr,uid,vals_journal)
# Purchase Journal # Purchase Journal
analitical_purchase_ids = analytic_journal_obj.search(cr,uid,[('type','=','purchase')]) analytical_purchase_ids = analytic_journal_obj.search(cr,uid,[('type','=','purchase')])
analitical_journal_purchase = analitical_purchase_ids and analitical_purchase_ids[0] or False analytical_journal_purchase = analytical_purchase_ids and analytical_purchase_ids[0] or False
vals_journal['name'] = _('Purchase Journal') vals_journal = {
vals_journal['type'] = 'purchase' 'name': _('Purchase Journal'),
vals_journal['code'] = _('EXJ') 'type': 'purchase',
vals_journal['sequence_id'] = seq_id_purchase 'code': _('EXJ'),
vals_journal['view_id'] = view_id 'view_id': view_id,
vals_journal['company_id'] = company_id 'company_id': company_id,
vals_journal['analytic_journal_id'] = analitical_journal_purchase 'analytic_journal_id': analytical_journal_purchase,
}
if obj_multi.chart_template_id.property_account_payable: if obj_multi.chart_template_id.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id] vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id] vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]
obj_journal.create(cr,uid,vals_journal) obj_journal.create(cr,uid,vals_journal)
# Creating Journals Sales Refund and Purchase Refund # Creating Journals Sales Refund and Purchase Refund
vals_journal = {}
data_id = obj_data.search(cr, uid, [('model', '=', 'account.journal.view'), ('name', '=', 'account_sp_refund_journal_view')], context=context) data_id = obj_data.search(cr, uid, [('model', '=', 'account.journal.view'), ('name', '=', 'account_sp_refund_journal_view')], context=context)
data = obj_data.browse(cr, uid, data_id[0], context=context) data = obj_data.browse(cr, uid, data_id[0], context=context)
view_id = data.res_id view_id = data.res_id
#Sales Refund Journal #Sales Refund Journal
vals_journal = { vals_journal = {
'view_id': view_id,
'name': _('Sales Refund Journal'), 'name': _('Sales Refund Journal'),
'type': 'sale_refund', 'type': 'sale_refund',
'refund_journal': True,
'code': _('SCNJ'), 'code': _('SCNJ'),
'sequence_id': seq_id_sale_refund, 'view_id': view_id,
'analytic_journal_id': analitical_journal_sale, 'analytic_journal_id': analytical_journal_sale,
'company_id': company_id 'company_id': company_id
} }
@ -2871,23 +2858,15 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id] vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id]
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id] vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id]
# if obj_multi.property_account_receivable:
# vals_journal.update({
# 'default_credit_account_id': acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id],
# 'default_debit_account_id': acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id]
# })
obj_journal.create(cr, uid, vals_journal, context=context) obj_journal.create(cr, uid, vals_journal, context=context)
# Purchase Refund Journal # Purchase Refund Journal
vals_journal = { vals_journal = {
'view_id': view_id,
'name': _('Purchase Refund Journal'), 'name': _('Purchase Refund Journal'),
'type': 'purchase_refund', 'type': 'purchase_refund',
'refund_journal': True,
'code': _('ECNJ'), 'code': _('ECNJ'),
'sequence_id': seq_id_purchase_refund, 'view_id': view_id,
'analytic_journal_id': analitical_journal_purchase, 'analytic_journal_id': analytical_journal_purchase,
'company_id': company_id 'company_id': company_id
} }
@ -2895,14 +2874,41 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id] vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]
vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id] vals_journal['default_debit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]
# if obj_multi.property_account_payable:
# 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) obj_journal.create(cr, uid, vals_journal, context=context)
# Miscellaneous Journal
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_view')])
data = obj_data.browse(cr, uid, data_id[0], context=context)
view_id = data.res_id
analytical_miscellaneous_ids = analytic_journal_obj.search(cr, uid, [('type', '=', 'situation')], context=context)
analytical_journal_miscellaneous = analytical_miscellaneous_ids and analytical_miscellaneous_ids[0] or False
vals_journal = {
'name': _('Miscellaneous Journal'),
'type': 'general',
'code': _('MISC'),
'view_id': view_id,
'analytic_journal_id': analytical_journal_miscellaneous,
'company_id': company_id
}
obj_journal.create(cr, uid, vals_journal, context=context)
# Opening Entries Journal
if obj_multi.chart_template_id.property_account_income_opening and obj_multi.chart_template_id.property_account_expense_opening:
vals_journal = {
'name': _('Opening Entries Journal'),
'type': 'situation',
'code': _('OPEJ'),
'view_id': view_id,
'company_id': company_id,
'centralisation': True,
'default_credit_account_id': acc_template_ref[obj_multi.chart_template_id.property_account_income_opening.id],
'default_debit_account_id': acc_template_ref[obj_multi.chart_template_id.property_account_expense_opening.id]
}
obj_journal.create(cr, uid, vals_journal, context=context)
# Bank Journals # Bank Journals
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')]) data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')])
data = obj_data.browse(cr, uid, data_id[0], context=context) data = obj_data.browse(cr, uid, data_id[0], context=context)
@ -2935,24 +2941,17 @@ class wizard_multi_charts_accounts(osv.osv_memory):
} }
acc_cash_id = obj_acc.create(cr,uid,vals) acc_cash_id = obj_acc.create(cr,uid,vals)
if obj_multi.seq_journal:
vals_seq={
'name': _('Bank Journal ') + vals['name'],
'code': 'account.journal',
}
seq_id = obj_sequence.create(cr,uid,vals_seq)
#create the bank journal #create the bank journal
analitical_bank_ids = analytic_journal_obj.search(cr,uid,[('type','=','situation')]) analytical_bank_ids = analytic_journal_obj.search(cr,uid,[('type','=','situation')])
analitical_journal_bank = analitical_bank_ids and analitical_bank_ids[0] or False analytical_journal_bank = analytical_bank_ids and analytical_bank_ids[0] or False
vals_journal = {
vals_journal['name']= vals['name'] 'name': vals['name'],
vals_journal['code']= _('BNK') + str(current_num) 'code': _('BNK') + str(current_num),
vals_journal['sequence_id'] = seq_id 'type': line.account_type == 'cash' and 'cash' or 'bank',
vals_journal['type'] = line.account_type == 'cash' and 'cash' or 'bank' 'company_id': company_id,
vals_journal['company_id'] = company_id 'analytic_journal_id': False,
vals_journal['analytic_journal_id'] = analitical_journal_bank 'currency_id': False,
}
if line.currency_id: if line.currency_id:
vals_journal['view_id'] = view_id_cur vals_journal['view_id'] = view_id_cur
vals_journal['currency'] = line.currency_id.id vals_journal['currency'] = line.currency_id.id
@ -2985,7 +2984,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'name': record[0], 'name': record[0],
'company_id': company_id, 'company_id': company_id,
'fields_id': field[0], '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: if r:
@ -2998,7 +2997,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
fp_ids = obj_fiscal_position_template.search(cr, uid, [('chart_template_id', '=', obj_multi.chart_template_id.id)]) fp_ids = obj_fiscal_position_template.search(cr, uid, [('chart_template_id', '=', obj_multi.chart_template_id.id)])
if fp_ids: if fp_ids:
obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_tax_fp = self.pool.get('account.fiscal.position.tax')
obj_ac_fp = self.pool.get('account.fiscal.position.account') obj_ac_fp = self.pool.get('account.fiscal.position.account')
@ -3026,7 +3024,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
} }
obj_ac_fp.create(cr, uid, vals_acc) obj_ac_fp.create(cr, uid, vals_acc)
ir_values = self.pool.get('ir.values')
if obj_multi.sale_tax: if obj_multi.sale_tax:
ir_values.set(cr, uid, key='default', key2=False, name="taxes_id", company=obj_multi.company_id.id, ir_values.set(cr, uid, key='default', key2=False, name="taxes_id", company=obj_multi.company_id.id,
models =[('product.product',False)], value=[tax_template_to_tax[obj_multi.sale_tax.id]]) models =[('product.product',False)], value=[tax_template_to_tax[obj_multi.sale_tax.id]])
@ -3037,16 +3034,13 @@ class wizard_multi_charts_accounts(osv.osv_memory):
wizard_multi_charts_accounts() wizard_multi_charts_accounts()
class account_bank_accounts_wizard(osv.osv_memory): class account_bank_accounts_wizard(osv.osv_memory):
_name = 'account.bank.accounts.wizard' _name='account.bank.accounts.wizard'
_columns = { _columns = {
'acc_name': fields.char('Account Name.', size=64, required=True), '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('wizard.multi.charts.accounts', 'Bank Account', required=True),
'currency_id': fields.many2one('res.currency', 'Currency'), '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')], '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() account_bank_accounts_wizard()

View File

@ -37,21 +37,6 @@
<field name="sale_tax" on_change="on_change_tax(sale_tax)" attrs="{'required':[('charts','=','configurable')]}"/> <field name="sale_tax" on_change="on_change_tax(sale_tax)" attrs="{'required':[('charts','=','configurable')]}"/>
<field name="purchase_tax" groups="base.group_extended"/> <field name="purchase_tax" groups="base.group_extended"/>
</group> </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" groups="base.group_extended"/>
</form>
<tree editable="bottom" string="Your bank and cash accounts">
<field name="acc_name"/>
<field name="account_type"/>
<field name="currency_id" widget="selection" groups="base.group_extended"/>
</tree>
</field>
</group>
</group> </group>
</group> </group>
</data> </data>

View File

@ -1297,7 +1297,7 @@ class account_move_line(osv.osv):
if vals.get('account_tax_id', False): if vals.get('account_tax_id', False):
tax_id = tax_obj.browse(cr, uid, vals['account_tax_id']) tax_id = tax_obj.browse(cr, uid, vals['account_tax_id'])
total = vals['debit'] - vals['credit'] total = vals['debit'] - vals['credit']
if journal.refund_journal: if journal.type in ('purchase_refund', 'sale_refund'):
base_code = 'ref_base_code_id' base_code = 'ref_base_code_id'
tax_code = 'ref_tax_code_id' tax_code = 'ref_tax_code_id'
account_id = 'account_paid_id' account_id = 'account_paid_id'

View File

@ -47,6 +47,7 @@
<tree colors="blue:state in ('draft');gray:state in ('done') " string="Fiscalyear"> <tree colors="blue:state in ('draft');gray:state in ('done') " string="Fiscalyear">
<field name="code"/> <field name="code"/>
<field name="name"/> <field name="name"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="state"/> <field name="state"/>
</tree> </tree>
</field> </field>
@ -116,6 +117,7 @@
<field name="date_start"/> <field name="date_start"/>
<field name="date_stop"/> <field name="date_stop"/>
<field name="special"/> <field name="special"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="state"/> <field name="state"/>
<button name="action_draft" states="done" string="Set to Draft" type="object" icon="terp-document-new" groups="account.group_account_manager"/> <button name="action_draft" states="done" string="Set to Draft" type="object" icon="terp-document-new" groups="account.group_account_manager"/>
<button name="%(action_account_period_close)d" states="draft" string="Close Period" type="action" icon="terp-camera_test"/> <button name="%(action_account_period_close)d" states="draft" string="Close Period" type="action" icon="terp-camera_test"/>
@ -570,7 +572,7 @@
<field name="ref"/> <field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/> <field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/> <field domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]" name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/> <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/> <field name="amount"/>
</tree> </tree>
@ -580,7 +582,7 @@
<field name="ref"/> <field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/> <field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/> <field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view'), ('company_id', '=', parent.company_id)]" name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/> <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/> <field name="amount"/>
<field name="sequence" readonly="0"/> <field name="sequence" readonly="0"/>
@ -1011,7 +1013,7 @@
<field name="invoice"/> <field name="invoice"/>
<field name="name"/> <field name="name"/>
<field name="partner_id" on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"/> <field name="partner_id" on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"/>
<field name="account_id" domain="[('journal_id','=',journal_id)]"/> <field name="account_id" domain="[('journal_id','=',journal_id), ('company_id', '=', company_id)]"/>
<field name="journal_id"/> <field name="journal_id"/>
<field name="debit" sum="Total debit"/> <field name="debit" sum="Total debit"/>
<field name="credit" sum="Total credit"/> <field name="credit" sum="Total credit"/>
@ -1046,7 +1048,7 @@
<page string="Information"> <page string="Information">
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator colspan="2" string="Amount"/> <separator colspan="2" string="Amount"/>
<field name="account_id" select="1" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/> <field name="account_id" select="1" domain="[('company_id', '=', company_id), ('type','&lt;&gt;','view'), ('type','&lt;&gt;','consolidation')]"/>
<field name="debit"/> <field name="debit"/>
<field name="credit"/> <field name="credit"/>
<field name="quantity"/> <field name="quantity"/>
@ -1120,7 +1122,7 @@
<field name="date"/> <field name="date"/>
<field name="journal_id" readonly="False" select="1"/> <field name="journal_id" readonly="False" select="1"/>
<field name="period_id" readonly="False"/> <field name="period_id" readonly="False"/>
<field name="account_id" select="1" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/> <field name="account_id" select="1" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation'),('company_id', '=', company_id)]"/>
<field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/> <field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/>
<newline/> <newline/>
<field name="debit"/> <field name="debit"/>
@ -1341,7 +1343,7 @@
<page string="Information"> <page string="Information">
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator colspan="2" string="Amount"/> <separator colspan="2" string="Amount"/>
<field name="account_id" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/> <field name="account_id" domain="[('company_id', '=', parent.company_id), ('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="debit"/> <field name="debit"/>
<field name="credit"/> <field name="credit"/>
<field name="quantity"/> <field name="quantity"/>
@ -1403,7 +1405,7 @@
<field name="invoice"/> <field name="invoice"/>
<field name="name"/> <field name="name"/>
<field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,parent.date,parent.journal_id)"/> <field name="partner_id" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,parent.date,parent.journal_id)"/>
<field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/> <field name="account_id" domain="[('journal_id','=',parent.journal_id),('company_id', '=', parent.company_id)]"/>
<field name="date_maturity"/> <field name="date_maturity"/>
<field name="debit" sum="Total Debit"/> <field name="debit" sum="Total Debit"/>
<field name="credit" sum="Total Credit"/> <field name="credit" sum="Total Credit"/>
@ -2150,6 +2152,8 @@
<field name="property_account_income_categ" domain="[('id', 'child_of', [account_root_id])]" /> <field name="property_account_income_categ" domain="[('id', 'child_of', [account_root_id])]" />
<field name="property_account_expense" domain="[('id', 'child_of', [account_root_id])]"/> <field name="property_account_expense" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/> <field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_reserve_and_surplus_account" /> <field name="property_reserve_and_surplus_account" />
</group> </group>
</form> </form>
@ -2572,7 +2576,7 @@ action = self.pool.get('res.config').next(cr, uid, [], context)
<field name="ref"/> <field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/> <field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/> <field domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]" name="account_id"/>
<field name="analytic_account_id" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]" groups="analytic.group_analytic_accounting" /> <field name="analytic_account_id" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]" groups="analytic.group_analytic_accounting" />
<field name="amount"/> <field name="amount"/>
</tree> </tree>
@ -2582,7 +2586,7 @@ action = self.pool.get('res.config').next(cr, uid, [], context)
<field name="ref"/> <field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/> <field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/> <field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view'), ('company_id', '=', parent.company_id)]" name="account_id"/>
<field name="analytic_account_id" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]" groups="analytic.group_analytic_accounting" /> <field name="analytic_account_id" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]" groups="analytic.group_analytic_accounting" />
<field name="amount"/> <field name="amount"/>
<field name="sequence"/> <field name="sequence"/>

View File

@ -191,6 +191,14 @@
<field name="user_type" ref="conf_account_type_asset"/> <field name="user_type" ref="conf_account_type_asset"/>
</record> </record>
<record id="conf_o_income" model="account.account.template">
<field name="code">1106</field>
<field name="name">Opening Income Account</field>
<field ref="conf_cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_income"/>
</record>
<record id="conf_cli" model="account.account.template"> <record id="conf_cli" model="account.account.template">
<field name="code">111</field> <field name="code">111</field>
<field name="name">Current Liabilities</field> <field name="name">Current Liabilities</field>
@ -225,6 +233,13 @@
<field name="user_type" ref="conf_account_type_liability"/> <field name="user_type" ref="conf_account_type_liability"/>
</record> </record>
<record id="conf_o_expense" model="account.account.template">
<field name="code">1114</field>
<field name="name">Opening Expense Account</field>
<field ref="conf_cli" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="conf_account_type_expense"/>
</record>
<!-- Profit and Loss --> <!-- Profit and Loss -->
@ -431,6 +446,8 @@
<field name="property_account_payable" ref="conf_a_pay"/> <field name="property_account_payable" ref="conf_a_pay"/>
<field name="property_account_expense_categ" ref="conf_a_expense"/> <field name="property_account_expense_categ" ref="conf_a_expense"/>
<field name="property_account_income_categ" ref="conf_a_sale"/> <field name="property_account_income_categ" ref="conf_a_sale"/>
<field name="property_account_income_opening" ref="conf_o_income"/>
<field name="property_account_expense_opening" ref="conf_o_expense"/>
<field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/> <field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/>
</record> </record>
@ -596,6 +613,13 @@
<field name="tax_ids" eval="[(6,0,[ref('otaxs')])]"/> <field name="tax_ids" eval="[(6,0,[ref('otaxs')])]"/>
</record> </record>
<record id="action_wizard_multi_chart_todo" model="ir.actions.todo">
<field name="name">Generate Chart of Accounts from a Chart Template</field>
<field name="action_id" ref="account.action_wizard_multi_chart"/>
<field name="state">open</field>
<field name="restart">onskip</field>
</record>
</data> </data>
</openerp> </openerp>

View File

@ -483,6 +483,19 @@
<field eval="3" name="padding"/> <field eval="3" name="padding"/>
<field name="prefix">CSH/%(year)s/</field> <field name="prefix">CSH/%(year)s/</field>
</record> </record>
<record id="sequence_opening_journal" model="ir.sequence">
<field name="name">Opening Entries Journal</field>
<field name="code">account.journal</field>
<field eval="3" name="padding"/>
<field name="prefix">OPEJ/%(year)s/</field>
</record>
<record id="sequence_miscellaneous_journal" model="ir.sequence">
<field name="name">Miscellaneous Journal</field>
<field name="code">account.journal</field>
<field eval="3" name="padding"/>
<field name="prefix">MISJ/%(year)s/</field>
</record>
<!-- <!--
Account Statement Sequences Account Statement Sequences
--> -->

View File

@ -163,6 +163,14 @@
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="account_type_asset"/>
</record> </record>
<record id="o_income" model="account.account">
<field name="code">X11006</field>
<field name="name">Opening Income - (test)</field>
<field ref="cas" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_income"/>
</record>
<record model="account.account" id="liabilities_view"> <record model="account.account" id="liabilities_view">
<field name="name">Liabilities - (test)</field> <field name="name">Liabilities - (test)</field>
<field name="code">X11</field> <field name="code">X11</field>
@ -205,6 +213,14 @@
<field name="user_type" ref="account_type_liability"/> <field name="user_type" ref="account_type_liability"/>
</record> </record>
<record id="o_expense" model="account.account">
<field name="code">X1114</field>
<field name="name">Opening Expense - (test)</field>
<field ref="cli" name="parent_id"/>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense"/>
</record>
<!-- Profit and Loss --> <!-- Profit and Loss -->
<record id="gpf" model="account.account"> <record id="gpf" model="account.account">
@ -355,7 +371,6 @@
<field name="name">Sales Credit Note Journal - (test)</field> <field name="name">Sales Credit Note Journal - (test)</field>
<field name="code">TSCNJ</field> <field name="code">TSCNJ</field>
<field name="type">sale_refund</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="view_id" ref="account_sp_refund_journal_view"/>
<field name="sequence_id" ref="sequence_refund_sales_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_credit_account_id" ref="a_sale"/>
@ -379,7 +394,6 @@
<field name="name">Expenses Credit Notes Journal - (test)</field> <field name="name">Expenses Credit Notes Journal - (test)</field>
<field name="code">TECNJ</field> <field name="code">TECNJ</field>
<field name="type">purchase_refund</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="view_id" ref="account_sp_refund_journal_view"/>
<field name="sequence_id" ref="sequence_refund_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_debit_account_id" ref="a_expense"/>
@ -421,7 +435,26 @@
<field name="analytic_journal_id" ref="sit"/> <field name="analytic_journal_id" ref="sit"/>
<field name="user_id" ref="base.user_root"/> <field name="user_id" ref="base.user_root"/>
</record> </record>
<record id="miscellaneous_journal" model="account.journal">
<field name="name">Miscellaneous Journal - (test)</field>
<field name="code">TMIS</field>
<field name="type">general</field>
<field name="view_id" ref="account_journal_view"/>
<field name="sequence_id" ref="sequence_miscellaneous_journal"/>
<field name="analytic_journal_id" ref="sit"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="opening_journal" model="account.journal">
<field name="name">Opening Entries Journal - (test)</field>
<field name="code">TOEJ</field>
<field name="type">situation</field>
<field name="view_id" ref="account_journal_view"/>
<field name="sequence_id" ref="sequence_opening_journal"/>
<field model="account.account" name="default_debit_account_id" ref="o_income"/>
<field model="account.account" name="default_credit_account_id" ref="o_expense"/>
<field eval="True" name="centralisation"/>
<field name="user_id" ref="base.user_root"/>
</record>
<!-- <!--
Product income and expense accounts, default parameters Product income and expense accounts, default parameters
--> -->

View File

@ -34,12 +34,6 @@ class account_installer(osv.osv_memory):
_name = 'account.installer' _name = 'account.installer'
_inherit = 'res.config.installer' _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'}]
return accounts
def _get_charts(self, cr, uid, context=None): def _get_charts(self, cr, uid, context=None):
modules = self.pool.get('ir.module.module') modules = self.pool.get('ir.module.module')
ids = modules.search(cr, uid, [('category_id', '=', 'Account Charts')], context=context) ids = modules.search(cr, uid, [('category_id', '=', 'Account Charts')], context=context)
@ -60,7 +54,6 @@ class account_installer(osv.osv_memory):
'date_start': fields.date('Start Date', required=True), 'date_start': fields.date('Start Date', required=True),
'date_stop': fields.date('End Date', required=True), 'date_stop': fields.date('End Date', required=True),
'period': fields.selection([('month', 'Monthly'), ('3months','3 Monthly')], 'Periods', 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', 'Your Bank and Cash Accounts'),
'sale_tax': fields.float('Sale Tax(%)'), 'sale_tax': fields.float('Sale Tax(%)'),
'purchase_tax': fields.float('Purchase Tax(%)'), 'purchase_tax': fields.float('Purchase Tax(%)'),
'company_id': fields.many2one('res.company', 'Company', required=True), 'company_id': fields.many2one('res.company', 'Company', required=True),
@ -92,7 +85,6 @@ class account_installer(osv.osv_memory):
'sale_tax': 0.0, 'sale_tax': 0.0,
'purchase_tax': 0.0, 'purchase_tax': 0.0,
'company_id': _default_company, 'company_id': _default_company,
'bank_accounts_id': _get_default_accounts,
'charts': _get_default_charts 'charts': _get_default_charts
} }
@ -125,458 +117,18 @@ class account_installer(osv.osv_memory):
return {'value': {'date_stop': end_date.strftime('%Y-%m-%d')}} return {'value': {'date_stop': end_date.strftime('%Y-%m-%d')}}
return {} 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_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')
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_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=context)[0].company_id
seq_journal = True
# Creating Account
obj_acc_root = obj_multi.account_root_id
tax_code_root_id = obj_multi.tax_code_root_id.id
#new code
acc_template_ref = {}
tax_template_ref = {}
tax_code_template_ref = {}
todo_dict = {}
#create all the tax code
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 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,
'parent_id': tax_code_template.parent_id and ((tax_code_template.parent_id.id in tax_code_template_ref) and tax_code_template_ref[tax_code_template.parent_id.id]) or False,
'company_id': company_id.id,
'sign': tax_code_template.sign,
}
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
#create all the tax
for tax in obj_multi.tax_template_ids:
#create it
vals_tax = {
'name': tax.name,
'sequence': tax.sequence,
'amount': tax.amount,
'type': tax.type,
'applicable_type': tax.applicable_type,
'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,
'python_compute_inv': tax.python_compute_inv,
'python_applicable': tax.python_applicable,
'base_code_id': tax.base_code_id and ((tax.base_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.base_code_id.id]) or False,
'tax_code_id': tax.tax_code_id and ((tax.tax_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.tax_code_id.id]) or False,
'base_sign': tax.base_sign,
'tax_sign': tax.tax_sign,
'ref_base_code_id': tax.ref_base_code_id and ((tax.ref_base_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.ref_base_code_id.id]) or False,
'ref_tax_code_id': tax.ref_tax_code_id and ((tax.ref_tax_code_id.id in tax_code_template_ref) and tax_code_template_ref[tax.ref_tax_code_id.id]) or False,
'ref_base_sign': tax.ref_base_sign,
'ref_tax_sign': tax.ref_tax_sign,
'include_base_amount': tax.include_base_amount,
'description': tax.description,
'company_id': company_id.id,
'type_tax_use': tax.type_tax_use,
'price_include': tax.price_include
}
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,
'account_paid_id': tax.account_paid_id and tax.account_paid_id.id or False,
}
tax_template_ref[tax.id] = new_tax
#deactivate the parent_store functionnality on account_account for rapidity purpose
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)], context=context)
children_acc_template.sort()
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])
#create the account_account
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 = {
'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,
'code': code_acc,
'type': account_template.type,
'user_type': account_template.user_type and account_template.user_type.id or False,
'reconcile': account_template.reconcile,
'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)],
'company_id': company_id.id,
}
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 = {
'name': 'Bank Accounts',
'code': '110500',
'type': 'view',
'user_type': account_template.parent_id.user_type and account_template.user_type.id or False,
'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)],
'company_id': company_id.id,
}
bank_account = obj_acc.create(cr, uid, b_vals, context=ctx)
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_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_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_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]
code_cnt = 1
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')], context=context)
analitical_journal_bank = analitical_bank_ids and analitical_bank_ids[0] or False
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.update({
'view_id': view_id_cur,
'currency': vals.get('currency_id', False)
})
else:
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_padding = 5
if val.account_type == 'cash':
type = cash_type_id
elif val.account_type == 'bank':
type = bank_type_id
elif val.account_type == 'check':
type = check_type_id
else:
type = check_type_id
seq_padding = None
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, context=ctx)
vals_seq_child = {
'name': _(vals_bnk['name'] + ' ' + 'Journal'),
'code': 'account.journal',
'prefix': _((vals_bnk['name'][:3].upper()) + '/%(year)s/'),
'padding': seq_padding
}
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'),
'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.update({
'view_id': view_id_cur,
'currency': vals_bnk.get('currency_id', False),
})
else:
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
obj_acc._parent_store_compute(cr)
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']],
'account_paid_id': acc_template_ref[value['account_paid_id']],
})
# Creating Journals Sales and Purchase
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')], context=context)[0]
if seq_journal:
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': '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')], context=context)
analitical_journal_sale = analitical_sale_ids and analitical_sale_ids[0] or False
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.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')], context=context)
analitical_journal_purchase = analitical_purchase_ids and analitical_purchase_ids[0] or False
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.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')], context=context)
data = mod_obj.browse(cr, uid, data_id[0], context=context)
view_id = data.res_id
#Sales Refund Journal
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.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 Refund Journal
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.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 = 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
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'),
]
for record in todo_list:
r = []
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])], 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,
}
if r:
#the property exist: modify it
property_obj.write(cr, uid, r, vals, context=context)
else:
#create the property
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, context=context):
vals_fp = {
'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, 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, context=context)
def execute(self, cr, uid, ids, context=None): def execute(self, cr, uid, ids, context=None):
if context is None: if context is None:
context = {} context = {}
super(account_installer, self).execute(cr, uid, ids, context=context) super(account_installer, self).execute(cr, uid, ids, context=context)
fy_obj = self.pool.get('account.fiscalyear') fy_obj = self.pool.get('account.fiscalyear')
mod_obj = self.pool.get('ir.model.data') mod_obj = self.pool.get('ir.model.data')
obj_acc = self.pool.get('account.account') obj_acc_temp = self.pool.get('account.account.template')
obj_tax_code = self.pool.get('account.tax.code') obj_tax_code_temp = self.pool.get('account.tax.code.template')
obj_temp_tax_code = self.pool.get('account.tax.code.template') obj_tax_temp = self.pool.get('account.tax.template')
obj_tax = self.pool.get('account.tax')
obj_product = self.pool.get('product.product') obj_product = self.pool.get('product.product')
ir_values = self.pool.get('ir.values') ir_values = self.pool.get('ir.values')
obj_acc_chart_temp = self.pool.get('account.chart.template')
record = self.browse(cr, uid, ids, context=context)[0] record = self.browse(cr, uid, ids, context=context)[0]
company_id = record.company_id company_id = record.company_id
for res in self.read(cr, uid, ids, context=context): for res in self.read(cr, uid, ids, context=context):
@ -584,128 +136,81 @@ class account_installer(osv.osv_memory):
fp = tools.file_open(opj('account', 'configurable_account_chart.xml')) fp = tools.file_open(opj('account', 'configurable_account_chart.xml'))
tools.convert_xml_import(cr, 'account', fp, {}, 'init', True, None) tools.convert_xml_import(cr, 'account', fp, {}, 'init', True, None)
fp.close() fp.close()
self.generate_configurable_chart(cr, uid, ids, context=context)
s_tax = (res.get('sale_tax', 0.0))/100 s_tax = (res.get('sale_tax', 0.0))/100
p_tax = (res.get('purchase_tax', 0.0))/100 p_tax = (res.get('purchase_tax', 0.0))/100
tax_val = {}
default_tax = []
pur_temp_tax = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_base_purchases') 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_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_temp_tax_paid = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_output')
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)], 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_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_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)], 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_object_reference(cr, uid, 'account', 'tax_code_base_sales') 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_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)], 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_object_reference(cr, uid, 'account', 'tax_code_output') sale_temp_tax_paid = mod_obj.get_object_reference(cr, uid, 'account', 'tax_code_input')
sale_temp_tax_paid_id = sale_temp_tax_paid and sale_temp_tax_paid[1] or False 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)], 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: chart_temp_ids = obj_acc_chart_temp.search(cr, uid, [('name','=','Configurable Account Chart Template')], context=context)
tax_account_ids = obj_acc.search(cr, uid, [('name', '=', 'Tax Received')], context=context) chart_temp_id = chart_temp_ids and chart_temp_ids[0] or False
if s_tax * 100 > 0.0:
tax_account_ids = obj_acc_temp.search(cr, uid, [('name', '=', 'Tax Received')], context=context)
sales_tax_account_id = tax_account_ids and tax_account_ids[0] or False sales_tax_account_id = tax_account_ids and tax_account_ids[0] or False
vals_tax_code = { vals_tax_code_temp = {
'name': 'TAX%s%%'%(s_tax*100), 'name': _('TAX %s%%') % (s_tax*100),
'code': 'TAX%s%%'%(s_tax*100), 'code': _('TAX %s%%') % (s_tax*100),
'company_id': company_id.id, 'parent_id': sale_temp_tax_id
'sign': 1,
'parent_id': sale_taxcode_parent_id
} }
new_tax_code = obj_tax_code.create(cr, uid, vals_tax_code, context=context) new_tax_code_temp = obj_tax_code_temp.create(cr, uid, vals_tax_code_temp, context=context)
vals_paid_tax_code_temp = {
vals_paid_tax_code = { 'name': _('TAX Received %s%%') % (s_tax*100),
'name': 'TAX Received %s%%'%(s_tax*100), 'code': _('TAX Received %s%%') % (s_tax*100),
'code': 'TAX Received %s%%'%(s_tax*100), 'parent_id': sale_temp_tax_paid_id
'company_id': company_id.id, }
'sign': 1, new_paid_tax_code_temp = obj_tax_code_temp.create(cr, uid, vals_paid_tax_code_temp, context=context)
'parent_id': sale_taxcode_paid_parent_id sales_tax_temp = obj_tax_temp.create(cr, uid, {
} 'name': _('TAX %s%%') % (s_tax*100),
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),
'amount': s_tax, 'amount': s_tax,
'base_code_id': new_tax_code, 'base_code_id': new_tax_code_temp,
'tax_code_id': new_paid_tax_code, 'tax_code_id': new_paid_tax_code_temp,
'ref_base_code_id': new_tax_code_temp,
'ref_tax_code_id': new_paid_tax_code_temp,
'type_tax_use': 'sale', 'type_tax_use': 'sale',
'type': 'percent',
'sequence': 0,
'account_collected_id': sales_tax_account_id, 'account_collected_id': sales_tax_account_id,
'account_paid_id': sales_tax_account_id 'account_paid_id': sales_tax_account_id,
}, context=context) 'chart_template_id': chart_temp_id,
default_account_ids = obj_acc.search(cr, uid, [('name', '=', 'Product Sales')], context=context) }, context=context)
if default_account_ids: if p_tax * 100 > 0.0:
obj_acc.write(cr, uid, default_account_ids, {'tax_ids': [(6, 0, [sales_tax])]}, context=context) tax_account_ids = obj_acc_temp.search(cr, uid, [('name', '=', 'Tax Paid')], 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)
purchase_tax_account_id = tax_account_ids and tax_account_ids[0] or False purchase_tax_account_id = tax_account_ids and tax_account_ids[0] or False
vals_tax_code = { vals_tax_code_temp = {
'name': 'TAX%s%%'%(p_tax*100), 'name': _('TAX %s%%') % (p_tax*100),
'code': 'TAX%s%%'%(p_tax*100), 'code': _('TAX %s%%') % (p_tax*100),
'company_id': company_id.id, 'parent_id': pur_temp_tax_id
'sign': 1,
'parent_id': pur_taxcode_parent_id
} }
new_tax_code = obj_tax_code.create(cr, uid, vals_tax_code, context=context) new_tax_code_temp = obj_tax_code_temp.create(cr, uid, vals_tax_code_temp, context=context)
vals_paid_tax_code = { vals_paid_tax_code_temp = {
'name': 'TAX Paid %s%%'%(p_tax*100), 'name': _('TAX Paid %s%%') % (p_tax*100),
'code': 'TAX Paid %s%%'%(p_tax*100), 'code': _('TAX Paid %s%%') % (p_tax*100),
'company_id': company_id.id, 'parent_id': pur_temp_tax_paid_id
'sign': 1,
'parent_id': pur_taxcode_paid_parent_id
} }
new_paid_tax_code = obj_tax_code.create(cr, uid, vals_paid_tax_code, context=context) new_paid_tax_code_temp = obj_tax_code_temp.create(cr, uid, vals_paid_tax_code_temp, context=context)
purchase_tax_temp = obj_tax_temp.create(cr, uid, {
purchase_tax = obj_tax.create(cr, uid, 'name': _('TAX %s%%') % (p_tax*100),
{'name': 'TAX%s%%'%(p_tax*100), 'description': _('TAX %s%%') % (p_tax*100),
'description': 'TAX%s%%'%(p_tax*100),
'amount': p_tax, 'amount': p_tax,
'base_code_id': new_tax_code, 'base_code_id': new_tax_code_temp,
'tax_code_id': new_paid_tax_code, 'tax_code_id': new_paid_tax_code_temp,
'type_tax_use': 'purchase', 'ref_base_code_id': new_tax_code_temp,
'account_collected_id': purchase_tax_account_id, 'ref_tax_code_id': new_paid_tax_code_temp,
'account_paid_id': purchase_tax_account_id 'type_tax_use': 'purchase',
}, context=context) 'type': 'percent',
default_account_ids = obj_acc.search(cr, uid, [('name', '=', 'Expenses')], context=context) 'sequence': 0,
if default_account_ids: 'account_collected_id': purchase_tax_account_id,
obj_acc.write(cr, uid, default_account_ids, {'tax_ids': [(6, 0, [purchase_tax])]}, context=context) 'account_paid_id': purchase_tax_account_id,
tax_val.update({'supplier_taxes_id': [(6 ,0, [purchase_tax])]}) 'chart_template_id': chart_temp_id,
default_tax.append(('supplier_taxes_id', purchase_tax)) }, context=context)
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])
if 'date_start' in res and 'date_stop' in res: 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'])], context=context) f_ids = fy_obj.search(cr, uid, [('date_start', '<=', res['date_start']), ('date_stop', '>=', res['date_stop']), ('company_id', '=', res['company_id'])], context=context)
@ -727,7 +232,6 @@ class account_installer(osv.osv_memory):
elif res['period'] == '3months': elif res['period'] == '3months':
fy_obj.create_period3(cr, uid, [fiscal_id]) fy_obj.create_period3(cr, uid, [fiscal_id])
def modules_to_install(self, cr, uid, ids, context=None): def modules_to_install(self, cr, uid, ids, context=None):
modules = super(account_installer, self).modules_to_install( modules = super(account_installer, self).modules_to_install(
cr, uid, ids, context=context) cr, uid, ids, context=context)
@ -740,18 +244,6 @@ class account_installer(osv.osv_memory):
account_installer() account_installer()
class account_bank_accounts_wizard(osv.osv_memory):
_name='account.bank.accounts.wizard'
_columns = {
'acc_name': fields.char('Account Name.', size=64, 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_bank_accounts_wizard()
class account_installer_modules(osv.osv_memory): class account_installer_modules(osv.osv_memory):
_name = 'account.installer.modules' _name = 'account.installer.modules'
_inherit = 'res.config.installer' _inherit = 'res.config.installer'

View File

@ -657,7 +657,9 @@ class account_invoice(osv.osv):
def _convert_ref(self, cr, uid, ref): def _convert_ref(self, cr, uid, ref):
return (ref or '').replace('/','') return (ref or '').replace('/','')
def _get_analytic_lines(self, cr, uid, id): def _get_analytic_lines(self, cr, uid, id, context=None):
if context is None:
context = {}
inv = self.browse(cr, uid, id) inv = self.browse(cr, uid, id)
cur_obj = self.pool.get('res.currency') cur_obj = self.pool.get('res.currency')
@ -667,7 +669,7 @@ class account_invoice(osv.osv):
else: else:
sign = -1 sign = -1
iml = self.pool.get('account.invoice.line').move_line_get(cr, uid, inv.id) iml = self.pool.get('account.invoice.line').move_line_get(cr, uid, inv.id, context=context)
for il in iml: for il in iml:
if il['account_analytic_id']: if il['account_analytic_id']:
if inv.type in ('in_invoice', 'in_refund'): if inv.type in ('in_invoice', 'in_refund'):

View File

@ -76,13 +76,13 @@
<page string="Accounting"> <page string="Accounting">
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator string="Customer Accounting Properties" colspan="2"/> <separator string="Customer Accounting Properties" colspan="2"/>
<field name="property_account_receivable" groups="base.group_extended" /> <field name="property_account_receivable" groups="account.group_account_invoice" />
<field name="property_account_position" widget="selection"/> <field name="property_account_position" widget="selection"/>
<field name="property_payment_term" widget="selection"/> <field name="property_payment_term" widget="selection"/>
</group> </group>
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator string="Supplier Accounting Properties" colspan="2"/> <separator string="Supplier Accounting Properties" colspan="2"/>
<field name="property_account_payable" groups="base.group_extended"/> <field name="property_account_payable" groups="account.group_account_invoice"/>
</group> </group>
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator string="Customer Credit" colspan="2"/> <separator string="Customer Credit" colspan="2"/>

View File

@ -8,89 +8,106 @@
<record id="analytic_absences" model="account.analytic.account"> <record id="analytic_absences" model="account.analytic.account">
<field name="name">Leaves</field> <field name="name">Leaves</field>
<field name="code">1</field> <field name="code">1</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_root"/> <field name="parent_id" ref="analytic_root"/>
</record> </record>
<record id="analytic_internal" model="account.analytic.account"> <record id="analytic_internal" model="account.analytic.account">
<field name="name">Internal</field> <field name="name">Internal</field>
<field name="code">2</field> <field name="code">2</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_root"/> <field name="parent_id" ref="analytic_root"/>
</record> </record>
<record id="analytic_our_super_product" model="account.analytic.account"> <record id="analytic_our_super_product" model="account.analytic.account">
<field name="name">Our Super Product</field> <field name="name">Our Super Product</field>
<field name="code">100</field> <field name="code">100</field>
<field name="state">open</field> <field name="state">open</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_root"/> <field name="parent_id" ref="analytic_root"/>
</record> </record>
<record id="analytic_project_1" model="account.analytic.account"> <record id="analytic_project_1" model="account.analytic.account">
<field name="name">Project 1</field> <field name="name">Project 1</field>
<field name="code">101</field> <field name="code">101</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_root"/> <field name="parent_id" ref="analytic_root"/>
</record> </record>
<record id="analytic_project_2" model="account.analytic.account"> <record id="analytic_project_2" model="account.analytic.account">
<field name="name">Project 2</field> <field name="name">Project 2</field>
<field name="code">102</field> <field name="code">102</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_root"/> <field name="parent_id" ref="analytic_root"/>
</record> </record>
<record id="analytic_journal_trainings" model="account.analytic.account"> <record id="analytic_journal_trainings" model="account.analytic.account">
<field name="name">Training</field> <field name="name">Training</field>
<field name="code">4</field> <field name="code">4</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_internal"/> <field name="parent_id" ref="analytic_internal"/>
</record> </record>
<record id="analytic_in_house" model="account.analytic.account"> <record id="analytic_in_house" model="account.analytic.account">
<field name="name">In House</field> <field name="name">In House</field>
<field name="code">1</field> <field name="code">1</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_journal_trainings"/> <field name="parent_id" ref="analytic_journal_trainings"/>
</record> </record>
<record id="analytic_online" model="account.analytic.account"> <record id="analytic_online" model="account.analytic.account">
<field name="name">Online</field> <field name="name">Online</field>
<field name="code">2</field> <field name="code">2</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_journal_trainings"/> <field name="parent_id" ref="analytic_journal_trainings"/>
</record> </record>
<record id="analytic_support" model="account.analytic.account"> <record id="analytic_support" model="account.analytic.account">
<field name="name">Support</field> <field name="name">Support</field>
<field name="code">support</field> <field name="code">support</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_our_super_product"/> <field name="parent_id" ref="analytic_our_super_product"/>
</record> </record>
<record id="analytic_partners" model="account.analytic.account"> <record id="analytic_partners" model="account.analytic.account">
<field name="name">Partners</field> <field name="name">Partners</field>
<field name="code">partners</field> <field name="code">partners</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_support"/> <field name="parent_id" ref="analytic_support"/>
</record> </record>
<record id="analytic_customers" model="account.analytic.account"> <record id="analytic_customers" model="account.analytic.account">
<field name="name">Customers</field> <field name="name">Customers</field>
<field name="code">customers</field> <field name="code">customers</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_support"/> <field name="parent_id" ref="analytic_support"/>
</record> </record>
<record id="analytic_support_internal" model="account.analytic.account"> <record id="analytic_support_internal" model="account.analytic.account">
<field name="name">Internal</field> <field name="name">Internal</field>
<field name="code">3</field> <field name="code">3</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_support"/> <field name="parent_id" ref="analytic_support"/>
</record> </record>
<record id="analytic_integration" model="account.analytic.account"> <record id="analytic_integration" model="account.analytic.account">
<field name="name">Integration</field> <field name="name">Integration</field>
<field name="code">integration</field> <field name="code">integration</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_our_super_product"/> <field name="parent_id" ref="analytic_our_super_product"/>
</record> </record>
<record id="analytic_consultancy" model="account.analytic.account"> <record id="analytic_consultancy" model="account.analytic.account">
<field name="name">Consultancy</field> <field name="name">Consultancy</field>
<field name="code">4</field> <field name="code">4</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_our_super_product"/> <field name="parent_id" ref="analytic_our_super_product"/>
</record> </record>
<record id="analytic_super_product_trainings" model="account.analytic.account"> <record id="analytic_super_product_trainings" model="account.analytic.account">
<field name="name">Training</field> <field name="name">Training</field>
<field name="code">5</field> <field name="code">5</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_our_super_product"/> <field name="parent_id" ref="analytic_our_super_product"/>
</record> </record>
<record id="analytic_seagate_p1" model="account.analytic.account"> <record id="analytic_seagate_p1" model="account.analytic.account">
<field name="name">Seagate P1</field> <field name="name">Seagate P1</field>
<field name="code">1</field> <field name="code">1</field>
<field name="parent_id" ref="analytic_integration"/> <field name="parent_id" ref="analytic_integration"/>
<field name="type">normal</field>
<field name="state">open</field> <field name="state">open</field>
<field name="partner_id" ref="base.res_partner_seagate"/> <field name="partner_id" ref="base.res_partner_seagate"/>
</record> </record>
<record id="analytic_seagate_p2" model="account.analytic.account"> <record id="analytic_seagate_p2" model="account.analytic.account">
<field name="name">Seagate P2</field> <field name="name">Seagate P2</field>
<field name="code">2</field> <field name="code">2</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_integration"/> <field name="parent_id" ref="analytic_integration"/>
<field name="state">open</field> <field name="state">open</field>
<field name="partner_id" ref="base.res_partner_seagate"/> <field name="partner_id" ref="base.res_partner_seagate"/>
@ -99,11 +116,13 @@
<field name="name">Magasin BML 1</field> <field name="name">Magasin BML 1</field>
<field name="code">3</field> <field name="code">3</field>
<field name="parent_id" ref="analytic_integration"/> <field name="parent_id" ref="analytic_integration"/>
<field name="type">normal</field>
<field name="partner_id" ref="base.res_partner_15"/> <field name="partner_id" ref="base.res_partner_15"/>
</record> </record>
<record id="analytic_integration_c2c" model="account.analytic.account"> <record id="analytic_integration_c2c" model="account.analytic.account">
<field name="name">CampToCamp</field> <field name="name">CampToCamp</field>
<field name="code">7</field> <field name="code">7</field>
<field name="type">normal</field>
<field eval="str(time.localtime()[0] - 1) + '-08-07'" name="date_start"/> <field eval="str(time.localtime()[0] - 1) + '-08-07'" name="date_start"/>
<field eval="time.strftime('%Y-12-31')" name="date"/> <field eval="time.strftime('%Y-12-31')" name="date"/>
<field name="parent_id" ref="analytic_integration"/> <field name="parent_id" ref="analytic_integration"/>
@ -114,18 +133,21 @@
<field name="name">Agrolait</field> <field name="name">Agrolait</field>
<field name="code">3</field> <field name="code">3</field>
<field name="parent_id" ref="analytic_customers"/> <field name="parent_id" ref="analytic_customers"/>
<field name="type">normal</field>
<field name="partner_id" ref="base.res_partner_agrolait"/> <field name="partner_id" ref="base.res_partner_agrolait"/>
</record> </record>
<record id="analytic_asustek" model="account.analytic.account"> <record id="analytic_asustek" model="account.analytic.account">
<field name="name">Asustek</field> <field name="name">Asustek</field>
<field name="code">4</field> <field name="code">4</field>
<field name="parent_id" ref="analytic_customers"/> <field name="type">normal</field>
<field name="parent_id" ref="analytic_customers"/>
<field name="partner_id" ref="base.res_partner_asus"/> <field name="partner_id" ref="base.res_partner_asus"/>
</record> </record>
<record id="analytic_distripc" model="account.analytic.account"> <record id="analytic_distripc" model="account.analytic.account">
<field name="name">DistriPC</field> <field name="name">DistriPC</field>
<field name="code">7</field> <field name="code">7</field>
<field name="parent_id" ref="analytic_customers"/> <field name="parent_id" ref="analytic_customers"/>
<field name="type">normal</field>
<field name="partner_id" ref="base.res_partner_4"/> <field name="partner_id" ref="base.res_partner_4"/>
</record> </record>
<record id="analytic_sednacom" model="account.analytic.account"> <record id="analytic_sednacom" model="account.analytic.account">
@ -134,6 +156,7 @@
<field eval="str(time.localtime()[0] - 1) + '-05-09'" name="date_start"/> <field eval="str(time.localtime()[0] - 1) + '-05-09'" name="date_start"/>
<field eval="time.strftime('%Y-05-08')" name="date"/> <field eval="time.strftime('%Y-05-08')" name="date"/>
<field name="parent_id" ref="analytic_partners"/> <field name="parent_id" ref="analytic_partners"/>
<field name="type">normal</field>
<field name="partner_id" ref="base.res_partner_sednacom"/> <field name="partner_id" ref="base.res_partner_sednacom"/>
<field name="state">open</field> <field name="state">open</field>
</record> </record>
@ -142,6 +165,7 @@
<field name="code">3</field> <field name="code">3</field>
<field eval="time.strftime('%Y-02-01')" name="date_start"/> <field eval="time.strftime('%Y-02-01')" name="date_start"/>
<field eval="time.strftime('%Y-07-01')" name="date"/> <field eval="time.strftime('%Y-07-01')" name="date"/>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/> <field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_thymbra"/> <field name="partner_id" ref="base.res_partner_thymbra"/>
<field name="state">open</field> <field name="state">open</field>
@ -151,6 +175,7 @@
<field name="code">10</field> <field name="code">10</field>
<field eval="time.strftime('%Y-04-24')" name="date_start"/> <field eval="time.strftime('%Y-04-24')" name="date_start"/>
<field eval="str(time.localtime()[0] + 1) + '-04-24'" name="date"/> <field eval="str(time.localtime()[0] + 1) + '-04-24'" name="date"/>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/> <field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_11"/> <field name="partner_id" ref="base.res_partner_11"/>
</record> </record>
@ -159,12 +184,14 @@
<field name="code">12</field> <field name="code">12</field>
<field eval="time.strftime('%Y-02-01')" name="date_start"/> <field eval="time.strftime('%Y-02-01')" name="date_start"/>
<field eval="str(time.localtime()[0] + 1) + '-02-01'" name="date"/> <field eval="str(time.localtime()[0] + 1) + '-02-01'" name="date"/>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/> <field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_desertic_hispafuentes"/> <field name="partner_id" ref="base.res_partner_desertic_hispafuentes"/>
</record> </record>
<record id="analytic_tiny_at_work" model="account.analytic.account"> <record id="analytic_tiny_at_work" model="account.analytic.account">
<field name="name">OpenERP SA AT Work</field> <field name="name">OpenERP SA AT Work</field>
<field name="code">15</field> <field name="code">15</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/> <field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_tinyatwork"/> <field name="partner_id" ref="base.res_partner_tinyatwork"/>
</record> </record>
@ -173,6 +200,7 @@
<field name="code">21</field> <field name="code">21</field>
<field eval="time.strftime('%Y-%m-%d', time.localtime(time.time() - 365 * 86400))" name="date_start"/> <field eval="time.strftime('%Y-%m-%d', time.localtime(time.time() - 365 * 86400))" name="date_start"/>
<field eval="time.strftime('%Y-%m-%d')" name="date"/> <field eval="time.strftime('%Y-%m-%d')" name="date"/>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_partners"/> <field name="parent_id" ref="analytic_partners"/>
<field name="partner_id" ref="base.res_partner_c2c"/> <field name="partner_id" ref="base.res_partner_c2c"/>
<field name="state">open</field> <field name="state">open</field>
@ -180,56 +208,67 @@
<record id="analytic_project_2_support" model="account.analytic.account"> <record id="analytic_project_2_support" model="account.analytic.account">
<field name="name">Support</field> <field name="name">Support</field>
<field name="code">1</field> <field name="code">1</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_project_2"/> <field name="parent_id" ref="analytic_project_2"/>
</record> </record>
<record id="analytic_project_2_development" model="account.analytic.account"> <record id="analytic_project_2_development" model="account.analytic.account">
<field name="name">Development</field> <field name="name">Development</field>
<field name="code">2</field> <field name="code">2</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_project_2"/> <field name="parent_id" ref="analytic_project_2"/>
</record> </record>
<record id="analytic_project_1_trainings" model="account.analytic.account"> <record id="analytic_project_1_trainings" model="account.analytic.account">
<field name="name">Training</field> <field name="name">Training</field>
<field name="code">1</field> <field name="code">1</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_project_1"/> <field name="parent_id" ref="analytic_project_1"/>
</record> </record>
<record id="analytic_project_1_development" model="account.analytic.account"> <record id="analytic_project_1_development" model="account.analytic.account">
<field name="name">Development</field> <field name="name">Development</field>
<field name="code">2</field> <field name="code">2</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_project_1"/> <field name="parent_id" ref="analytic_project_1"/>
</record> </record>
<record id="analytic_administratif" model="account.analytic.account"> <record id="analytic_administratif" model="account.analytic.account">
<field name="name">Administrative</field> <field name="name">Administrative</field>
<field name="code">1</field> <field name="code">1</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_internal"/> <field name="parent_id" ref="analytic_internal"/>
</record> </record>
<record id="analytic_commercial_marketing" model="account.analytic.account"> <record id="analytic_commercial_marketing" model="account.analytic.account">
<field name="name">Commercial &amp; Marketing</field> <field name="name">Commercial &amp; Marketing</field>
<field name="code">2</field> <field name="code">2</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_internal"/> <field name="parent_id" ref="analytic_internal"/>
</record> </record>
<record id="analytic_our_super_product_development" model="account.analytic.account"> <record id="analytic_our_super_product_development" model="account.analytic.account">
<field name="name">Our Super Product Development</field> <field name="name">Our Super Product Development</field>
<field name="code">3</field> <field name="code">3</field>
<field name="type">view</field>
<field name="parent_id" ref="analytic_internal"/> <field name="parent_id" ref="analytic_internal"/>
</record> </record>
<record id="analytic_stable" model="account.analytic.account"> <record id="analytic_stable" model="account.analytic.account">
<field name="name">Stable</field> <field name="name">Stable</field>
<field name="code">1</field> <field name="code">1</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_our_super_product_development"/> <field name="parent_id" ref="analytic_our_super_product_development"/>
</record> </record>
<record id="analytic_trunk" model="account.analytic.account"> <record id="analytic_trunk" model="account.analytic.account">
<field name="name">Trunk</field> <field name="name">Trunk</field>
<field name="code">2</field> <field name="code">2</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_our_super_product_development"/> <field name="parent_id" ref="analytic_our_super_product_development"/>
</record> </record>
<record id="analytic_paid" model="account.analytic.account"> <record id="analytic_paid" model="account.analytic.account">
<field name="name">Paid</field> <field name="name">Paid</field>
<field name="code">1</field> <field name="code">1</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_absences"/> <field name="parent_id" ref="analytic_absences"/>
</record> </record>
<record id="analytic_unpaid" model="account.analytic.account"> <record id="analytic_unpaid" model="account.analytic.account">
<field name="name">Unpaid</field> <field name="name">Unpaid</field>
<field name="code">2</field> <field name="code">2</field>
<field name="type">normal</field>
<field name="parent_id" ref="analytic_absences"/> <field name="parent_id" ref="analytic_absences"/>
</record> </record>
</data> </data>

View File

@ -55,19 +55,20 @@
<field name="type">tree</field> <field name="type">tree</field>
<field name="field_parent">child_complete_ids</field> <field name="field_parent">child_complete_ids</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree colors="red:(date&lt;current_date);black:(date&gt;=current_date);black:(date==False)" string="Analytic account" toolbar="1"> <tree colors="blue:type in ('view');red:(date&lt;current_date);black:(date&gt;=current_date);black:(date==False)" string="Analytic account" toolbar="1">
<field name="name"/> <field name="name"/>
<field name="code"/> <field name="code"/>
<field name="quantity"/> <field name="quantity"/>
<field name="quantity_max"/> <field name="quantity_max"/>
<field name="debit"/> <field name="debit"/>
<field name="credit"/> <field name="credit"/>
<field name="balance"/> <field name="balance"/>
<field name="currency_id" groups="base.group_extended"/> <field name="currency_id" groups="base.group_extended"/>
<field name="date" invisible="1"/> <field name="date" invisible="1"/>
<field name="user_id" invisible="1"/> <field name="user_id" invisible="1"/>
<field name="partner_id" invisible="1"/> <field name="partner_id" invisible="1"/>
<field name="parent_id" invisible="1"/> <field name="parent_id" invisible="1"/>
<field name="type" invisible="1"/>
</tree> </tree>
</field> </field>
</record> </record>

View File

@ -100,7 +100,8 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header)
ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)
if data['form']['filter'] == 'filter_period': if data['form']['filter'] == 'filter_period':
ctx['periods'] = data['form'].get('periods', False) ctx['period_from'] = data['form'].get('period_from', False)
ctx['period_to'] = data['form'].get('period_to', False)
elif data['form']['filter'] == 'filter_date': elif data['form']['filter'] == 'filter_date':
ctx['date_from'] = data['form'].get('date_from', False) ctx['date_from'] = data['form'].get('date_from', False)
ctx['date_to'] = data['form'].get('date_to', False) ctx['date_to'] = data['form'].get('date_to', False)

View File

@ -93,7 +93,8 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)
if data['form']['filter'] == 'filter_period': if data['form']['filter'] == 'filter_period':
ctx['periods'] = data['form'].get('periods', False) ctx['period_from'] = data['form'].get('period_from', False)
ctx['period_to'] = data['form'].get('period_to', False)
elif data['form']['filter'] == 'filter_date': elif data['form']['filter'] == 'filter_date':
ctx['date_from'] = data['form'].get('date_from', False) ctx['date_from'] = data['form'].get('date_from', False)
ctx['date_to'] = data['form'].get('date_to', False) ctx['date_to'] = data['form'].get('date_to', False)

View File

@ -13,7 +13,7 @@
<field name="fy_id" domain = "[('state','=','draft')]"/> <field name="fy_id" domain = "[('state','=','draft')]"/>
<field name="fy2_id" domain = "[('state','=','draft')]"/> <field name="fy2_id" domain = "[('state','=','draft')]"/>
<field name="journal_id"/> <field name="journal_id"/>
<field name="period_id" domain ="[('fiscalyear_id','=',fy2_id)]" /> <field name="period_id" domain ="[('fiscalyear_id','=',fy2_id),('special','=', True)]" />
<field name="report_name" colspan="4"/> <field name="report_name" colspan="4"/>
<separator colspan="4"/> <separator colspan="4"/>
<group colspan="4" col="6"> <group colspan="4" col="6">

View File

@ -390,7 +390,7 @@ class account_analytic_account(osv.osv):
'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot', 'hours_quantity': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Hours Tot',
help="Number of hours you spent on the analytic account (from timesheet). It computes on all journal of type 'general'."), help="Number of hours you spent on the analytic account (from timesheet). It computes on all journal of type 'general'."),
'last_invoice_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Last Invoice Date', 'last_invoice_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Last Invoice Date',
help="Date of the last invoice created for this analytic account."), help="If invoice from the costs, this is the date of the latest invoiced."),
'last_worked_invoiced_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Invoiced Cost', 'last_worked_invoiced_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Invoiced Cost',
help="If invoice from the costs, this is the date of the latest work or cost that have been invoiced."), help="If invoice from the costs, this is the date of the latest work or cost that have been invoiced."),
'last_worked_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Cost/Work', 'last_worked_date': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='date', string='Date of Last Cost/Work',

View File

@ -15,11 +15,11 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
from osv import fields,osv from osv import osv
#---------------------------------------------------------- #----------------------------------------------------------
# Stock Picking # Stock Picking

View File

@ -217,7 +217,7 @@
<para style="terp_default_9"> <para style="terp_default_9">
<font color="white"> </font> <font color="white"> </font>
</para> </para>
<blockTable colWidths="112.0,86.0,106.0,63.0,85.0,75.0" style="Table3"> <blockTable colWidths="112.0,86.0,102.0,70.0,82.0,75.0" style="Table3">
<tr> <tr>
<td> <td>
<para style="terp_tblheader_Details">Partner</para> <para style="terp_tblheader_Details">Partner</para>
@ -241,7 +241,7 @@
</blockTable> </blockTable>
<section> <section>
<para style="terp_default_2">[[repeatIn(o.line_ids, 'line') ]]</para> <para style="terp_default_2">[[repeatIn(o.line_ids, 'line') ]]</para>
<blockTable colWidths="112.0,86.0,106.0,64.0,85.0,75.0" style="Table4"> <blockTable colWidths="112.0,86.0,102.0,70.0,82.0,75.0" style="Table4">
<tr> <tr>
<td> <td>
<para style="terp_default_9">[[line.partner_id and line.partner_id.name or '-' ]]</para> <para style="terp_default_9">[[line.partner_id and line.partner_id.name or '-' ]]</para>

View File

@ -76,7 +76,7 @@ class account_payment_populate_statement(osv.osv_memory):
statement.currency.id, line.amount_currency, context=ctx) statement.currency.id, line.amount_currency, context=ctx)
context.update({'move_line_ids': [line.move_line_id.id]}) context.update({'move_line_ids': [line.move_line_id.id]})
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context) result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context)
if line.move_line_id: if line.move_line_id:
voucher_res = { voucher_res = {

View File

@ -710,7 +710,7 @@ class account_voucher(osv.osv):
move_line = { move_line = {
'journal_id': inv.journal_id.id, 'journal_id': inv.journal_id.id,
'period_id': inv.period_id.id, 'period_id': inv.period_id.id,
'name': line.name and line.name or '/', 'name': line.name or '/',
'account_id': line.account_id.id, 'account_id': line.account_id.id,
'move_id': move_id, 'move_id': move_id,
'partner_id': inv.partner_id.id, 'partner_id': inv.partner_id.id,
@ -752,14 +752,16 @@ class account_voucher(osv.osv):
if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total): if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total):
diff = line_total diff = line_total
account_id = False account_id = False
write_off_name = ''
if inv.payment_option == 'with_writeoff': if inv.payment_option == 'with_writeoff':
account_id = inv.writeoff_acc_id.id account_id = inv.writeoff_acc_id.id
write_off_name = inv.comment
elif inv.type in ('sale', 'receipt'): elif inv.type in ('sale', 'receipt'):
account_id = inv.partner_id.property_account_receivable.id account_id = inv.partner_id.property_account_receivable.id
else: else:
account_id = inv.partner_id.property_account_payable.id account_id = inv.partner_id.property_account_payable.id
move_line = { move_line = {
'name': name, 'name': write_off_name or name,
'account_id': account_id, 'account_id': account_id,
'move_id': move_id, 'move_id': move_id,
'partner_id': inv.partner_id.id, 'partner_id': inv.partner_id.id,
@ -835,7 +837,7 @@ class account_voucher_line(osv.osv):
'partner_id':fields.related('voucher_id', 'partner_id', type='many2one', relation='res.partner', string='Partner'), 'partner_id':fields.related('voucher_id', 'partner_id', type='many2one', relation='res.partner', string='Partner'),
'untax_amount':fields.float('Untax Amount'), 'untax_amount':fields.float('Untax Amount'),
'amount':fields.float('Amount', digits_compute=dp.get_precision('Account')), 'amount':fields.float('Amount', digits_compute=dp.get_precision('Account')),
'type':fields.selection([('dr','Debit'),('cr','Credit')], 'Cr/Dr'), 'type':fields.selection([('dr','Debit'),('cr','Credit')], 'Dr/Cr'),
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'), 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
'move_line_id': fields.many2one('account.move.line', 'Journal Item'), 'move_line_id': fields.many2one('account.move.line', 'Journal Item'),
'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly=1), 'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly=1),

View File

@ -151,16 +151,17 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Bill Payment"> <form string="Bill Payment">
<group col="6" colspan="4"> <group col="6" colspan="4">
<field name="partner_id" domain="[('supplier','=',True)]" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" context="{'invoice_currency':currency_id}" string="Supplier"/> <field name="partner_id" domain="[('supplier','=',True)]" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" context="{'invoice_currency':currency_id}" string="Supplier"/>
<field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/> <field name="amount" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="journal_id" <field name="journal_id"
domain="[('type','in',['bank', 'cash'])]" domain="[('type','in',['bank', 'cash'])]"
invisible="context.get('line_type', False)"
widget="selection" select="1" widget="selection" select="1"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
string="Payment Method"/> string="Payment Method"/>
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/> <field name="date" select="1" invisible="context.get('line_type', False)" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="reference" select="1" string="Payment Ref"/> <field name="reference" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
<field name="name" colspan="2"/> <field name="name" colspan="2" invisible="context.get('line_type', False)"/>
<field name="account_id" <field name="account_id"
widget="selection" widget="selection"
invisible="True"/> invisible="True"/>
@ -245,10 +246,10 @@
</notebook> </notebook>
<group col="10" colspan="4"> <group col="10" colspan="4">
<field name="state"/> <field name="state"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/> <button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel" invisible="context.get('line_type', False)"/>
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/> <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile this record ?"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/> <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)"/>
<button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward"/> <button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward" invisible="context.get('line_type', False)"/>
</group> </group>
</form> </form>
</field> </field>
@ -288,18 +289,20 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Customer Payment"> <form string="Customer Payment">
<group col="6" colspan="4"> <group col="6" colspan="4">
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" string="Customer"/> <field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" string="Customer"/>
<field name="amount" <field name="amount"
invisible="context.get('line_type', False)"
string="Paid Amount" string="Paid Amount"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/> on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="journal_id" <field name="journal_id"
domain="[('type','in',['bank', 'cash'])]" domain="[('type','in',['bank', 'cash'])]"
invisible="context.get('line_type', False)"
widget="selection" select="1" widget="selection" select="1"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
string="Payment Method"/> string="Payment Method"/>
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/> <field name="date" select="1" invisible="context.get('line_type', False)" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="reference" select="1" string="Payment Ref"/> <field name="reference" select="1" invisible="context.get('line_type', False)" string="Payment Ref"/>
<field name="name" colspan="2"/> <field name="name" colspan="2" invisible="context.get('line_type', False)"/>
<field name="account_id" <field name="account_id"
widget="selection" widget="selection"
invisible="True"/> invisible="True"/>
@ -384,10 +387,10 @@
</notebook> </notebook>
<group col="10" colspan="4"> <group col="10" colspan="4">
<field name="state"/> <field name="state"/>
<button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/> <button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel" invisible="context.get('line_type', False)"/>
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/> <button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/> <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize" invisible="context.get('line_type', False)"/>
<button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward"/> <button name="proforma_voucher" string="Validate" states="draft" icon="gtk-go-forward" invisible="context.get('line_type', False)"/>
</group> </group>
</form> </form>
</field> </field>

View File

@ -75,7 +75,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
statement.currency.id, amount, context=ctx) statement.currency.id, amount, context=ctx)
context.update({'move_line_ids': [line.id]}) context.update({'move_line_ids': [line.id]})
result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), date=time.strftime('%Y-%m-%d'), context=context) result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), date=line_date, context=context)
voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt'), voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt'),
'name': line.name, 'name': line.name,
'partner_id': line.partner_id.id, 'partner_id': line.partner_id.id,

View File

@ -38,7 +38,9 @@ _ref_vat = {
'nl': 'NL123456782B90', 'pl': 'PL1234567883', 'nl': 'NL123456782B90', 'pl': 'PL1234567883',
'pt': 'PT123456789', 'ro': 'RO1234567897', 'pt': 'PT123456789', 'ro': 'RO1234567897',
'se': 'SE123456789701', 'si': 'SI12345679', 'se': 'SE123456789701', 'si': 'SI12345679',
'sk': 'SK0012345675', 'el': 'EL12345670' 'sk': 'SK0012345675', 'el': 'EL12345670',
'mx': 'MXABC123456T1B'
} }
def mult_add(i, j): def mult_add(i, j):
@ -1064,6 +1066,17 @@ class res_partner(osv.osv):
return False return False
return True return True
def check_vat_mx(self, vat):
'''
Verificar RFC ©xico
'''
if not 12 <= len(vat) <= 13:
return False
elif len(vat)==12 and not vat[:3].isalpha() | vat[3:9].isdigit() | vat[-3:].isalnum():
return False
elif len(vat)==13 and not vat[:4].isalpha() | vat[4:10].isdigit() | vat[-3:].isalnum():
return False
return True
res_partner() res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -150,7 +150,7 @@ class hr_employee(osv.osv):
'partner_id': fields.related('address_home_id', 'partner_id', type='many2one', relation='res.partner', readonly=True, help="Partner that is related to the current employee. Accounting transaction will be written on this partner belongs to employee."), 'partner_id': fields.related('address_home_id', 'partner_id', type='many2one', relation='res.partner', readonly=True, help="Partner that is related to the current employee. Accounting transaction will be written on this partner belongs to employee."),
'bank_account_id':fields.many2one('res.partner.bank', 'Bank Account', domain="[('partner_id','=',partner_id)]", help="Employee bank salary account"), 'bank_account_id':fields.many2one('res.partner.bank', 'Bank Account', domain="[('partner_id','=',partner_id)]", help="Employee bank salary account"),
'work_phone': fields.char('Work Phone', size=32, readonly=False), 'work_phone': fields.char('Work Phone', size=32, readonly=False),
'mobile_phone': fields.char('Mobile', size=32, readonly=False), 'mobile_phone': fields.char('Work Mobile', size=32, readonly=False),
'work_email': fields.char('Work E-mail', size=240), 'work_email': fields.char('Work E-mail', size=240),
'work_location': fields.char('Office Location', size=32), 'work_location': fields.char('Office Location', size=32),
'notes': fields.text('Notes'), 'notes': fields.text('Notes'),
@ -167,7 +167,7 @@ class hr_employee(osv.osv):
def onchange_address_id(self, cr, uid, ids, address, context=None): def onchange_address_id(self, cr, uid, ids, address, context=None):
if address: if address:
address = self.pool.get('res.partner.address').browse(cr, uid, address, context=context) address = self.pool.get('res.partner.address').browse(cr, uid, address, context=context)
return {'value': {'work_email': address.email, 'work_phone': address.phone}} return {'value': {'work_email': address.email, 'work_phone': address.phone, 'mobile_phone': address.mobile}}
return {'value': {}} return {'value': {}}
def onchange_company(self, cr, uid, ids, company, context=None): def onchange_company(self, cr, uid, ids, company, context=None):
@ -191,7 +191,7 @@ class hr_employee(osv.osv):
_defaults = { _defaults = {
'active': 1, 'active': 1,
'photo': _get_photo, 'photo': _get_photo,
'address_id': lambda self,cr,uid,c: self.pool.get('res.partner.address').browse(cr, uid, uid, c).partner_id.id 'address_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).address_id.id
} }
def _check_recursion(self, cr, uid, ids, context=None): def _check_recursion(self, cr, uid, ids, context=None):

View File

@ -34,10 +34,10 @@ from tools import ustr
one_day = relativedelta(days=1) one_day = relativedelta(days=1)
month2name = [0, 'January', 'February', 'March', 'April', 'May', 'Jun', 'July', 'August', 'September', 'October', 'November', 'December'] month2name = [0, 'January', 'February', 'March', 'April', 'May', 'Jun', 'July', 'August', 'September', 'October', 'November', 'December']
#def hour2str(h): def hour2str(h):
# hours = int(h) hours = int(h)
# minutes = int(round((h - hours) * 60, 0)) minutes = int(round((h - hours) * 60, 0))
# return '%02dh%02d' % (hours, minutes) return '%02dh%02d' % (hours, minutes)
def lengthmonth(year, month): def lengthmonth(year, month):
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))): if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
@ -85,12 +85,12 @@ class report_custom(report_rml):
for att in attendences: for att in attendences:
dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
if ldt and att['action'] == 'sign_out': if ldt and att['action'] == 'sign_out':
wh += (dt - ldt).seconds/60/60 wh += (float((dt - ldt).seconds)/60/60)
else: else:
ldt = dt ldt = dt
# Week xml representation # Week xml representation
# wh = hour2str(wh) wh = hour2str(wh)
today_xml = '<day num="%s"><wh>%s</wh></day>' % ((today - month).days+1, round(wh,2)) today_xml = '<day num="%s"><wh>%s</wh></day>' % ((today - month).days+1, (wh))
dy=(today - month).days+1 dy=(today - month).days+1
days_xml.append(today_xml) days_xml.append(today_xml)
today, tomor = tomor, tomor + one_day today, tomor = tomor, tomor + one_day

View File

@ -24,9 +24,9 @@ from datetime import datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
import pooler import pooler
from report.interface import report_rml from report.interface import report_rml
from report.interface import toxml from report.interface import toxml
import tools
one_week = relativedelta(days=7) one_week = relativedelta(days=7)
num2day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] num2day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
@ -38,12 +38,12 @@ class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context=None): def create_xml(self, cr, uid, ids, datas, context=None):
obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') obj_emp = pooler.get_pool(cr.dbname).get('hr.employee')
start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d') start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d')
end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d') end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d')
first_monday = start_date - relativedelta(days=start_date.date().weekday()) first_monday = start_date - relativedelta(days=start_date.date().weekday())
last_monday = end_date + relativedelta(days=7 - end_date.date().weekday()) last_monday = end_date + relativedelta(days=7 - end_date.date().weekday())
if last_monday < first_monday: if last_monday < first_monday:
first_monday, last_monday = last_monday, first_monday first_monday, last_monday = last_monday, first_monday
@ -58,7 +58,7 @@ class report_custom(report_rml):
<name>%s</name> <name>%s</name>
%%s %%s
</user> </user>
''' % ustr(toxml(emp['name'])) ''' % tools.ustr(toxml(emp['name']))
while monday != last_monday: while monday != last_monday:
#### Work hour calculation #### Work hour calculation
sql = ''' sql = '''
@ -83,7 +83,7 @@ class report_custom(report_rml):
for att in attendances: for att in attendances:
dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
if ldt and att['action'] == 'sign_out': if ldt and att['action'] == 'sign_out':
week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + ((dt - ldt).seconds/3600) week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + (float((dt - ldt).seconds)/3600)
else: else:
ldt = dt ldt = dt

View File

@ -1,6 +1,40 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data>
<record id="view_hr_attendance_week" model="ir.ui.view">
<field name="name">Attendances Report Weekly</field>
<field name="model">hr.attendance.week</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Print Attendance Report Weekly">
<field name="init_date"/>
<field name="end_date"/>
<newline/>
<separator colspan="4"/>
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="print_report" string="Print" type="object" icon="gtk-print"/>
</form>
</field>
</record>
<record id="action_hr_attendance_week" model="ir.actions.act_window">
<field name="name">Attendances By Week</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.attendance.week</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="hr_attendance_week_values">
<field name="model_id" ref="hr.model_hr_employee" />
<field name="object" eval="1" />
<field name="name">Attendances By Week</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_attendance_week'))" />
<field name="key">action</field>
<field name="model">hr.employee</field>
</record>
</data> </data>
</openerp> </openerp>

View File

@ -251,6 +251,10 @@ class hr_evaluation(osv.osv):
self.write(cr, uid, ids,{'state':'cancel'}, context=context) self.write(cr, uid, ids,{'state':'cancel'}, context=context)
return True return True
def button_draft(self, cr, uid, ids, context=None):
self.write(cr, uid, ids,{'state': 'draft'}, context=context)
return True
def write(self, cr, uid, ids, vals, context=None): def write(self, cr, uid, ids, vals, context=None):
if 'date' in vals: if 'date' in vals:
new_vals = {'date_deadline': vals.get('date')} new_vals = {'date_deadline': vals.get('date')}

View File

@ -200,16 +200,18 @@
</page> </page>
</notebook> </notebook>
<newline/> <newline/>
<group col="6" colspan="4"> <group col="8" colspan="4">
<field name="state"/> <field name="state"/>
<button name="button_cancel" string="Cancel" states="draft,wait,progress" type="object" <button name="button_cancel" string="Cancel" states="draft,wait,progress" type="object"
icon="gtk-cancel"/> icon="gtk-cancel"/>
<button name="button_plan_in_progress" string="Start Evaluation" states="draft" type="object" <button name="button_plan_in_progress" string="Start Evaluation" states="draft" type="object"
icon="gtk-execute"/> icon="gtk-execute"/>
<button name="button_done" string="Done" states="progress" type="object" <button name="button_done" string="Done" states="progress" type="object"
icon="gtk-jump-to"/> icon="gtk-jump-to"/>
<button name="button_final_validation" string="Validate Evaluation" states="wait" type="object" <button name="button_draft" string="Reset to Draft" states="cancel" type="object"
icon="gtk-go-forward"/> icon="terp-stock_effects-object-colorize"/>
<button name="button_final_validation" string="Validate Evaluation" states="wait" type="object"
icon="gtk-go-forward"/>
</group> </group>
</form> </form>
</field> </field>
@ -250,12 +252,12 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Search Evaluation"> <search string="Search Evaluation">
<group col='10' colspan='4'> <group col='10' colspan='4'>
<filter icon="terp-check" string="Current" domain="[('state','=','wait'))]" help="Evaluations that are in waiting state"/> <filter icon="terp-check" string="Current" domain="[('state','=','wait'))]" help="Evaluations that are in waiting state"/>
<filter icon="terp-camera_test" string="In progress" domain="[('state','=','progress')]" help="Evaluations that are in progress state"/> <filter icon="terp-camera_test" string="In progress" domain="[('state','=','progress')]" help="Evaluations that are in progress state"/>
<separator orientation="vertical"/> <separator orientation="vertical"/>
<filter icon="terp-go-week" string="7 Days" help="Evaluations to close within the next 7 days" <filter icon="terp-go-week" string="7 Days" help="Evaluations to close within the next 7 days"
domain="[('date', '&gt;=', (datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" /> domain="[('date', '&gt;=', (datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" />
<separator orientation="vertical"/> <separator orientation="vertical"/>
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late" <filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
help="Evaluations that overpassed the deadline" domain="[('date','&lt;=',(datetime.date.today()).strftime('%%Y-%%m-%%d'))]" /> help="Evaluations that overpassed the deadline" domain="[('date','&lt;=',(datetime.date.today()).strftime('%%Y-%%m-%%d'))]" />
<separator orientation="vertical"/> <separator orientation="vertical"/>
@ -405,11 +407,11 @@
action="action_hr_evaluation_send_mail" sequence="45" groups="base.group_hr_manager"/> action="action_hr_evaluation_send_mail" sequence="45" groups="base.group_hr_manager"/>
<!-- Evaluation Interviews Button on Employee Form --> <!-- Evaluation Interviews Button on Employee Form -->
<act_window <act_window
context="{'search_default_user_to_review_id': [active_id]}" context="{'search_default_user_to_review_id': [active_id]}"
id="act_hr_employee_2_hr__evaluation_interview" id="act_hr_employee_2_hr__evaluation_interview"
name="Evaluation Interviews" name="Evaluation Interviews"
res_model="hr.evaluation.interview" res_model="hr.evaluation.interview"
src_model="hr.employee"/> src_model="hr.employee"/>
</data> </data>

View File

@ -70,7 +70,7 @@
<form string="Leave Request"> <form string="Leave Request">
<group col="8" colspan="4"> <group col="8" colspan="4">
<field name="name" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}" /> <field name="name" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130" groups="base.group_hr_manager, base.group_extended" string="Leave Type"/> <field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130" groups="base.group_hr_manager, base.group_extended" string="Leave Category"/>
<group attrs="{'invisible':[('holiday_type','=','employee')]}"> <group attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/> <field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group> </group>
@ -81,7 +81,7 @@
<notebook colspan="4"> <notebook colspan="4">
<page string="General"> <page string="General">
<field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" /> <field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" />
<field name="department_id"/> <field name="department_id" attrs="{'readonly':[('holiday_type','=','category')]}" />
<field name="date_from" on_change="onchange_date_from(date_to, date_from)" required="1"/> <field name="date_from" on_change="onchange_date_from(date_to, date_from)" required="1"/>
<field name="date_to" on_change="onchange_date_from(date_to, date_from)" required="1"/> <field name="date_to" on_change="onchange_date_from(date_to, date_from)" required="1"/>
<field name="number_of_days_temp"/> <field name="number_of_days_temp"/>
@ -114,7 +114,7 @@
<form string="Allocation Request"> <form string="Allocation Request">
<group col="8" colspan="4"> <group col="8" colspan="4">
<field name="name" /> <field name="name" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Type" groups="base.group_hr_manager, base.group_extended"/> <field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Category" groups="base.group_hr_manager, base.group_extended"/>
<group attrs="{'invisible':[('holiday_type','=','category')]}"> <group attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')]}"/> <field name="employee_id" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group> </group>
@ -125,7 +125,7 @@
<notebook colspan="4"> <notebook colspan="4">
<page string="General"> <page string="General">
<field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" /> <field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" />
<field name="department_id"/> <field name="department_id" attrs="{'readonly':[('holiday_type','=','category')]}" />
<field name="number_of_days_temp"/> <field name="number_of_days_temp"/>
<newline/> <newline/>
<field name="manager_id"/> <field name="manager_id"/>
@ -414,7 +414,7 @@
</record> </record>
<menuitem sequence="3" id="hr.menu_open_view_attendance_reason_config" parent="hr.menu_hr_configuration" name="Holidays"/> <menuitem sequence="3" id="hr.menu_open_view_attendance_reason_config" parent="hr.menu_hr_configuration" name="Holidays"/>
<menuitem name="Leave Type" <menuitem name="Leave Type"
action="open_view_holiday_status" action="open_view_holiday_status"
id="menu_open_view_holiday_status" id="menu_open_view_holiday_status"

View File

@ -5,7 +5,7 @@
<record id="property_rule_holidays" model="ir.rule"> <record id="property_rule_holidays" model="ir.rule">
<field name="name">Employee Holidays</field> <field name="name">Employee Holidays</field>
<field model="ir.model" name="model_id" ref="model_hr_holidays"/> <field model="ir.model" name="model_id" ref="model_hr_holidays"/>
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field> <field name="domain_force">['|', ('employee_id.user_id','=',user.id), ('department_id.manager_id.user_id', '=', user.id)]</field>
<field name="groups" eval="[(6,0,[ref('base.group_hr_user')])]"/> <field name="groups" eval="[(6,0,[ref('base.group_hr_user')])]"/>
</record> </record>
<record id="property_rule_holidays_manager" model="ir.rule"> <record id="property_rule_holidays_manager" model="ir.rule">

View File

@ -437,7 +437,7 @@ class hr_job(osv.osv):
_inherit = "hr.job" _inherit = "hr.job"
_name = "hr.job" _name = "hr.job"
_columns = { _columns = {
'survey_id': fields.many2one('survey', 'Survey'), 'survey_id': fields.many2one('survey', 'Survey', help="Select survey for the current job"),
} }
hr_job() hr_job()

View File

@ -66,10 +66,5 @@
<field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/> <field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
</record> </record>
<!-- Department(section_id) -->
<record model="crm.case.section" id="section_hr_department">
<field name="name">HR Department</field>
<field name="code">HR</field>
</record>
</data> </data>
</openerp> </openerp>

View File

@ -14,8 +14,8 @@
<field name="property_account_payable" ref="account_account_template_0_211001"/> <field name="property_account_payable" ref="account_account_template_0_211001"/>
<field name="property_account_income" ref="account_account_template_0_410001"/> <field name="property_account_income" ref="account_account_template_0_410001"/>
<field name="property_account_expense" ref="account_account_template_0_511301"/> <field name="property_account_expense" ref="account_account_template_0_511301"/>
<field name="property_account_income_categ" ref="account_account_template_0_400000"/> <field name="property_account_income_categ" ref="account_account_template_0_410001"/>
<field name="property_account_expense_categ" ref="account_account_template_0_500000"/> <field name="property_account_expense_categ" ref="account_account_template_0_511301"/>
</record> </record>
<record id="account_chart_template_x" model="account.chart.template"> <record id="account_chart_template_x" model="account.chart.template">
<field name="name">Costa Rica - Company 1</field> <field name="name">Costa Rica - Company 1</field>
@ -26,8 +26,8 @@
<field name="property_account_payable" ref="account_account_template_x211001"/> <field name="property_account_payable" ref="account_account_template_x211001"/>
<field name="property_account_income" ref="account_account_template_x410001"/> <field name="property_account_income" ref="account_account_template_x410001"/>
<field name="property_account_expense" ref="account_account_template_x511301"/> <field name="property_account_expense" ref="account_account_template_x511301"/>
<field name="property_account_income_categ" ref="account_account_template_x400000"/> <field name="property_account_income_categ" ref="account_account_template_x410001"/>
<field name="property_account_expense_categ" ref="account_account_template_x500000"/> <field name="property_account_expense_categ" ref="account_account_template_x511301"/>
</record> </record>
</data> </data>
</openerp> </openerp>

View File

@ -8,8 +8,8 @@
<field name="account_root_id" ref="chart_skr04"/> <field name="account_root_id" ref="chart_skr04"/>
<field name="tax_code_root_id" ref="tax_code_USTVA_skr04"/> <field name="tax_code_root_id" ref="tax_code_USTVA_skr04"/>
<field name="bank_account_view_id" ref="chart_skr04_1800"/> <field name="bank_account_view_id" ref="chart_skr04_1800"/>
<field name="property_account_receivable" ref="chart_skr04_1200"/> <field name="property_account_receivable" ref="chart_skr04_1206"/>
<field name="property_account_payable" ref="chart_skr04_3300"/> <field name="property_account_payable" ref="chart_skr04_3301"/>
<field name="property_account_expense_categ" ref="chart_skr04_5400"/> <field name="property_account_expense_categ" ref="chart_skr04_5400"/>
<field name="property_account_income_categ" ref="chart_skr04_4400"/> <field name="property_account_income_categ" ref="chart_skr04_4400"/>
</record> </record>

View File

@ -4201,8 +4201,8 @@
<field name="bank_account_view_id" ref="10"/> <field name="bank_account_view_id" ref="10"/>
<field name="property_account_receivable" ref="4"/> <field name="property_account_receivable" ref="4"/>
<field name="property_account_payable" ref="5"/> <field name="property_account_payable" ref="5"/>
<field name="property_account_expense_categ" ref="6"/> <field name="property_account_expense_categ" ref="60101"/>
<field name="property_account_income_categ" ref="7"/> <field name="property_account_income_categ" ref="710101"/>
</record> </record>
</data> </data>

View File

@ -3,7 +3,7 @@
<data noupdate="False"> <data noupdate="False">
<!-- Chart Template --> <!-- Chart Template -->
<!-- this file contains the base (common) data for all kinds <!-- this file contains the base (common) data for all kinds
of taxes, as well as the chart of accounts sum-up. of taxes, as well as the chart of accounts sum-up.
--> -->

View File

@ -155,7 +155,7 @@
<field name="code">IA_AC01161</field> <field name="code">IA_AC01161</field>
<field name="type">receivable</field> <field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/> <field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/> <field name="reconcile" eval="True"/>
<field name="parent_id" ref="IA_AC0116"/> <field name="parent_id" ref="IA_AC0116"/>
</record> </record>
@ -232,11 +232,11 @@
</record> </record>
<record model="account.account.template" id="IA_AC02131"> <record model="account.account.template" id="IA_AC02131">
<field name="name">Sundry Creditors</field> <field name="name">Sundry Creditors Account</field>
<field name="code">IA_AC02131</field> <field name="code">IA_AC02131</field>
<field name="type">payable</field> <field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/> <field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/> <field name="reconcile" eval="True"/>
<field name="parent_id" ref="IA_AC0213"/> <field name="parent_id" ref="IA_AC0213"/>
</record> </record>

View File

@ -50,7 +50,7 @@
<field name="code">1112</field> <field name="code">1112</field>
<field name="name">Input VAT</field> <field name="name">Input VAT</field>
<field ref="cli" name="parent_id"/> <field ref="cli" name="parent_id"/>
<field name="type">payable</field> <field name="type">other</field>
<field name="user_type" ref="account_type_liability"/> <field name="user_type" ref="account_type_liability"/>
</record> </record>
@ -124,7 +124,7 @@
<field name="code">11003</field> <field name="code">11003</field>
<field name="name">Output VAT</field> <field name="name">Output VAT</field>
<field ref="cas" name="parent_id"/> <field ref="cas" name="parent_id"/>
<field name="type">receivable</field> <field name="type">other</field>
<field name="user_type" ref="account_type_asset"/> <field name="user_type" ref="account_type_asset"/>
</record> </record>

View File

@ -246,7 +246,6 @@
<field name="name">Sales Credit Note Journal - (OpenERP IN)</field> <field name="name">Sales Credit Note Journal - (OpenERP IN)</field>
<field name="code">SCNJ-OpenERP IN</field> <field name="code">SCNJ-OpenERP IN</field>
<field name="type">sale_refund</field> <field name="type">sale_refund</field>
<field eval="True" name="refund_journal"/>
<field name="view_id" ref="account.account_sp_refund_journal_view"/> <field name="view_id" ref="account.account_sp_refund_journal_view"/>
<field name="sequence_id" ref="account.sequence_refund_sales_journal"/> <field name="sequence_id" ref="account.sequence_refund_sales_journal"/>
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/> <field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
@ -273,7 +272,6 @@
<field name="name">Expenses Credit Notes Journal - (OpenERP IN)</field> <field name="name">Expenses Credit Notes Journal - (OpenERP IN)</field>
<field name="code">ECNJ-OpenERP IN</field> <field name="code">ECNJ-OpenERP IN</field>
<field name="type">purchase_refund</field> <field name="type">purchase_refund</field>
<field eval="True" name="refund_journal"/>
<field name="view_id" ref="account.account_sp_refund_journal_view"/> <field name="view_id" ref="account.account_sp_refund_journal_view"/>
<field name="sequence_id" ref="account.sequence_refund_purchase_journal"/> <field name="sequence_id" ref="account.sequence_refund_purchase_journal"/>
<field model="account.account" name="default_debit_account_id" ref="account.a_expense"/> <field model="account.account" name="default_debit_account_id" ref="account.a_expense"/>
@ -340,7 +338,6 @@
<field name="name">Sales Credit Note Journal - (OpenERP US)</field> <field name="name">Sales Credit Note Journal - (OpenERP US)</field>
<field name="code">SCNJ-OpenERP US</field> <field name="code">SCNJ-OpenERP US</field>
<field name="type">sale_refund</field> <field name="type">sale_refund</field>
<field eval="True" name="refund_journal"/>
<field name="view_id" ref="account.account_sp_refund_journal_view"/> <field name="view_id" ref="account.account_sp_refund_journal_view"/>
<field name="sequence_id" ref="account.sequence_refund_sales_journal"/> <field name="sequence_id" ref="account.sequence_refund_sales_journal"/>
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/> <field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
@ -367,7 +364,6 @@
<field name="name">Expenses Credit Notes Journal - (OpenERP US)</field> <field name="name">Expenses Credit Notes Journal - (OpenERP US)</field>
<field name="code">ECNJ-OpenERP US</field> <field name="code">ECNJ-OpenERP US</field>
<field name="type">purchase_refund</field> <field name="type">purchase_refund</field>
<field eval="True" name="refund_journal"/>
<field name="view_id" ref="account.account_sp_refund_journal_view"/> <field name="view_id" ref="account.account_sp_refund_journal_view"/>
<field name="sequence_id" ref="account.sequence_refund_purchase_journal"/> <field name="sequence_id" ref="account.sequence_refund_purchase_journal"/>
<field model="account.account" name="default_debit_account_id" ref="account.a_expense"/> <field model="account.account" name="default_debit_account_id" ref="account.a_expense"/>
@ -435,7 +431,6 @@
<field name="name">Sales Credit Note Journal - (OpenERP BE)</field> <field name="name">Sales Credit Note Journal - (OpenERP BE)</field>
<field name="code">SCNJ-OpenERP BE</field> <field name="code">SCNJ-OpenERP BE</field>
<field name="type">sale_refund</field> <field name="type">sale_refund</field>
<field eval="True" name="refund_journal"/>
<field name="view_id" ref="account.account_sp_refund_journal_view"/> <field name="view_id" ref="account.account_sp_refund_journal_view"/>
<field name="sequence_id" ref="account.sequence_refund_sales_journal"/> <field name="sequence_id" ref="account.sequence_refund_sales_journal"/>
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/> <field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
@ -462,7 +457,6 @@
<field name="name">Expenses Credit Notes Journal - (OpenERP BE)</field> <field name="name">Expenses Credit Notes Journal - (OpenERP BE)</field>
<field name="code">ECNJ-OpenERP BE</field> <field name="code">ECNJ-OpenERP BE</field>
<field name="type">purchase_refund</field> <field name="type">purchase_refund</field>
<field eval="True" name="refund_journal"/>
<field name="view_id" ref="account.account_sp_refund_journal_view"/> <field name="view_id" ref="account.account_sp_refund_journal_view"/>
<field name="sequence_id" ref="account.sequence_refund_purchase_journal"/> <field name="sequence_id" ref="account.sequence_refund_purchase_journal"/>
<field model="account.account" name="default_debit_account_id" ref="account.a_expense"/> <field model="account.account" name="default_debit_account_id" ref="account.a_expense"/>

View File

@ -70,6 +70,7 @@ class pos_order(osv.osv):
return super(pos_order, self).unlink(cr, uid, ids, context=context) return super(pos_order, self).unlink(cr, uid, ids, context=context)
def onchange_partner_pricelist(self, cr, uid, ids, part=False, context=None): def onchange_partner_pricelist(self, cr, uid, ids, part=False, context=None):
""" Changed price list on_change of partner_id""" """ Changed price list on_change of partner_id"""
if not part: if not part:
return {'value': {}} return {'value': {}}
@ -422,7 +423,7 @@ class pos_order(osv.osv):
"""Create a picking for each order and validate it.""" """Create a picking for each order and validate it."""
picking_obj = self.pool.get('stock.picking') picking_obj = self.pool.get('stock.picking')
property_obj = self.pool.get("ir.property") property_obj = self.pool.get("ir.property")
move_obj=self.pool.get('stock.move') move_obj = self.pool.get('stock.move')
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out') pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
orders = self.browse(cr, uid, ids, context=context) orders = self.browse(cr, uid, ids, context=context)
for order in orders: for order in orders:
@ -463,7 +464,6 @@ class pos_order(osv.osv):
stock_dest_id = val.id stock_dest_id = val.id
if line.qty < 0: if line.qty < 0:
location_id, stock_dest_id = stock_dest_id, location_id location_id, stock_dest_id = stock_dest_id, location_id
move_obj.create(cr, uid, { move_obj.create(cr, uid, {
'name': '(POS %d)' % (order.id, ), 'name': '(POS %d)' % (order.id, ),
'product_uom': line.product_id.uom_id.id, 'product_uom': line.product_id.uom_id.id,
@ -477,6 +477,7 @@ class pos_order(osv.osv):
'state': 'waiting', 'state': 'waiting',
'location_id': location_id, 'location_id': location_id,
'location_dest_id': stock_dest_id, 'location_dest_id': stock_dest_id,
'prodlot_id': line.prodlot_id and line.prodlot_id.id or False
}, context=context) }, context=context)
wf_service = netsvc.LocalService("workflow") wf_service = netsvc.LocalService("workflow")
@ -647,6 +648,7 @@ class pos_order(osv.osv):
'reference': order.name, 'reference': order.name,
'partner_id': order.partner_id.id, 'partner_id': order.partner_id.id,
'comment': order.note or '', 'comment': order.note or '',
'currency_id': order.pricelist_id.currency_id.id, # considering partner's sale pricelist's currency
} }
inv.update(inv_ref.onchange_partner_id(cr, uid, [], 'out_invoice', order.partner_id.id)['value']) inv.update(inv_ref.onchange_partner_id(cr, uid, [], 'out_invoice', order.partner_id.id)['value'])
if not inv.get('account_id', None): if not inv.get('account_id', None):
@ -1145,6 +1147,7 @@ class pos_order_line(osv.osv):
'discount': fields.float('Discount (%)', digits=(16, 2)), 'discount': fields.float('Discount (%)', digits=(16, 2)),
'order_id': fields.many2one('pos.order', 'Order Ref', ondelete='cascade'), 'order_id': fields.many2one('pos.order', 'Order Ref', ondelete='cascade'),
'create_date': fields.datetime('Creation Date', readonly=True), 'create_date': fields.datetime('Creation Date', readonly=True),
'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot', help="You can specify Production lot for stock move created when you validate the pos order"),
} }
_defaults = { _defaults = {

View File

@ -41,6 +41,7 @@
<field name="price_unit"/> <field name="price_unit"/>
<field name="notice"/> <field name="notice"/>
<field name="serial_number"/> <field name="serial_number"/>
<field name="prodlot_id" domain="[('product_id','=',product_id)]"/>
</form> </form>
</field> </field>
<group colspan="4" col="7"> <group colspan="4" col="7">
@ -88,7 +89,7 @@
</group> </group>
<group colspan="4"> <group colspan="4">
<field name="sale_journal" domain="[('type','=','sale')]" widget="selection" invisible="1"/> <field name="sale_journal" domain="[('type','=','sale')]" widget="selection" invisible="1"/>
<field name="pricelist_id" domain="[('type','=','sale')]" widget="selection" invisible="1"/> <field name="pricelist_id" domain="[('type','=','sale')]" widget="selection" invisible="0"/>
</group> </group>
</page> </page>
<page string="Notes" > <page string="Notes" >