~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to account_override/__init__.py

UF-359 [FIX] Bad repercutions on engagement journal: amounts are positive

- correct engagement journal to take part of analytic lines creation

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#
22
22
##############################################################################
23
23
 
24
 
ACCOUNT_RESTRICTED_AREA = {
25
 
    # REGISTER LINES
26
 
    'register_lines': [
27
 
        ('type', '!=', 'view'),
28
 
        ('is_not_hq_correctible', '!=', True),
29
 
        '|', ('type', '!=', 'liquidity'), ('user_type_code', '!=', 'cash'), # Do not allow Liquidity / Cash accounts
30
 
        '|', ('type', '!=', 'other'), ('user_type_code', '!=', 'stock'), # Do not allow Regular / Stock accounts
31
 
        '|', ('user_type_code', '!=', 'expense'), ('user_type.report_type', '!=', 'none'), # Disallow extra-accounting expenses accounts
32
 
    ],
33
 
    # CASH RETURN - ADVANCE LINES
34
 
    'cash_return': [
35
 
        ('type', '!=', 'view'),
36
 
        ('user_type_code', 'in', ['income', 'expense']),
37
 
        ('user_type_report_type', '!=', 'none'),
38
 
        ('is_not_hq_correctible', '=', False),
39
 
    ],
40
 
    # HEADER OF:
41
 
    #+ Supplier Invoice
42
 
    #+ Direct Invoice
43
 
    #+ Supplier refund
44
 
   'in_invoice': [
45
 
        ('type', '!=', 'view'),
46
 
        # Either Payable/Payables accounts or Regular / Debt accounts
47
 
        '|', '&', ('type', '=', 'payable'), ('user_type_code', '=', 'payables'), '&', ('type', '=', 'other'), ('user_type_code', 'in', ['debt','cash']),
48
 
        ('type_for_register', '!=', 'donation'),
49
 
    ],
50
 
    # HEADER OF:
51
 
    #+ Stock Transfer Voucher
52
 
    #+ Customer Refund
53
 
    #+ Debit Notes
54
 
    'out_invoice': [
55
 
        ('type', '!=', 'view'),
56
 
        # Either Receivable/Receivables accounts or Regular / Cash accounts
57
 
        '|', '&', ('type', '=', 'receivable'), ('user_type_code', 'in', ['receivables','cash']), '&', ('type', '=', 'other'), ('user_type_code', '=', 'cash'),
58
 
    ],
59
 
    # HEADER OF donation
60
 
    'donation_header': [
61
 
        ('type', '!=', 'view'),
62
 
        ('user_type_code', '=', 'payables'),
63
 
        ('type', '=', 'payable'),
64
 
        ('type_for_register', '=', 'donation'),
65
 
    ],
66
 
    # LINES OF:
67
 
    #+ Supplier invoice
68
 
    #+ Direct invoice
69
 
    #+ Supplier refund
70
 
    #+ Stock transfer voucher
71
 
    #+ Customer refund
72
 
    #+ Debit notes
73
 
    'invoice_lines': [
74
 
        ('type', 'not in', ['view', 'liquidity']), # Do not allow liquidity accounts
75
 
        ('is_not_hq_correctible', '!=', True),
76
 
        '|', ('type', '!=', 'other'), ('user_type_code', '!=', 'stock'), # Do not allow Regular / Stock accounts
77
 
        '|', ('user_type_code', '!=', 'expense'), ('user_type.report_type', '!=', 'none'), # Disallow extra-accounting expenses accounts
78
 
    ],
79
 
    # LINES OF donation
80
 
    'donation_lines': [
81
 
        ('type', '!=', 'view'),
82
 
        ('type', '=', 'other'),
83
 
        ('user_type_code', '=', 'expense'),
84
 
        ('user_type.report_type', '=', 'none'), # Only extra-accounting expenses
85
 
        ('type_for_register', '=', 'donation'),
86
 
    ],
87
 
    # Commitment voucher lines
88
 
    'commitment_lines': [
89
 
        ('type', '!=', 'view'),
90
 
        ('user_type_code', '=', 'expense'),
91
 
        '|', ('user_type_code', '!=', 'expense'), ('user_type.report_type', '!=', 'none'), # To only use Expense extra-accounting accounts
92
 
    ],
93
 
    # HEADER OF Intermission Voucher IN/OUT
94
 
    'intermission_header': [
95
 
        ('is_intermission_counterpart', '=', True),
96
 
    ],
97
 
    # LINES OF intermission vouchers
98
 
    'intermission_lines': [
99
 
        ('type', '!=', 'view'),
100
 
        ('is_not_hq_correctible', '=', False),
101
 
        ('user_type_code', '=', 'expense'),
102
 
        ('user_type.report_type', '!=', 'none'), # To only use Expense extra-accounting accounts
103
 
    ],
104
 
    # RECURRING MODELS
105
 
    'recurring_lines': [
106
 
        ('type', '!=', 'view'),
107
 
        ('is_not_hq_correctible', '=', False),
108
 
        '|', '&', ('user_type_code', '=', 'receivables'), ('type', '=', 'receivable'), '&', ('user_type_code', '=', 'expense'), ('user_type.report_type', '!=', 'none'), # Receivable/Receivable allowed + expense accounts (without extra-accounting) allowed
109
 
    ],
110
 
    # ACCRUALS - expense field
111
 
    'accruals': [
112
 
        ('type', '!=', 'view'),
113
 
        ('is_not_hq_correctible', '=', False),
114
 
        ('user_type_code', '=', 'expense'),
115
 
        '|', ('user_type_code', '!=', 'expense'), ('user_type.report_type', '!=', 'none'), # Do not allow extra-expense accounts
116
 
    ],
117
 
    # ACCRUALS - accrual field
118
 
    'accruals_accrual': [
119
 
        ('type', '!=', 'view'),
120
 
        ('is_not_hq_correctible', '=', False),
121
 
        ('accrual_account', '=', True),
122
 
    ],
123
 
    # PAYROLLS
124
 
    'payroll_lines': [
125
 
        ('type', '!=', 'view'),
126
 
        ('user_type_code', 'in', ['income', 'expense']),
127
 
        ('user_type_report_type', '!=', 'none'),
128
 
        ('is_not_hq_correctible', '=', False),
129
 
    ],
130
 
    # HQ ENTRIES
131
 
    'hq_lines': [
132
 
        ('type', '!=', 'view'),
133
 
        ('user_type_code', '=', 'expense'),
134
 
        '|', ('user_type_code', '!=', 'expense'), ('user_type.report_type', '!=', 'none'), # Exclude non-extra accounting expense accounts
135
 
        #('is_not_hq_correctible', '=', False), # UF-2312: not possibleto add this domain because WE SHOULD ALLOW "Not HQ Correctible" account during the import
136
 
    ],
137
 
    # MANUEL JOURNAL ENTRIES
138
 
    'account_move_lines': [
139
 
        ('type', 'not in', ['view', 'consolidation', 'closed']),
140
 
        '|', ('type', '!=', 'liquidity'), ('user_type_code', '!=', 'cash'), # Do not allow Liquidity / Cash accounts
141
 
        ('is_not_hq_correctible', '=', False),
142
 
    ],
143
 
    # FINANCING CONTRACT - REPORTING LINES
144
 
    'contract_reporting_lines': [
145
 
        ('account_id.user_type_code', 'in', ['income', 'expense']),
146
 
        ('account_id.user_type_report_type', '!=', 'none'),
147
 
    ],
148
 
    # PARTNER - DONATION DEFAULT ACCOUNT
149
 
    'partner_donation': [
150
 
        ('type', '!=', 'view'),
151
 
        ('type', '=', 'payable'),
152
 
        ('user_type_code', '=', 'payables'),
153
 
        ('type_for_register', '=', 'donation'),
154
 
    ],
155
 
    # PARTNER - PAYABLE DEFAULT ACCOUNT
156
 
    'partner_payable': [
157
 
        ('type', '!=', 'view'),
158
 
        ('type', 'in', ['payable','other']),
159
 
        ('user_type_code', 'in', ['payables', 'tax','cash']),
160
 
        ('type_for_register', '!=', 'donation'),
161
 
    ],
162
 
    # PARTNER - RECEIVABLE DEFAULT ACCOUNT
163
 
    'partner_receivable': [
164
 
        ('type', '!=', 'view'),
165
 
        # Either Receivable accounts or Regular / Cash accounts
166
 
        '|', ('type', '=', 'receivable'), '&', ('type', '=', 'other'), ('user_type_code', '=', 'cash'),
167
 
    ],
168
 
    # PRODUCT - DONATION ACCOUNT
169
 
    'product_donation': [
170
 
        ('type', '!=', 'view'),
171
 
        ('user_type_code', '=', 'expense'),
172
 
        ('type_for_register', '=', 'donation'),
173
 
    ],
174
 
    # PRODUCT CATEGORY - DONATION ACCOUNT
175
 
    'product_category_donation': [
176
 
        ('type', '!=', 'view'),
177
 
        ('user_type_code', '=', 'expense'),
178
 
        ('type_for_register', '=', 'donation'),
179
 
    ],
180
 
    # JOURNALS
181
 
    'journals': [
182
 
        ('type', '!=', 'view'),
183
 
        ('user_type_code', '=', 'cash'),
184
 
        ('type', '=', 'liquidity'),
185
 
    ],
186
 
    # CORRECTION WIZARD LINES
187
 
    'correction_wizard': [
188
 
        ('type', '!=', 'view'),
189
 
        ('is_not_hq_correctible', '=', False), # Do not allow user to select accounts with "Not HQ correctible" set to True
190
 
        ('code', '<', '80000'),  # UTP-1187 exclude 8/9 accounts
191
 
        ('code', 'not in', ['10100', '10200', '10210']),  # UTP-1187 exclude liquidity / cash (10100, 10200, 10210) accounts
192
 
        ('is_not_hq_correctible', '!=', True)  # UTP-1187 exclude with the "Can not be corrected on HQ entries" attribute set to "True" accounts
193
 
    ],
194
 
}
195
 
 
196
 
import res_company
197
 
import res_currency
198
 
import res_partner
199
 
import period
200
24
import account
201
25
import invoice
202
 
import product
203
26
import account_move_line
204
27
import account_analytic_line
205
 
import account_bank_statement
206
 
import report
207
 
import wizard
208
 
import finance_export
 
28
 
209
29
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: