return False
return True
+ def _check_currency(self, cr, uid, ids, context=None):
+ for l in self.browse(cr, uid, ids, context=context):
+ if l.account_id.currency_id:
+ if not l.currency_id or not l.currency_id.id == l.account_id.currency_id.id:
+ return False
+ return True
+
_constraints = [
(_check_no_view, 'You can not create move line on view account.', ['account_id']),
(_check_no_closed, 'You can not create move line on closed account.', ['account_id']),
- (_check_company_id, 'Company must be same for its related account and period.',['company_id'] ),
- (_check_date, 'The date of your Journal Entry is not in the defined period!',['date'] ),
+ (_check_company_id, 'Company must be same for its related account and period.', ['company_id']),
+ (_check_date, 'The date of your Journal Entry is not in the defined period!', ['date']),
+ (_check_currency, 'The selected account of your Journal Entry must receive a value in its secondary currency', ['currency_id']),
]
#TODO: ONCHANGE_ACCOUNT_ID: set account_tax_id
company_list.append(line.company_id.id)
for line in self.browse(cr, uid, ids, context=context):
- company_currency_id = line.company_id.currency_id
+ if line.account_id.currency_id:
+ currency_id = line.account_id.currency_id
+ else:
+ currency_id = line.company_id.currency_id
if line.reconcile_id:
raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
if line.reconcile_partial_id:
total += line.amount_currency
else:
total += (line.debit or 0.0) - (line.credit or 0.0)
- if self.pool.get('res.currency').is_zero(cr, uid, company_currency_id, total):
+ if self.pool.get('res.currency').is_zero(cr, uid, currency_id, total):
res = self.reconcile(cr, uid, merges+unmerge, context=context, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id)
return res
r_id = move_rec_obj.create(cr, uid, {