[IMP] Account : in multi chart installation missing Sales refund journal and Purchase refund journal

[FIX] hr : in search view of Allocation request get department_id from context

bzr revid: vth@tinyerp.com-20101103051853-ui4rknxzjpamcmb0
This commit is contained in:
vth 2010-11-03 10:48:53 +05:30
parent c70d2c9a54
commit 416a89c87c
2 changed files with 63 additions and 1 deletions

View File

@ -2708,9 +2708,17 @@ class wizard_multi_charts_accounts(osv.osv_memory):
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
@ -2749,6 +2757,60 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_journal.create(cr,uid,vals_journal)
# 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 = obj_data.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
}
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_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)
# 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
}
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_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)
# Bank Journals
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])

View File

@ -24,7 +24,7 @@
domain="[('employee_id.user_id','=', uid)]"
help="My Leaves" />
</field>
<field name="department_id" widget="selection">
<field name="department_id" widget="selection" default="context.get('department_id', False)" >
<filter icon="terp-personal+" help="My Department Holidays"
domain="[('department_id.manager_id','=',uid)]" />
</field>