[MERGE, IMP] merge with mma branch and small improvement
bzr revid: psi@tinyerp.com-20120816071452-5gl39inc3lwkh4wl
This commit is contained in:
commit
05609f24ff
|
@ -102,9 +102,9 @@ class hr_expense_expense(osv.osv):
|
||||||
|
|
||||||
def onchange_currency_id(self, cr, uid, ids, currency_id=False, company_id=False, context=None):
|
def onchange_currency_id(self, cr, uid, ids, currency_id=False, company_id=False, context=None):
|
||||||
res = {'value': {'journal_id': False}}
|
res = {'value': {'journal_id': False}}
|
||||||
journal = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase'), ('currency','=',currency_id), ('company_id', '=', company_id)], context=context)
|
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase'), ('currency','=',currency_id), ('company_id', '=', company_id)], context=context)
|
||||||
if journal:
|
if journal_ids:
|
||||||
res['value']['journal_id'] = journal[0]
|
res['value']['journal_id'] = journal_ids[0]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
|
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
|
||||||
|
@ -168,11 +168,12 @@ class hr_expense_expense(osv.osv):
|
||||||
acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context={'force_company': company_id})
|
acc = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context={'force_company': company_id})
|
||||||
if not acc:
|
if not acc:
|
||||||
raise osv.except_osv(_('Error!'), _('Please configure Default Expense account for Product purchase: `property_account_expense_categ`.'))
|
raise osv.except_osv(_('Error!'), _('Please configure Default Expense account for Product purchase: `property_account_expense_categ`.'))
|
||||||
total_amount = 0.0
|
|
||||||
if journal.currency and exp.currency_id.id != journal.currency.id:
|
|
||||||
total_amount = currency_obj.compute(cr, uid, exp.currency_id.id, journal.currency.id, line.total_amount, context=ctx)
|
|
||||||
else:
|
|
||||||
total_amount = line.total_amount
|
total_amount = line.total_amount
|
||||||
|
if journal.currency:
|
||||||
|
if exp.currency_id != journal.currency:
|
||||||
|
total_amount = currency_obj.compute(cr, uid, exp.currency_id.id, journal.currency.id, total_amount, context=ctx)
|
||||||
|
elif exp.currency_id != exp.company_id.currency_id:
|
||||||
|
total_amount = currency_obj.compute(cr, uid, exp.currency_id.id, exp.company_id.currency_id.id, total_amount, context=ctx)
|
||||||
lines.append((0, False, {
|
lines.append((0, False, {
|
||||||
'name': line.name,
|
'name': line.name,
|
||||||
'account_id': acc.id,
|
'account_id': acc.id,
|
||||||
|
|
Loading…
Reference in New Issue