mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[IMP] formatting
This commit is contained in:
@@ -35,7 +35,8 @@ class AccountMove(Model):
|
|||||||
|
|
||||||
_constraints = [
|
_constraints = [
|
||||||
(_check_fiscal_year,
|
(_check_fiscal_year,
|
||||||
'You cannot create entries with date not in the fiscal year of the chosen period',
|
'You cannot create entries with date not in the '
|
||||||
|
'fiscal year of the chosen period',
|
||||||
['line_id']),
|
['line_id']),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -45,14 +46,16 @@ class AccountMoveLine(Model):
|
|||||||
|
|
||||||
def _check_currency_and_amount(self, cr, uid, ids, context=None):
|
def _check_currency_and_amount(self, cr, uid, ids, context=None):
|
||||||
for l in self.browse(cr, uid, ids, context=context):
|
for l in self.browse(cr, uid, ids, context=context):
|
||||||
if (l.currency_id and not l.amount_currency) or (not l.currency_id and l.amount_currency):
|
if ((l.currency_id and not l.amount_currency) or
|
||||||
|
(not l.currency_id and l.amount_currency)):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _check_currency_amount(self, cr, uid, ids, context=None):
|
def _check_currency_amount(self, cr, uid, ids, context=None):
|
||||||
for l in self.browse(cr, uid, ids, context=context):
|
for l in self.browse(cr, uid, ids, context=context):
|
||||||
if l.amount_currency:
|
if l.amount_currency:
|
||||||
if (l.amount_currency > 0.0 and l.credit > 0.0) or (l.amount_currency < 0.0 and l.debit > 0.0):
|
if ((l.amount_currency > 0.0 and l.credit > 0.0) or
|
||||||
|
(l.amount_currency < 0.0 and l.debit > 0.0)):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -63,21 +66,20 @@ class AccountMoveLine(Model):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
_constraints = [
|
_constraints = [
|
||||||
(
|
(_check_currency_and_amount,
|
||||||
_check_currency_and_amount,
|
"You cannot create journal items with a secondary currency "
|
||||||
"You cannot create journal items with a secondary currency without "
|
"without recording both 'currency' and 'amount currency' field.",
|
||||||
"recording both 'currency' and 'amount currency' field.",
|
|
||||||
['currency_id','amountount_currency']
|
['currency_id','amountount_currency']
|
||||||
),
|
),
|
||||||
(
|
(_check_currency_amount,
|
||||||
_check_currency_amount,
|
"The amount expressed in the secondary currency must be positive "
|
||||||
"The amount expressed in the secondary currency must be positif when journal item "
|
"when journal item are debit and negatif when journal item are "
|
||||||
"are debit and negatif when journal item are credit.",
|
"credit.",
|
||||||
['amount_currency']
|
['amount_currency']
|
||||||
),
|
),
|
||||||
(
|
(_check_currency_company,
|
||||||
_check_currency_company,
|
"You can't provide a secondary currency if "
|
||||||
"You can't provide a secondary currency if the same than the company one." ,
|
"the same than the company one.",
|
||||||
['currency_id']
|
['currency_id']
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user