[IMP] account: Don't raise errors if account currency = base currency
Steps to Reproduce: - Company set in USD - Customer Invoices journal set in USD - Related account set in USD - Create an invoice, validate It raises an error: "The selected account of your Journal Entry forces to provide a secondary currency. You should remove the secondary currency on the account." The error should be raised if the currencies are different. It should be transparent to the user if the currencies are the same. It should raise an error when: - The journal currency' and Currency of Accounts Selected on Journal are different - The journal currency is blank (by default company currency) and the account currency is other than company currency + Some wording improvements
This commit is contained in:
committed by
Yannick Tivisse
parent
c8f5c193a2
commit
6e01dd43ca
@@ -97,7 +97,7 @@ class AccountAccount(models.Model):
|
||||
|
||||
name = fields.Char(required=True, index=True)
|
||||
currency_id = fields.Many2one('res.currency', string='Account Currency',
|
||||
help="Forces all moves for this account to have this account currency.")
|
||||
help="Forces all moves for this account to have this secondary currency.")
|
||||
code = fields.Char(size=64, required=True, index=True)
|
||||
deprecated = fields.Boolean(index=True, default=False)
|
||||
user_type_id = fields.Many2one('account.account.type', string='Type', required=True, oldname="user_type",
|
||||
|
||||
@@ -410,8 +410,8 @@ class AccountMoveLine(models.Model):
|
||||
def _check_currency(self):
|
||||
for line in self:
|
||||
if line.account_id.currency_id:
|
||||
if not line.currency_id or line.currency_id.id != line.account_id.currency_id.id:
|
||||
raise ValidationError(_('The selected account of your Journal Entry forces to provide a secondary currency. You should remove the secondary currency on the account.'))
|
||||
if not line.journal_id.currency_id and line.company_id.currency_id.id != line.account_id.currency_id.id or line.journal_id.currency_id.id != line.account_id.currency_id.id:
|
||||
raise ValidationError(_('The selected account of your Journal Entry force to provide a secondary currency. You should either remove the secondary currency on the account or match the currency of your journal with your account currency.'))
|
||||
|
||||
@api.multi
|
||||
@api.constrains('currency_id', 'amount_currency')
|
||||
|
||||
Reference in New Issue
Block a user