6
6
from odoo .exceptions import ValidationError
7
7
8
8
9
- class AccountJournal (models .Model ):
10
- _inherit = "account.journal "
9
+ class ResCompany (models .Model ):
10
+ _inherit = "res.company "
11
11
12
12
donation_debit_order_account_id = fields .Many2one (
13
13
"account.account" ,
14
14
check_company = True ,
15
15
copy = False ,
16
16
ondelete = "restrict" ,
17
- domain = "[('reconcile', '=', True), ('deprecated', '=', False), "
18
- "('company_id', '=', company_id), "
19
- "('account_type', '=', 'asset_receivable'), "
20
- "('id', 'not in', (default_account_id, suspense_account_id))]" ,
17
+ # domain is in res.config.settings
18
+ # domain="[('reconcile', '=', True), ('deprecated', '=', False), "
19
+ # "('company_id', '=', company_id), "
20
+ # "('account_type', '=', 'asset_receivable'), "
21
+ # "('id', 'not in', (default_account_id, suspense_account_id))]",
21
22
string = "Donation by Debit Order Account" ,
22
23
help = "Transfer account for donations by debit order. "
23
24
"Leave empty if you don't handle donations by debit order on this bank account."
@@ -31,27 +32,27 @@ def _check_donation_accounts(self):
31
32
"account_type"
32
33
]["selection" ]
33
34
)
34
- for journal in self :
35
- ddo_account = journal .donation_debit_order_account_id
35
+ for company in self :
36
+ ddo_account = company .donation_debit_order_account_id
36
37
if ddo_account :
37
38
if not ddo_account .reconcile :
38
39
raise ValidationError (
39
40
_ (
40
- "The Donation by Debit Order Account of journal "
41
- "'%(journal )s' must be reconciliable, but the account "
41
+ "The Donation by Debit Order Account of company "
42
+ "'%(company )s' must be reconciliable, but the account "
42
43
"'%(account)s' is not reconciliable." ,
43
- journal = journal .display_name ,
44
+ company = company .display_name ,
44
45
account = ddo_account .display_name ,
45
46
)
46
47
)
47
48
if ddo_account .account_type != "asset_receivable" :
48
49
raise ValidationError (
49
50
_ (
50
- "The Donation by Debit Order Account of journal "
51
- "'%(journal )s' must be a receivable account, "
51
+ "The Donation by Debit Order Account of company "
52
+ "'%(company )s' must be a receivable account, "
52
53
"but the account '%(account)s' is configured with "
53
54
"account type '%(account_type)s'." ,
54
- journal = journal .display_name ,
55
+ company = company .display_name ,
55
56
account = ddo_account .display_name ,
56
57
account_type = acc_type2label [ddo_account .account_type ],
57
58
)
0 commit comments