Merge lp:~camptocamp/banking-addons/bank-statement-ext_report_lang into lp:banking-addons/6.1
- bank-statement-ext_report_lang
- Merge into 6.1
Status: | Superseded |
---|---|
Proposed branch: | lp:~camptocamp/banking-addons/bank-statement-ext_report_lang |
Merge into: | lp:banking-addons/6.1 |
Diff against target: |
8071 lines (+7614/-0) 85 files modified
account_advanced_reconcile/__init__.py (+24/-0) account_advanced_reconcile/__openerp__.py (+83/-0) account_advanced_reconcile/advanced_reconciliation.py (+118/-0) account_advanced_reconcile/base_advanced_reconciliation.py (+272/-0) account_advanced_reconcile/easy_reconcile.py (+36/-0) account_advanced_reconcile/easy_reconcile_view.xml (+19/-0) account_advanced_reconcile/i18n/fr.po (+91/-0) account_easy_reconcile/__init__.py (+25/-0) account_easy_reconcile/__openerp__.py (+66/-0) account_easy_reconcile/base_reconciliation.py (+208/-0) account_easy_reconcile/easy_reconcile.py (+285/-0) account_easy_reconcile/easy_reconcile.xml (+156/-0) account_easy_reconcile/easy_reconcile_history.py (+153/-0) account_easy_reconcile/easy_reconcile_history_view.xml (+98/-0) account_easy_reconcile/i18n/fr.po (+425/-0) account_easy_reconcile/security/ir.model.access.csv (+15/-0) account_easy_reconcile/security/ir_rule.xml (+25/-0) account_easy_reconcile/simple_reconciliation.py (+120/-0) account_statement_base_completion/__init__.py (+23/-0) account_statement_base_completion/__openerp__.py (+74/-0) account_statement_base_completion/data.xml (+37/-0) account_statement_base_completion/i18n/fr.po (+180/-0) account_statement_base_completion/partner.py (+38/-0) account_statement_base_completion/partner_view.xml (+22/-0) account_statement_base_completion/security/ir.model.access.csv (+3/-0) account_statement_base_completion/statement.py (+527/-0) account_statement_base_completion/statement_view.xml (+104/-0) account_statement_base_import/__init__.py (+23/-0) account_statement_base_import/__openerp__.py (+70/-0) account_statement_base_import/data/statement.csv (+4/-0) account_statement_base_import/i18n/fr.po (+253/-0) account_statement_base_import/parser/__init__.py (+25/-0) account_statement_base_import/parser/file_parser.py (+218/-0) account_statement_base_import/parser/generic_file_parser.py (+102/-0) account_statement_base_import/parser/parser.py (+219/-0) account_statement_base_import/statement.py (+303/-0) account_statement_base_import/statement_view.xml (+46/-0) account_statement_base_import/wizard/__init__.py (+20/-0) account_statement_base_import/wizard/import_statement.py (+122/-0) account_statement_base_import/wizard/import_statement_view.xml (+44/-0) account_statement_completion_voucher/__init__.py (+20/-0) account_statement_completion_voucher/__openerp__.py (+46/-0) account_statement_completion_voucher/statement_view.xml (+21/-0) account_statement_ext/__init__.py (+25/-0) account_statement_ext/__openerp__.py (+88/-0) account_statement_ext/account.py (+38/-0) account_statement_ext/i18n/fr.po (+301/-0) account_statement_ext/report.xml (+25/-0) account_statement_ext/report/__init__.py (+26/-0) account_statement_ext/report/bank_statement_report.mako (+69/-0) account_statement_ext/report/bank_statement_report.py (+71/-0) account_statement_ext/report/bank_statement_webkit_header.xml (+180/-0) account_statement_ext/security/ir.model.access.csv (+3/-0) account_statement_ext/security/ir_rule.xml (+10/-0) account_statement_ext/statement.py (+678/-0) account_statement_ext/statement_view.xml (+162/-0) account_statement_ext/voucher.py (+49/-0) account_statement_ext_voucher/__init__.py (+20/-0) account_statement_ext_voucher/__openerp__.py (+52/-0) account_statement_ext_voucher/statement_voucher.py (+51/-0) account_statement_transactionid_completion/__init__.py (+22/-0) account_statement_transactionid_completion/__openerp__.py (+56/-0) account_statement_transactionid_completion/data.xml (+12/-0) account_statement_transactionid_completion/statement.py (+94/-0) account_statement_transactionid_completion/statement_view.xml (+22/-0) account_statement_transactionid_import/__init__.py (+22/-0) account_statement_transactionid_import/__openerp__.py (+60/-0) account_statement_transactionid_import/data/statement.csv (+4/-0) account_statement_transactionid_import/parser/__init__.py (+22/-0) account_statement_transactionid_import/parser/transactionid_file_parser.py (+86/-0) account_statement_transactionid_import/statement.py (+47/-0) base_transaction_id/__init__.py (+24/-0) base_transaction_id/__openerp__.py (+57/-0) base_transaction_id/invoice.py (+36/-0) base_transaction_id/invoice_view.xml (+30/-0) base_transaction_id/sale.py (+43/-0) base_transaction_id/sale_view.xml (+21/-0) base_transaction_id/stock.py (+42/-0) invoicing_voucher_killer/__init__.py (+20/-0) invoicing_voucher_killer/__openerp__.py (+39/-0) invoicing_voucher_killer/invoice_data.xml (+7/-0) invoicing_voucher_killer/invoice_view.xml (+48/-0) statement_voucher_killer/__init__.py (+21/-0) statement_voucher_killer/__openerp__.py (+40/-0) statement_voucher_killer/voucher.py (+128/-0) |
To merge this branch: | bzr merge lp:~camptocamp/banking-addons/bank-statement-ext_report_lang |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Banking Addons Core Editors | Pending | ||
Review via email:
|
This proposal supersedes a proposal from 2013-07-17.
This proposal has been superseded by a proposal from 2013-07-17.
Commit message
Description of the change
This fix take the language on the partner linked to the current user, for the bank statement report
Unmerged revisions
- 94. By Vincent Renaville@camptocamp
-
[FIX] fix report lang
- 93. By Vincent Renaville@camptocamp
-
[MRG] prevent account_
advanced_ reconcile to crash if ref in the move is not set - 92. By Nicolas Bessi - Camptocamp
-
[MRG] [FIX] Restore default period in bank statement by taking context in account
- 91. By Nicolas Bessi - Camptocamp
-
[MRG] [IMP] Refine partner label lookup error message
[FIX] Restore error message in log
[FIX] Fix partner label lookup regexp - 90. By Nicolas Bessi - Camptocamp
-
[MRG] Major refactoring of statement import and completion:
Fix the way to look default account on partner:
- If master account is provided in profile it will be forced
- If the customer checkbox is checked on the found partner, type and account will be customer and receivable
- If the supplier checkbox is checked on the found partner, type and account will be supplier and payable
- If both checkbox are checked or none of them, it'll be based on the amount :
If amount is positif the type and account will be customer and receivable,
If amount is negativ, the type and account will be supplier and payableCompletion:
-Fix and refactor the the invoices lookup for completion
-Various fixes in completion rules
- Non matches lines are not mark as completed.Optimisation:
Refactoring of statement import:
We by pass ORM to increase performances.
TODO support of sparse fieldRefactoring of completion.
We have done some structural changes in order to avoid a lot of un needed call to ORM.
Bypass orm when writing to database.These merge is required in order to fix transaction id completion rules and import +
Handle the new semantic change in OpenERP partner model - 89. By Alexandre Fayolle - camptocamp
-
[FIX] permissions on account.
statement. profil: an accountant needs write access on the model to be able to import a bank statement otherwise, the message.post call fails
- 88. By Nicolas Bessi - Camptocamp
-
[MRG] Fixes performance trouble when using bank_statement_
label based completion rules by using memoizer pattern. Add lines in context to be able to acces them in completion rules. It is not
mandatory as we can do line.satement_id.line_ ids but it is more efficient. Some minor cleanup
- 87. By Nicolas Bessi - Camptocamp
-
[MRG] Improve statement import wizard by using mass writing of statement line in order to avoid store field loop computation.
- 86. By Nicolas Bessi - Camptocamp
-
[MRG] Improve statement import global usability by retuning usable error message while parsing files.
Allows empty value for float in parsed CSV.Added note about the additional dependency on python-xlrd in the description.
- 85. By Nicolas Bessi - Camptocamp
-
[MRG] Add a completion rule to allows supplier invoice completion baser on invoice number
Preview Diff
1 | === added directory 'account_advanced_reconcile' | |||
2 | === added file 'account_advanced_reconcile/__init__.py' | |||
3 | --- account_advanced_reconcile/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ account_advanced_reconcile/__init__.py 2013-07-17 14:55:41 +0000 | |||
5 | @@ -0,0 +1,24 @@ | |||
6 | 1 | # -*- coding: utf-8 -*- | ||
7 | 2 | ############################################################################## | ||
8 | 3 | # | ||
9 | 4 | # Author: Guewen Baconnier | ||
10 | 5 | # Copyright 2012 Camptocamp SA | ||
11 | 6 | # | ||
12 | 7 | # This program is free software: you can redistribute it and/or modify | ||
13 | 8 | # it under the terms of the GNU Affero General Public License as | ||
14 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
15 | 10 | # License, or (at your option) any later version. | ||
16 | 11 | # | ||
17 | 12 | # This program is distributed in the hope that it will be useful, | ||
18 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | 15 | # GNU Affero General Public License for more details. | ||
21 | 16 | # | ||
22 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
23 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
24 | 19 | # | ||
25 | 20 | ############################################################################## | ||
26 | 21 | |||
27 | 22 | import easy_reconcile | ||
28 | 23 | import base_advanced_reconciliation | ||
29 | 24 | import advanced_reconciliation | ||
30 | 0 | 25 | ||
31 | === added file 'account_advanced_reconcile/__openerp__.py' | |||
32 | --- account_advanced_reconcile/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
33 | +++ account_advanced_reconcile/__openerp__.py 2013-07-17 14:55:41 +0000 | |||
34 | @@ -0,0 +1,83 @@ | |||
35 | 1 | # -*- coding: utf-8 -*- | ||
36 | 2 | ############################################################################## | ||
37 | 3 | # | ||
38 | 4 | # Author: Guewen Baconnier | ||
39 | 5 | # Copyright 2012 Camptocamp SA | ||
40 | 6 | # | ||
41 | 7 | # This program is free software: you can redistribute it and/or modify | ||
42 | 8 | # it under the terms of the GNU Affero General Public License as | ||
43 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
44 | 10 | # License, or (at your option) any later version. | ||
45 | 11 | # | ||
46 | 12 | # This program is distributed in the hope that it will be useful, | ||
47 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
48 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
49 | 15 | # GNU Affero General Public License for more details. | ||
50 | 16 | # | ||
51 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
52 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
53 | 19 | # | ||
54 | 20 | ############################################################################## | ||
55 | 21 | |||
56 | 22 | {'name': "Advanced Reconcile", | ||
57 | 23 | 'version': '1.0', | ||
58 | 24 | 'author': 'Camptocamp', | ||
59 | 25 | 'maintainer': 'Camptocamp', | ||
60 | 26 | 'category': 'Finance', | ||
61 | 27 | 'complexity': 'normal', | ||
62 | 28 | 'depends': ['account_easy_reconcile', | ||
63 | 29 | ], | ||
64 | 30 | 'description': """ | ||
65 | 31 | Advanced reconciliation methods for the module account_easy_reconcile. | ||
66 | 32 | |||
67 | 33 | In addition to the features implemented in account_easy_reconcile, which are: | ||
68 | 34 | - reconciliation facilities for big volume of transactions | ||
69 | 35 | - setup different profiles of reconciliation by account | ||
70 | 36 | - each profile can use many methods of reconciliation | ||
71 | 37 | - this module is also a base to create others reconciliation methods | ||
72 | 38 | which can plug in the profiles | ||
73 | 39 | - a profile a reconciliation can be run manually or by a cron | ||
74 | 40 | - monitoring of reconcilation runs with an history | ||
75 | 41 | |||
76 | 42 | It implements a basis to created advanced reconciliation methods in a few lines | ||
77 | 43 | of code. | ||
78 | 44 | |||
79 | 45 | Typically, such a method can be: | ||
80 | 46 | - Reconcile Journal items if the partner and the ref are equal | ||
81 | 47 | - Reconcile Journal items if the partner is equal and the ref | ||
82 | 48 | is the same than ref or name | ||
83 | 49 | - Reconcile Journal items if the partner is equal and the ref | ||
84 | 50 | match with a pattern | ||
85 | 51 | |||
86 | 52 | And they allows: | ||
87 | 53 | - Reconciliations with multiple credit / multiple debit lines | ||
88 | 54 | - Partial reconciliations | ||
89 | 55 | - Write-off amount as well | ||
90 | 56 | |||
91 | 57 | A method is already implemented in this module, it matches on items: | ||
92 | 58 | - Partner | ||
93 | 59 | - Ref on credit move lines should be case insensitive equals to the ref or | ||
94 | 60 | the name of the debit move line | ||
95 | 61 | |||
96 | 62 | The base class to find the reconciliations is built to be as efficient as | ||
97 | 63 | possible. | ||
98 | 64 | |||
99 | 65 | So basically, if you have an invoice with 3 payments (one per month), the first | ||
100 | 66 | month, it will partial reconcile the debit move line with the first payment, the second | ||
101 | 67 | month, it will partial reconcile the debit move line with 2 first payments, | ||
102 | 68 | the third month, it will make the full reconciliation. | ||
103 | 69 | |||
104 | 70 | This module is perfectly adapted for E-Commerce business where a big volume of | ||
105 | 71 | move lines and so, reconciliations, are involved and payments often come from | ||
106 | 72 | many offices. | ||
107 | 73 | |||
108 | 74 | """, | ||
109 | 75 | 'website': 'http://www.camptocamp.com', | ||
110 | 76 | 'data': ['easy_reconcile_view.xml'], | ||
111 | 77 | 'test': [], | ||
112 | 78 | 'images': [], | ||
113 | 79 | 'installable': True, | ||
114 | 80 | 'auto_install': False, | ||
115 | 81 | 'license': 'AGPL-3', | ||
116 | 82 | 'application': True, | ||
117 | 83 | } | ||
118 | 0 | 84 | ||
119 | === added file 'account_advanced_reconcile/advanced_reconciliation.py' | |||
120 | --- account_advanced_reconcile/advanced_reconciliation.py 1970-01-01 00:00:00 +0000 | |||
121 | +++ account_advanced_reconcile/advanced_reconciliation.py 2013-07-17 14:55:41 +0000 | |||
122 | @@ -0,0 +1,118 @@ | |||
123 | 1 | # -*- coding: utf-8 -*- | ||
124 | 2 | ############################################################################## | ||
125 | 3 | # | ||
126 | 4 | # Author: Guewen Baconnier | ||
127 | 5 | # Copyright 2012 Camptocamp SA | ||
128 | 6 | # | ||
129 | 7 | # This program is free software: you can redistribute it and/or modify | ||
130 | 8 | # it under the terms of the GNU Affero General Public License as | ||
131 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
132 | 10 | # License, or (at your option) any later version. | ||
133 | 11 | # | ||
134 | 12 | # This program is distributed in the hope that it will be useful, | ||
135 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
136 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
137 | 15 | # GNU Affero General Public License for more details. | ||
138 | 16 | # | ||
139 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
140 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
141 | 19 | # | ||
142 | 20 | ############################################################################## | ||
143 | 21 | |||
144 | 22 | from openerp.osv import orm | ||
145 | 23 | |||
146 | 24 | |||
147 | 25 | class easy_reconcile_advanced_ref(orm.TransientModel): | ||
148 | 26 | |||
149 | 27 | _name = 'easy.reconcile.advanced.ref' | ||
150 | 28 | _inherit = 'easy.reconcile.advanced' | ||
151 | 29 | |||
152 | 30 | def _skip_line(self, cr, uid, rec, move_line, context=None): | ||
153 | 31 | """ | ||
154 | 32 | When True is returned on some conditions, the credit move line | ||
155 | 33 | will be skipped for reconciliation. Can be inherited to | ||
156 | 34 | skip on some conditions. ie: ref or partner_id is empty. | ||
157 | 35 | """ | ||
158 | 36 | return not (move_line.get('ref') and move_line.get('partner_id')) | ||
159 | 37 | |||
160 | 38 | def _matchers(self, cr, uid, rec, move_line, context=None): | ||
161 | 39 | """ | ||
162 | 40 | Return the values used as matchers to find the opposite lines | ||
163 | 41 | |||
164 | 42 | All the matcher keys in the dict must have their equivalent in | ||
165 | 43 | the `_opposite_matchers`. | ||
166 | 44 | |||
167 | 45 | The values of each matcher key will be searched in the | ||
168 | 46 | one returned by the `_opposite_matchers` | ||
169 | 47 | |||
170 | 48 | Must be inherited to implement the matchers for one method | ||
171 | 49 | |||
172 | 50 | For instance, it can return: | ||
173 | 51 | return ('ref', move_line['rec']) | ||
174 | 52 | |||
175 | 53 | or | ||
176 | 54 | return (('partner_id', move_line['partner_id']), | ||
177 | 55 | ('ref', "prefix_%s" % move_line['rec'])) | ||
178 | 56 | |||
179 | 57 | All the matchers have to be found in the opposite lines | ||
180 | 58 | to consider them as "opposite" | ||
181 | 59 | |||
182 | 60 | The matchers will be evaluated in the same order as declared | ||
183 | 61 | vs the the opposite matchers, so you can gain performance by | ||
184 | 62 | declaring first the partners with the less computation. | ||
185 | 63 | |||
186 | 64 | All matchers should match with their opposite to be considered | ||
187 | 65 | as "matching". | ||
188 | 66 | So with the previous example, partner_id and ref have to be | ||
189 | 67 | equals on the opposite line matchers. | ||
190 | 68 | |||
191 | 69 | :return: tuple of tuples (key, value) where the keys are | ||
192 | 70 | the matchers keys | ||
193 | 71 | (must be the same than `_opposite_matchers` returns, | ||
194 | 72 | and their values to match in the opposite lines. | ||
195 | 73 | A matching key can have multiples values. | ||
196 | 74 | """ | ||
197 | 75 | return (('partner_id', move_line['partner_id']), | ||
198 | 76 | ('ref', move_line['ref'].lower().strip())) | ||
199 | 77 | |||
200 | 78 | def _opposite_matchers(self, cr, uid, rec, move_line, context=None): | ||
201 | 79 | """ | ||
202 | 80 | Return the values of the opposite line used as matchers | ||
203 | 81 | so the line is matched | ||
204 | 82 | |||
205 | 83 | Must be inherited to implement the matchers for one method | ||
206 | 84 | It can be inherited to apply some formatting of fields | ||
207 | 85 | (strip(), lower() and so on) | ||
208 | 86 | |||
209 | 87 | This method is the counterpart of the `_matchers()` method. | ||
210 | 88 | |||
211 | 89 | Each matcher has to yield its value respecting the order | ||
212 | 90 | of the `_matchers()`. | ||
213 | 91 | |||
214 | 92 | When a matcher does not correspond, the next matchers won't | ||
215 | 93 | be evaluated so the ones which need the less computation | ||
216 | 94 | have to be executed first. | ||
217 | 95 | |||
218 | 96 | If the `_matchers()` returns: | ||
219 | 97 | (('partner_id', move_line['partner_id']), | ||
220 | 98 | ('ref', move_line['ref'])) | ||
221 | 99 | |||
222 | 100 | Here, you should yield : | ||
223 | 101 | yield ('partner_id', move_line['partner_id']) | ||
224 | 102 | yield ('ref', move_line['ref']) | ||
225 | 103 | |||
226 | 104 | Note that a matcher can contain multiple values, as instance, | ||
227 | 105 | if for a move line, you want to search from its `ref` in the | ||
228 | 106 | `ref` or `name` fields of the opposite move lines, you have to | ||
229 | 107 | yield ('partner_id', move_line['partner_id']) | ||
230 | 108 | yield ('ref', (move_line['ref'], move_line['name']) | ||
231 | 109 | |||
232 | 110 | An OR is used between the values for the same key. | ||
233 | 111 | An AND is used between the differents keys. | ||
234 | 112 | |||
235 | 113 | :param dict move_line: values of the move_line | ||
236 | 114 | :yield: matchers as tuple ('matcher key', value(s)) | ||
237 | 115 | """ | ||
238 | 116 | yield ('partner_id', move_line['partner_id']) | ||
239 | 117 | yield ('ref', ((move_line['ref'] or '').lower().strip(), | ||
240 | 118 | move_line['name'].lower().strip())) | ||
241 | 0 | 119 | ||
242 | === added file 'account_advanced_reconcile/base_advanced_reconciliation.py' | |||
243 | --- account_advanced_reconcile/base_advanced_reconciliation.py 1970-01-01 00:00:00 +0000 | |||
244 | +++ account_advanced_reconcile/base_advanced_reconciliation.py 2013-07-17 14:55:41 +0000 | |||
245 | @@ -0,0 +1,272 @@ | |||
246 | 1 | # -*- coding: utf-8 -*- | ||
247 | 2 | ############################################################################## | ||
248 | 3 | # | ||
249 | 4 | # Author: Guewen Baconnier | ||
250 | 5 | # Copyright 2012 Camptocamp SA | ||
251 | 6 | # | ||
252 | 7 | # This program is free software: you can redistribute it and/or modify | ||
253 | 8 | # it under the terms of the GNU Affero General Public License as | ||
254 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
255 | 10 | # License, or (at your option) any later version. | ||
256 | 11 | # | ||
257 | 12 | # This program is distributed in the hope that it will be useful, | ||
258 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
259 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
260 | 15 | # GNU Affero General Public License for more details. | ||
261 | 16 | # | ||
262 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
263 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
264 | 19 | # | ||
265 | 20 | ############################################################################## | ||
266 | 21 | |||
267 | 22 | from itertools import product | ||
268 | 23 | from openerp.osv import orm | ||
269 | 24 | |||
270 | 25 | |||
271 | 26 | class easy_reconcile_advanced(orm.AbstractModel): | ||
272 | 27 | |||
273 | 28 | _name = 'easy.reconcile.advanced' | ||
274 | 29 | _inherit = 'easy.reconcile.base' | ||
275 | 30 | |||
276 | 31 | def _query_debit(self, cr, uid, rec, context=None): | ||
277 | 32 | """Select all move (debit>0) as candidate. """ | ||
278 | 33 | select = self._select(rec) | ||
279 | 34 | sql_from = self._from(rec) | ||
280 | 35 | where, params = self._where(rec) | ||
281 | 36 | where += " AND account_move_line.debit > 0 " | ||
282 | 37 | |||
283 | 38 | where2, params2 = self._get_filter(cr, uid, rec, context=context) | ||
284 | 39 | |||
285 | 40 | query = ' '.join((select, sql_from, where, where2)) | ||
286 | 41 | |||
287 | 42 | cr.execute(query, params + params2) | ||
288 | 43 | return cr.dictfetchall() | ||
289 | 44 | |||
290 | 45 | def _query_credit(self, cr, uid, rec, context=None): | ||
291 | 46 | """Select all move (credit>0) as candidate. """ | ||
292 | 47 | select = self._select(rec) | ||
293 | 48 | sql_from = self._from(rec) | ||
294 | 49 | where, params = self._where(rec) | ||
295 | 50 | where += " AND account_move_line.credit > 0 " | ||
296 | 51 | |||
297 | 52 | where2, params2 = self._get_filter(cr, uid, rec, context=context) | ||
298 | 53 | |||
299 | 54 | query = ' '.join((select, sql_from, where, where2)) | ||
300 | 55 | |||
301 | 56 | cr.execute(query, params + params2) | ||
302 | 57 | return cr.dictfetchall() | ||
303 | 58 | |||
304 | 59 | def _matchers(self, cr, uid, rec, move_line, context=None): | ||
305 | 60 | """ | ||
306 | 61 | Return the values used as matchers to find the opposite lines | ||
307 | 62 | |||
308 | 63 | All the matcher keys in the dict must have their equivalent in | ||
309 | 64 | the `_opposite_matchers`. | ||
310 | 65 | |||
311 | 66 | The values of each matcher key will be searched in the | ||
312 | 67 | one returned by the `_opposite_matchers` | ||
313 | 68 | |||
314 | 69 | Must be inherited to implement the matchers for one method | ||
315 | 70 | |||
316 | 71 | As instance, it can return: | ||
317 | 72 | return ('ref', move_line['rec']) | ||
318 | 73 | |||
319 | 74 | or | ||
320 | 75 | return (('partner_id', move_line['partner_id']), | ||
321 | 76 | ('ref', "prefix_%s" % move_line['rec'])) | ||
322 | 77 | |||
323 | 78 | All the matchers have to be found in the opposite lines | ||
324 | 79 | to consider them as "opposite" | ||
325 | 80 | |||
326 | 81 | The matchers will be evaluated in the same order as declared | ||
327 | 82 | vs the the opposite matchers, so you can gain performance by | ||
328 | 83 | declaring first the partners with the less computation. | ||
329 | 84 | |||
330 | 85 | All matchers should match with their opposite to be considered | ||
331 | 86 | as "matching". | ||
332 | 87 | So with the previous example, partner_id and ref have to be | ||
333 | 88 | equals on the opposite line matchers. | ||
334 | 89 | |||
335 | 90 | :return: tuple of tuples (key, value) where the keys are | ||
336 | 91 | the matchers keys | ||
337 | 92 | (must be the same than `_opposite_matchers` returns, | ||
338 | 93 | and their values to match in the opposite lines. | ||
339 | 94 | A matching key can have multiples values. | ||
340 | 95 | """ | ||
341 | 96 | raise NotImplementedError | ||
342 | 97 | |||
343 | 98 | def _opposite_matchers(self, cr, uid, rec, move_line, context=None): | ||
344 | 99 | """ | ||
345 | 100 | Return the values of the opposite line used as matchers | ||
346 | 101 | so the line is matched | ||
347 | 102 | |||
348 | 103 | Must be inherited to implement the matchers for one method | ||
349 | 104 | It can be inherited to apply some formatting of fields | ||
350 | 105 | (strip(), lower() and so on) | ||
351 | 106 | |||
352 | 107 | This method is the counterpart of the `_matchers()` method. | ||
353 | 108 | |||
354 | 109 | Each matcher has to yield its value respecting the order | ||
355 | 110 | of the `_matchers()`. | ||
356 | 111 | |||
357 | 112 | When a matcher does not correspond, the next matchers won't | ||
358 | 113 | be evaluated so the ones which need the less computation | ||
359 | 114 | have to be executed first. | ||
360 | 115 | |||
361 | 116 | If the `_matchers()` returns: | ||
362 | 117 | (('partner_id', move_line['partner_id']), | ||
363 | 118 | ('ref', move_line['ref'])) | ||
364 | 119 | |||
365 | 120 | Here, you should yield : | ||
366 | 121 | yield ('partner_id', move_line['partner_id']) | ||
367 | 122 | yield ('ref', move_line['ref']) | ||
368 | 123 | |||
369 | 124 | Note that a matcher can contain multiple values, as instance, | ||
370 | 125 | if for a move line, you want to search from its `ref` in the | ||
371 | 126 | `ref` or `name` fields of the opposite move lines, you have to | ||
372 | 127 | yield ('partner_id', move_line['partner_id']) | ||
373 | 128 | yield ('ref', (move_line['ref'], move_line['name']) | ||
374 | 129 | |||
375 | 130 | An OR is used between the values for the same key. | ||
376 | 131 | An AND is used between the differents keys. | ||
377 | 132 | |||
378 | 133 | :param dict move_line: values of the move_line | ||
379 | 134 | :yield: matchers as tuple ('matcher key', value(s)) | ||
380 | 135 | """ | ||
381 | 136 | raise NotImplementedError | ||
382 | 137 | |||
383 | 138 | @staticmethod | ||
384 | 139 | def _compare_values(key, value, opposite_value): | ||
385 | 140 | """Can be inherited to modify the equality condition | ||
386 | 141 | specifically according to the matcher key (maybe using | ||
387 | 142 | a like operator instead of equality on 'ref' as instance) | ||
388 | 143 | """ | ||
389 | 144 | # consider that empty vals are not valid matchers | ||
390 | 145 | # it can still be inherited for some special cases | ||
391 | 146 | # where it would be allowed | ||
392 | 147 | if not (value and opposite_value): | ||
393 | 148 | return False | ||
394 | 149 | |||
395 | 150 | if value == opposite_value: | ||
396 | 151 | return True | ||
397 | 152 | return False | ||
398 | 153 | |||
399 | 154 | @staticmethod | ||
400 | 155 | def _compare_matcher_values(key, values, opposite_values): | ||
401 | 156 | """ Compare every values from a matcher vs an opposite matcher | ||
402 | 157 | and return True if it matches | ||
403 | 158 | """ | ||
404 | 159 | for value, ovalue in product(values, opposite_values): | ||
405 | 160 | # we do not need to compare all values, if one matches | ||
406 | 161 | # we are done | ||
407 | 162 | if easy_reconcile_advanced._compare_values(key, value, ovalue): | ||
408 | 163 | return True | ||
409 | 164 | return False | ||
410 | 165 | |||
411 | 166 | @staticmethod | ||
412 | 167 | def _compare_matchers(matcher, opposite_matcher): | ||
413 | 168 | """ | ||
414 | 169 | Prepare and check the matchers to compare | ||
415 | 170 | """ | ||
416 | 171 | mkey, mvalue = matcher | ||
417 | 172 | omkey, omvalue = opposite_matcher | ||
418 | 173 | assert mkey == omkey, ("A matcher %s is compared with a matcher %s, " | ||
419 | 174 | " the _matchers and _opposite_matchers are probably wrong" % | ||
420 | 175 | (mkey, omkey)) | ||
421 | 176 | if not isinstance(mvalue, (list, tuple)): | ||
422 | 177 | mvalue = mvalue, | ||
423 | 178 | if not isinstance(omvalue, (list, tuple)): | ||
424 | 179 | omvalue = omvalue, | ||
425 | 180 | return easy_reconcile_advanced._compare_matcher_values(mkey, mvalue, omvalue) | ||
426 | 181 | |||
427 | 182 | def _compare_opposite(self, cr, uid, rec, move_line, opposite_move_line, | ||
428 | 183 | matchers, context=None): | ||
429 | 184 | """ Iterate over the matchers of the move lines vs opposite move lines | ||
430 | 185 | and if they all match, return True. | ||
431 | 186 | |||
432 | 187 | If all the matchers match for a move line and an opposite move line, | ||
433 | 188 | they are candidate for a reconciliation. | ||
434 | 189 | """ | ||
435 | 190 | opp_matchers = self._opposite_matchers(cr, uid, rec, opposite_move_line, | ||
436 | 191 | context=context) | ||
437 | 192 | for matcher in matchers: | ||
438 | 193 | try: | ||
439 | 194 | opp_matcher = opp_matchers.next() | ||
440 | 195 | except StopIteration: | ||
441 | 196 | # if you fall here, you probably missed to put a `yield` | ||
442 | 197 | # in `_opposite_matchers()` | ||
443 | 198 | raise ValueError("Missing _opposite_matcher: %s" % matcher[0]) | ||
444 | 199 | |||
445 | 200 | if not self._compare_matchers(matcher, opp_matcher): | ||
446 | 201 | # if any of the matcher fails, the opposite line | ||
447 | 202 | # is not a valid counterpart | ||
448 | 203 | # directly returns so the next yield of _opposite_matchers | ||
449 | 204 | # are not evaluated | ||
450 | 205 | return False | ||
451 | 206 | |||
452 | 207 | return True | ||
453 | 208 | |||
454 | 209 | def _search_opposites(self, cr, uid, rec, move_line, opposite_move_lines, context=None): | ||
455 | 210 | """ | ||
456 | 211 | Search the opposite move lines for a move line | ||
457 | 212 | |||
458 | 213 | :param dict move_line: the move line for which we search opposites | ||
459 | 214 | :param list opposite_move_lines: list of dict of move lines values, the move | ||
460 | 215 | lines we want to search for | ||
461 | 216 | :return: list of matching lines | ||
462 | 217 | """ | ||
463 | 218 | matchers = self._matchers(cr, uid, rec, move_line, context=context) | ||
464 | 219 | return [op for op in opposite_move_lines if | ||
465 | 220 | self._compare_opposite( | ||
466 | 221 | cr, uid, rec, move_line, op, matchers, context=context)] | ||
467 | 222 | |||
468 | 223 | def _action_rec(self, cr, uid, rec, context=None): | ||
469 | 224 | credit_lines = self._query_credit(cr, uid, rec, context=context) | ||
470 | 225 | debit_lines = self._query_debit(cr, uid, rec, context=context) | ||
471 | 226 | return self._rec_auto_lines_advanced( | ||
472 | 227 | cr, uid, rec, credit_lines, debit_lines, context=context) | ||
473 | 228 | |||
474 | 229 | def _skip_line(self, cr, uid, rec, move_line, context=None): | ||
475 | 230 | """ | ||
476 | 231 | When True is returned on some conditions, the credit move line | ||
477 | 232 | will be skipped for reconciliation. Can be inherited to | ||
478 | 233 | skip on some conditions. ie: ref or partner_id is empty. | ||
479 | 234 | """ | ||
480 | 235 | return False | ||
481 | 236 | |||
482 | 237 | def _rec_auto_lines_advanced(self, cr, uid, rec, credit_lines, debit_lines, context=None): | ||
483 | 238 | """ Advanced reconciliation main loop """ | ||
484 | 239 | reconciled_ids = [] | ||
485 | 240 | partial_reconciled_ids = [] | ||
486 | 241 | reconcile_groups = [] | ||
487 | 242 | |||
488 | 243 | for credit_line in credit_lines: | ||
489 | 244 | if self._skip_line(cr, uid, rec, credit_line, context=context): | ||
490 | 245 | continue | ||
491 | 246 | |||
492 | 247 | opposite_lines = self._search_opposites( | ||
493 | 248 | cr, uid, rec, credit_line, debit_lines, context=context) | ||
494 | 249 | |||
495 | 250 | if not opposite_lines: | ||
496 | 251 | continue | ||
497 | 252 | |||
498 | 253 | opposite_ids = [l['id'] for l in opposite_lines] | ||
499 | 254 | line_ids = opposite_ids + [credit_line['id']] | ||
500 | 255 | for group in reconcile_groups: | ||
501 | 256 | if any([lid in group for lid in opposite_ids]): | ||
502 | 257 | group.update(line_ids) | ||
503 | 258 | break | ||
504 | 259 | else: | ||
505 | 260 | reconcile_groups.append(set(line_ids)) | ||
506 | 261 | |||
507 | 262 | lines_by_id = dict([(l['id'], l) for l in credit_lines + debit_lines]) | ||
508 | 263 | for reconcile_group_ids in reconcile_groups: | ||
509 | 264 | group_lines = [lines_by_id[lid] for lid in reconcile_group_ids] | ||
510 | 265 | reconciled, full = self._reconcile_lines( | ||
511 | 266 | cr, uid, rec, group_lines, allow_partial=True, context=context) | ||
512 | 267 | if reconciled and full: | ||
513 | 268 | reconciled_ids += reconcile_group_ids | ||
514 | 269 | elif reconciled: | ||
515 | 270 | partial_reconciled_ids += reconcile_group_ids | ||
516 | 271 | |||
517 | 272 | return reconciled_ids, partial_reconciled_ids | ||
518 | 0 | 273 | ||
519 | === added file 'account_advanced_reconcile/easy_reconcile.py' | |||
520 | --- account_advanced_reconcile/easy_reconcile.py 1970-01-01 00:00:00 +0000 | |||
521 | +++ account_advanced_reconcile/easy_reconcile.py 2013-07-17 14:55:41 +0000 | |||
522 | @@ -0,0 +1,36 @@ | |||
523 | 1 | # -*- coding: utf-8 -*- | ||
524 | 2 | ############################################################################## | ||
525 | 3 | # | ||
526 | 4 | # Author: Guewen Baconnier | ||
527 | 5 | # Copyright 2012 Camptocamp SA | ||
528 | 6 | # | ||
529 | 7 | # This program is free software: you can redistribute it and/or modify | ||
530 | 8 | # it under the terms of the GNU Affero General Public License as | ||
531 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
532 | 10 | # License, or (at your option) any later version. | ||
533 | 11 | # | ||
534 | 12 | # This program is distributed in the hope that it will be useful, | ||
535 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
536 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
537 | 15 | # GNU Affero General Public License for more details. | ||
538 | 16 | # | ||
539 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
540 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
541 | 19 | # | ||
542 | 20 | ############################################################################## | ||
543 | 21 | |||
544 | 22 | from openerp.osv import orm | ||
545 | 23 | |||
546 | 24 | |||
547 | 25 | class account_easy_reconcile_method(orm.Model): | ||
548 | 26 | |||
549 | 27 | _inherit = 'account.easy.reconcile.method' | ||
550 | 28 | |||
551 | 29 | def _get_all_rec_method(self, cr, uid, context=None): | ||
552 | 30 | methods = super(account_easy_reconcile_method, self).\ | ||
553 | 31 | _get_all_rec_method(cr, uid, context=context) | ||
554 | 32 | methods += [ | ||
555 | 33 | ('easy.reconcile.advanced.ref', | ||
556 | 34 | 'Advanced. Partner and Ref.'), | ||
557 | 35 | ] | ||
558 | 36 | return methods | ||
559 | 0 | 37 | ||
560 | === added file 'account_advanced_reconcile/easy_reconcile_view.xml' | |||
561 | --- account_advanced_reconcile/easy_reconcile_view.xml 1970-01-01 00:00:00 +0000 | |||
562 | +++ account_advanced_reconcile/easy_reconcile_view.xml 2013-07-17 14:55:41 +0000 | |||
563 | @@ -0,0 +1,19 @@ | |||
564 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
565 | 2 | <openerp> | ||
566 | 3 | <data noupdate="0"> | ||
567 | 4 | <record id="view_easy_reconcile_form" model="ir.ui.view"> | ||
568 | 5 | <field name="name">account.easy.reconcile.form</field> | ||
569 | 6 | <field name="model">account.easy.reconcile</field> | ||
570 | 7 | <field name="inherit_id" ref="account_easy_reconcile.account_easy_reconcile_form"/> | ||
571 | 8 | <field name="arch" type="xml"> | ||
572 | 9 | <page name="information" position="inside"> | ||
573 | 10 | <group colspan="2" col="2"> | ||
574 | 11 | <separator colspan="4" string="Advanced. Partner and Ref"/> | ||
575 | 12 | <label string="Match multiple debit vs multiple credit entries. Allow partial reconciliation. | ||
576 | 13 | The lines should have the partner, the credit entry ref. is matched vs the debit entry ref. or name." colspan="4"/> | ||
577 | 14 | </group> | ||
578 | 15 | </page> | ||
579 | 16 | </field> | ||
580 | 17 | </record> | ||
581 | 18 | </data> | ||
582 | 19 | </openerp> | ||
583 | 0 | 20 | ||
584 | === added directory 'account_advanced_reconcile/i18n' | |||
585 | === added file 'account_advanced_reconcile/i18n/fr.po' | |||
586 | --- account_advanced_reconcile/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
587 | +++ account_advanced_reconcile/i18n/fr.po 2013-07-17 14:55:41 +0000 | |||
588 | @@ -0,0 +1,91 @@ | |||
589 | 1 | # Translation of OpenERP Server. | ||
590 | 2 | # This file contains the translation of the following modules: | ||
591 | 3 | # * account_advanced_reconcile | ||
592 | 4 | # | ||
593 | 5 | msgid "" | ||
594 | 6 | msgstr "" | ||
595 | 7 | "Project-Id-Version: OpenERP Server 6.1\n" | ||
596 | 8 | "Report-Msgid-Bugs-To: \n" | ||
597 | 9 | "POT-Creation-Date: 2013-01-04 08:25+0000\n" | ||
598 | 10 | "PO-Revision-Date: 2013-01-04 09:27+0100\n" | ||
599 | 11 | "Last-Translator: Guewen Baconnier <guewen.baconnier@camptocamp.com>\n" | ||
600 | 12 | "Language-Team: \n" | ||
601 | 13 | "Language: \n" | ||
602 | 14 | "MIME-Version: 1.0\n" | ||
603 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | ||
604 | 16 | "Content-Transfer-Encoding: 8bit\n" | ||
605 | 17 | "Plural-Forms: \n" | ||
606 | 18 | |||
607 | 19 | #. module: account_advanced_reconcile | ||
608 | 20 | #: field:easy.reconcile.advanced,partner_ids:0 | ||
609 | 21 | #: field:easy.reconcile.advanced.ref,partner_ids:0 | ||
610 | 22 | msgid "Restrict on partners" | ||
611 | 23 | msgstr "Restriction sur les partenaires" | ||
612 | 24 | |||
613 | 25 | #. module: account_advanced_reconcile | ||
614 | 26 | #: field:easy.reconcile.advanced,account_id:0 | ||
615 | 27 | #: field:easy.reconcile.advanced.ref,account_id:0 | ||
616 | 28 | msgid "Account" | ||
617 | 29 | msgstr "Compte" | ||
618 | 30 | |||
619 | 31 | #. module: account_advanced_reconcile | ||
620 | 32 | #: model:ir.model,name:account_advanced_reconcile.model_account_easy_reconcile_method | ||
621 | 33 | msgid "reconcile method for account_easy_reconcile" | ||
622 | 34 | msgstr "Méthode de lettrage pour le module account_easy_reconcile" | ||
623 | 35 | |||
624 | 36 | #. module: account_advanced_reconcile | ||
625 | 37 | #: field:easy.reconcile.advanced,journal_id:0 | ||
626 | 38 | #: field:easy.reconcile.advanced.ref,journal_id:0 | ||
627 | 39 | msgid "Journal" | ||
628 | 40 | msgstr "Journal" | ||
629 | 41 | |||
630 | 42 | #. module: account_advanced_reconcile | ||
631 | 43 | #: field:easy.reconcile.advanced,account_profit_id:0 | ||
632 | 44 | #: field:easy.reconcile.advanced.ref,account_profit_id:0 | ||
633 | 45 | msgid "Account Profit" | ||
634 | 46 | msgstr "Compte de produit" | ||
635 | 47 | |||
636 | 48 | #. module: account_advanced_reconcile | ||
637 | 49 | #: view:account.easy.reconcile:0 | ||
638 | 50 | msgid "Match multiple debit vs multiple credit entries. Allow partial reconciliation. The lines should have the partner, the credit entry ref. is matched vs the debit entry ref. or name." | ||
639 | 51 | msgstr "Le Lettrage peut s'effectuer sur plusieurs écritures de débit et crédit. Le Lettrage partiel est autorisé. Les écritures doivent avoir le même partenaire et la référence sur les écritures de crédit doit se retrouver dans la référence ou la description sur les écritures de débit." | ||
640 | 52 | |||
641 | 53 | #. module: account_advanced_reconcile | ||
642 | 54 | #: field:easy.reconcile.advanced,filter:0 | ||
643 | 55 | #: field:easy.reconcile.advanced.ref,filter:0 | ||
644 | 56 | msgid "Filter" | ||
645 | 57 | msgstr "Filtre" | ||
646 | 58 | |||
647 | 59 | #. module: account_advanced_reconcile | ||
648 | 60 | #: view:account.easy.reconcile:0 | ||
649 | 61 | msgid "Advanced. Partner and Ref" | ||
650 | 62 | msgstr "Avancé. Partenaire et Réf." | ||
651 | 63 | |||
652 | 64 | #. module: account_advanced_reconcile | ||
653 | 65 | #: field:easy.reconcile.advanced,date_base_on:0 | ||
654 | 66 | #: field:easy.reconcile.advanced.ref,date_base_on:0 | ||
655 | 67 | msgid "Date of reconciliation" | ||
656 | 68 | msgstr "Date de lettrage" | ||
657 | 69 | |||
658 | 70 | #. module: account_advanced_reconcile | ||
659 | 71 | #: model:ir.model,name:account_advanced_reconcile.model_easy_reconcile_advanced | ||
660 | 72 | msgid "easy.reconcile.advanced" | ||
661 | 73 | msgstr "easy.reconcile.advanced" | ||
662 | 74 | |||
663 | 75 | #. module: account_advanced_reconcile | ||
664 | 76 | #: field:easy.reconcile.advanced,account_lost_id:0 | ||
665 | 77 | #: field:easy.reconcile.advanced.ref,account_lost_id:0 | ||
666 | 78 | msgid "Account Lost" | ||
667 | 79 | msgstr "Compte de charge" | ||
668 | 80 | |||
669 | 81 | #. module: account_advanced_reconcile | ||
670 | 82 | #: model:ir.model,name:account_advanced_reconcile.model_easy_reconcile_advanced_ref | ||
671 | 83 | msgid "easy.reconcile.advanced.ref" | ||
672 | 84 | msgstr "easy.reconcile.advanced.ref" | ||
673 | 85 | |||
674 | 86 | #. module: account_advanced_reconcile | ||
675 | 87 | #: field:easy.reconcile.advanced,write_off:0 | ||
676 | 88 | #: field:easy.reconcile.advanced.ref,write_off:0 | ||
677 | 89 | msgid "Write off allowed" | ||
678 | 90 | msgstr "Écart autorisé" | ||
679 | 91 | |||
680 | 0 | 92 | ||
681 | === added directory 'account_easy_reconcile' | |||
682 | === added file 'account_easy_reconcile/__init__.py' | |||
683 | --- account_easy_reconcile/__init__.py 1970-01-01 00:00:00 +0000 | |||
684 | +++ account_easy_reconcile/__init__.py 2013-07-17 14:55:41 +0000 | |||
685 | @@ -0,0 +1,25 @@ | |||
686 | 1 | # -*- coding: utf-8 -*- | ||
687 | 2 | ############################################################################## | ||
688 | 3 | # | ||
689 | 4 | # Copyright 2012 Camptocamp SA (Guewen Baconnier) | ||
690 | 5 | # Copyright (C) 2010 Sébastien Beau | ||
691 | 6 | # | ||
692 | 7 | # This program is free software: you can redistribute it and/or modify | ||
693 | 8 | # it under the terms of the GNU Affero General Public License as | ||
694 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
695 | 10 | # License, or (at your option) any later version. | ||
696 | 11 | # | ||
697 | 12 | # This program is distributed in the hope that it will be useful, | ||
698 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
699 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
700 | 15 | # GNU Affero General Public License for more details. | ||
701 | 16 | # | ||
702 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
703 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
704 | 19 | # | ||
705 | 20 | ############################################################################## | ||
706 | 21 | |||
707 | 22 | import easy_reconcile | ||
708 | 23 | import base_reconciliation | ||
709 | 24 | import simple_reconciliation | ||
710 | 25 | import easy_reconcile_history | ||
711 | 0 | 26 | ||
712 | === added file 'account_easy_reconcile/__openerp__.py' | |||
713 | --- account_easy_reconcile/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
714 | +++ account_easy_reconcile/__openerp__.py 2013-07-17 14:55:41 +0000 | |||
715 | @@ -0,0 +1,66 @@ | |||
716 | 1 | # -*- coding: utf-8 -*- | ||
717 | 2 | ############################################################################## | ||
718 | 3 | # | ||
719 | 4 | # Copyright 2012 Camptocamp SA (Guewen Baconnier) | ||
720 | 5 | # Copyright (C) 2010 Sébastien Beau | ||
721 | 6 | # | ||
722 | 7 | # This program is free software: you can redistribute it and/or modify | ||
723 | 8 | # it under the terms of the GNU Affero General Public License as | ||
724 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
725 | 10 | # License, or (at your option) any later version. | ||
726 | 11 | # | ||
727 | 12 | # This program is distributed in the hope that it will be useful, | ||
728 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
729 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
730 | 15 | # GNU Affero General Public License for more details. | ||
731 | 16 | # | ||
732 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
733 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
734 | 19 | # | ||
735 | 20 | ############################################################################## | ||
736 | 21 | |||
737 | 22 | { | ||
738 | 23 | "name": "Easy Reconcile", | ||
739 | 24 | "version": "1.3.0", | ||
740 | 25 | "depends": ["account"], | ||
741 | 26 | "author": "Akretion,Camptocamp", | ||
742 | 27 | "description": """ | ||
743 | 28 | Easy Reconcile | ||
744 | 29 | ============== | ||
745 | 30 | |||
746 | 31 | This is a shared work between Akretion and Camptocamp | ||
747 | 32 | in order to provide: | ||
748 | 33 | - reconciliation facilities for big volume of transactions | ||
749 | 34 | - setup different profiles of reconciliation by account | ||
750 | 35 | - each profile can use many methods of reconciliation | ||
751 | 36 | - this module is also a base to create others | ||
752 | 37 | reconciliation methods which can plug in the profiles | ||
753 | 38 | - a profile a reconciliation can be run manually | ||
754 | 39 | or by a cron | ||
755 | 40 | - monitoring of reconciliation runs with an history | ||
756 | 41 | which keep track of the reconciled Journal items | ||
757 | 42 | |||
758 | 43 | 2 simple reconciliation methods are integrated | ||
759 | 44 | in this module, the simple reconciliations works | ||
760 | 45 | on 2 lines (1 debit / 1 credit) and do not allow | ||
761 | 46 | partial reconcilation, they also match on 1 key, | ||
762 | 47 | partner or Journal item name. | ||
763 | 48 | |||
764 | 49 | You may be interested to install also the | ||
765 | 50 | ``account_advanced_reconciliation`` module. | ||
766 | 51 | This latter add more complex reconciliations, | ||
767 | 52 | allows multiple lines and partial. | ||
768 | 53 | |||
769 | 54 | """, | ||
770 | 55 | "website": "http://www.akretion.com/", | ||
771 | 56 | "category": "Finance", | ||
772 | 57 | "demo_xml": [], | ||
773 | 58 | "data": ["easy_reconcile.xml", | ||
774 | 59 | "easy_reconcile_history_view.xml", | ||
775 | 60 | "security/ir_rule.xml", | ||
776 | 61 | "security/ir.model.access.csv"], | ||
777 | 62 | 'license': 'AGPL-3', | ||
778 | 63 | "auto_install": False, | ||
779 | 64 | "installable": True, | ||
780 | 65 | |||
781 | 66 | } | ||
782 | 0 | 67 | ||
783 | === added file 'account_easy_reconcile/base_reconciliation.py' | |||
784 | --- account_easy_reconcile/base_reconciliation.py 1970-01-01 00:00:00 +0000 | |||
785 | +++ account_easy_reconcile/base_reconciliation.py 2013-07-17 14:55:41 +0000 | |||
786 | @@ -0,0 +1,208 @@ | |||
787 | 1 | # -*- coding: utf-8 -*- | ||
788 | 2 | ############################################################################## | ||
789 | 3 | # | ||
790 | 4 | # Copyright 2012-2013 Camptocamp SA (Guewen Baconnier) | ||
791 | 5 | # Copyright (C) 2010 Sébastien Beau | ||
792 | 6 | # | ||
793 | 7 | # This program is free software: you can redistribute it and/or modify | ||
794 | 8 | # it under the terms of the GNU Affero General Public License as | ||
795 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
796 | 10 | # License, or (at your option) any later version. | ||
797 | 11 | # | ||
798 | 12 | # This program is distributed in the hope that it will be useful, | ||
799 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
800 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
801 | 15 | # GNU Affero General Public License for more details. | ||
802 | 16 | # | ||
803 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
804 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
805 | 19 | # | ||
806 | 20 | ############################################################################## | ||
807 | 21 | |||
808 | 22 | from openerp.osv import fields, orm | ||
809 | 23 | from operator import itemgetter, attrgetter | ||
810 | 24 | |||
811 | 25 | |||
812 | 26 | class easy_reconcile_base(orm.AbstractModel): | ||
813 | 27 | """Abstract Model for reconciliation methods""" | ||
814 | 28 | |||
815 | 29 | _name = 'easy.reconcile.base' | ||
816 | 30 | |||
817 | 31 | _inherit = 'easy.reconcile.options' | ||
818 | 32 | |||
819 | 33 | _columns = { | ||
820 | 34 | 'account_id': fields.many2one( | ||
821 | 35 | 'account.account', 'Account', required=True), | ||
822 | 36 | 'partner_ids': fields.many2many( | ||
823 | 37 | 'res.partner', string="Restrict on partners"), | ||
824 | 38 | # other columns are inherited from easy.reconcile.options | ||
825 | 39 | } | ||
826 | 40 | |||
827 | 41 | def automatic_reconcile(self, cr, uid, ids, context=None): | ||
828 | 42 | """ Reconciliation method called from the view. | ||
829 | 43 | |||
830 | 44 | :return: list of reconciled ids, list of partially reconciled items | ||
831 | 45 | """ | ||
832 | 46 | if isinstance(ids, (int, long)): | ||
833 | 47 | ids = [ids] | ||
834 | 48 | assert len(ids) == 1, "Has to be called on one id" | ||
835 | 49 | rec = self.browse(cr, uid, ids[0], context=context) | ||
836 | 50 | return self._action_rec(cr, uid, rec, context=context) | ||
837 | 51 | |||
838 | 52 | def _action_rec(self, cr, uid, rec, context=None): | ||
839 | 53 | """ Must be inherited to implement the reconciliation | ||
840 | 54 | |||
841 | 55 | :return: list of reconciled ids | ||
842 | 56 | """ | ||
843 | 57 | raise NotImplementedError | ||
844 | 58 | |||
845 | 59 | def _base_columns(self, rec): | ||
846 | 60 | """ Mandatory columns for move lines queries | ||
847 | 61 | An extra column aliased as ``key`` should be defined | ||
848 | 62 | in each query.""" | ||
849 | 63 | aml_cols = ( | ||
850 | 64 | 'id', | ||
851 | 65 | 'debit', | ||
852 | 66 | 'credit', | ||
853 | 67 | 'date', | ||
854 | 68 | 'period_id', | ||
855 | 69 | 'ref', | ||
856 | 70 | 'name', | ||
857 | 71 | 'partner_id', | ||
858 | 72 | 'account_id', | ||
859 | 73 | 'move_id') | ||
860 | 74 | return ["account_move_line.%s" % col for col in aml_cols] | ||
861 | 75 | |||
862 | 76 | def _select(self, rec, *args, **kwargs): | ||
863 | 77 | return "SELECT %s" % ', '.join(self._base_columns(rec)) | ||
864 | 78 | |||
865 | 79 | def _from(self, rec, *args, **kwargs): | ||
866 | 80 | return "FROM account_move_line" | ||
867 | 81 | |||
868 | 82 | def _where(self, rec, *args, **kwargs): | ||
869 | 83 | where = ("WHERE account_move_line.account_id = %s " | ||
870 | 84 | "AND account_move_line.reconcile_id IS NULL ") | ||
871 | 85 | # it would be great to use dict for params | ||
872 | 86 | # but as we use _where_calc in _get_filter | ||
873 | 87 | # which returns a list, we have to | ||
874 | 88 | # accomodate with that | ||
875 | 89 | params = [rec.account_id.id] | ||
876 | 90 | |||
877 | 91 | if rec.partner_ids: | ||
878 | 92 | where += " AND account_move_line.partner_id IN %s" | ||
879 | 93 | params.append(tuple([l.id for l in rec.partner_ids])) | ||
880 | 94 | return where, params | ||
881 | 95 | |||
882 | 96 | def _get_filter(self, cr, uid, rec, context): | ||
883 | 97 | ml_obj = self.pool.get('account.move.line') | ||
884 | 98 | where = '' | ||
885 | 99 | params = [] | ||
886 | 100 | if rec.filter: | ||
887 | 101 | dummy, where, params = ml_obj._where_calc( | ||
888 | 102 | cr, uid, eval(rec.filter), context=context).get_sql() | ||
889 | 103 | if where: | ||
890 | 104 | where = " AND %s" % where | ||
891 | 105 | return where, params | ||
892 | 106 | |||
893 | 107 | def _below_writeoff_limit(self, cr, uid, rec, lines, | ||
894 | 108 | writeoff_limit, context=None): | ||
895 | 109 | precision = self.pool.get('decimal.precision').precision_get( | ||
896 | 110 | cr, uid, 'Account') | ||
897 | 111 | keys = ('debit', 'credit') | ||
898 | 112 | sums = reduce( | ||
899 | 113 | lambda line, memo: | ||
900 | 114 | dict((key, value + memo[key]) | ||
901 | 115 | for key, value | ||
902 | 116 | in line.iteritems() | ||
903 | 117 | if key in keys), lines) | ||
904 | 118 | |||
905 | 119 | debit, credit = sums['debit'], sums['credit'] | ||
906 | 120 | writeoff_amount = round(debit - credit, precision) | ||
907 | 121 | return bool(writeoff_limit >= abs(writeoff_amount)), debit, credit | ||
908 | 122 | |||
909 | 123 | def _get_rec_date(self, cr, uid, rec, lines, | ||
910 | 124 | based_on='end_period_last_credit', context=None): | ||
911 | 125 | period_obj = self.pool.get('account.period') | ||
912 | 126 | |||
913 | 127 | def last_period(mlines): | ||
914 | 128 | period_ids = [ml['period_id'] for ml in mlines] | ||
915 | 129 | periods = period_obj.browse( | ||
916 | 130 | cr, uid, period_ids, context=context) | ||
917 | 131 | return max(periods, key=attrgetter('date_stop')) | ||
918 | 132 | |||
919 | 133 | def last_date(mlines): | ||
920 | 134 | return max(mlines, key=itemgetter('date')) | ||
921 | 135 | |||
922 | 136 | def credit(mlines): | ||
923 | 137 | return [l for l in mlines if l['credit'] > 0] | ||
924 | 138 | |||
925 | 139 | def debit(mlines): | ||
926 | 140 | return [l for l in mlines if l['debit'] > 0] | ||
927 | 141 | |||
928 | 142 | if based_on == 'end_period_last_credit': | ||
929 | 143 | return last_period(credit(lines)).date_stop | ||
930 | 144 | if based_on == 'end_period': | ||
931 | 145 | return last_period(lines).date_stop | ||
932 | 146 | elif based_on == 'newest': | ||
933 | 147 | return last_date(lines)['date'] | ||
934 | 148 | elif based_on == 'newest_credit': | ||
935 | 149 | return last_date(credit(lines))['date'] | ||
936 | 150 | elif based_on == 'newest_debit': | ||
937 | 151 | return last_date(debit(lines))['date'] | ||
938 | 152 | # reconcilation date will be today | ||
939 | 153 | # when date is None | ||
940 | 154 | return None | ||
941 | 155 | |||
942 | 156 | def _reconcile_lines(self, cr, uid, rec, lines, allow_partial=False, context=None): | ||
943 | 157 | """ Try to reconcile given lines | ||
944 | 158 | |||
945 | 159 | :param list lines: list of dict of move lines, they must at least | ||
946 | 160 | contain values for : id, debit, credit | ||
947 | 161 | :param boolean allow_partial: if True, partial reconciliation will be | ||
948 | 162 | created, otherwise only Full | ||
949 | 163 | reconciliation will be created | ||
950 | 164 | :return: tuple of boolean values, first item is wether the items | ||
951 | 165 | have been reconciled or not, | ||
952 | 166 | the second is wether the reconciliation is full (True) | ||
953 | 167 | or partial (False) | ||
954 | 168 | """ | ||
955 | 169 | if context is None: | ||
956 | 170 | context = {} | ||
957 | 171 | |||
958 | 172 | ml_obj = self.pool.get('account.move.line') | ||
959 | 173 | writeoff = rec.write_off | ||
960 | 174 | |||
961 | 175 | line_ids = [l['id'] for l in lines] | ||
962 | 176 | below_writeoff, sum_debit, sum_credit = self._below_writeoff_limit( | ||
963 | 177 | cr, uid, rec, lines, writeoff, context=context) | ||
964 | 178 | date = self._get_rec_date( | ||
965 | 179 | cr, uid, rec, lines, rec.date_base_on, context=context) | ||
966 | 180 | |||
967 | 181 | rec_ctx = dict(context, date_p=date) | ||
968 | 182 | if below_writeoff: | ||
969 | 183 | if sum_credit < sum_debit: | ||
970 | 184 | writeoff_account_id = rec.account_profit_id.id | ||
971 | 185 | else: | ||
972 | 186 | writeoff_account_id = rec.account_lost_id.id | ||
973 | 187 | |||
974 | 188 | period_id = self.pool.get('account.period').find( | ||
975 | 189 | cr, uid, dt=date, context=context)[0] | ||
976 | 190 | |||
977 | 191 | ml_obj.reconcile( | ||
978 | 192 | cr, uid, | ||
979 | 193 | line_ids, | ||
980 | 194 | type='auto', | ||
981 | 195 | writeoff_acc_id=writeoff_account_id, | ||
982 | 196 | writeoff_period_id=period_id, | ||
983 | 197 | writeoff_journal_id=rec.journal_id.id, | ||
984 | 198 | context=rec_ctx) | ||
985 | 199 | return True, True | ||
986 | 200 | elif allow_partial: | ||
987 | 201 | ml_obj.reconcile_partial( | ||
988 | 202 | cr, uid, | ||
989 | 203 | line_ids, | ||
990 | 204 | type='manual', | ||
991 | 205 | context=rec_ctx) | ||
992 | 206 | return True, False | ||
993 | 207 | |||
994 | 208 | return False, False | ||
995 | 0 | 209 | ||
996 | === added file 'account_easy_reconcile/easy_reconcile.py' | |||
997 | --- account_easy_reconcile/easy_reconcile.py 1970-01-01 00:00:00 +0000 | |||
998 | +++ account_easy_reconcile/easy_reconcile.py 2013-07-17 14:55:41 +0000 | |||
999 | @@ -0,0 +1,285 @@ | |||
1000 | 1 | # -*- coding: utf-8 -*- | ||
1001 | 2 | ############################################################################## | ||
1002 | 3 | # | ||
1003 | 4 | # Copyright 2012-2013 Camptocamp SA (Guewen Baconnier) | ||
1004 | 5 | # Copyright (C) 2010 Sébastien Beau | ||
1005 | 6 | # | ||
1006 | 7 | # This program is free software: you can redistribute it and/or modify | ||
1007 | 8 | # it under the terms of the GNU Affero General Public License as | ||
1008 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
1009 | 10 | # License, or (at your option) any later version. | ||
1010 | 11 | # | ||
1011 | 12 | # This program is distributed in the hope that it will be useful, | ||
1012 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1013 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1014 | 15 | # GNU Affero General Public License for more details. | ||
1015 | 16 | # | ||
1016 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
1017 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1018 | 19 | # | ||
1019 | 20 | ############################################################################## | ||
1020 | 21 | |||
1021 | 22 | from openerp.osv import fields, osv, orm | ||
1022 | 23 | from openerp.tools.translate import _ | ||
1023 | 24 | from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT | ||
1024 | 25 | |||
1025 | 26 | |||
1026 | 27 | class easy_reconcile_options(orm.AbstractModel): | ||
1027 | 28 | """Options of a reconciliation profile | ||
1028 | 29 | |||
1029 | 30 | Columns shared by the configuration of methods | ||
1030 | 31 | and by the reconciliation wizards. | ||
1031 | 32 | This allows decoupling of the methods and the | ||
1032 | 33 | wizards and allows to launch the wizards alone | ||
1033 | 34 | """ | ||
1034 | 35 | |||
1035 | 36 | _name = 'easy.reconcile.options' | ||
1036 | 37 | |||
1037 | 38 | def _get_rec_base_date(self, cr, uid, context=None): | ||
1038 | 39 | return [('end_period_last_credit', 'End of period of most recent credit'), | ||
1039 | 40 | ('newest', 'Most recent move line'), | ||
1040 | 41 | ('actual', 'Today'), | ||
1041 | 42 | ('end_period', 'End of period of most recent move line'), | ||
1042 | 43 | ('newest_credit', 'Date of most recent credit'), | ||
1043 | 44 | ('newest_debit', 'Date of most recent debit')] | ||
1044 | 45 | |||
1045 | 46 | _columns = { | ||
1046 | 47 | 'write_off': fields.float('Write off allowed'), | ||
1047 | 48 | 'account_lost_id': fields.many2one( | ||
1048 | 49 | 'account.account', 'Account Lost'), | ||
1049 | 50 | 'account_profit_id': fields.many2one( | ||
1050 | 51 | 'account.account', 'Account Profit'), | ||
1051 | 52 | 'journal_id': fields.many2one( | ||
1052 | 53 | 'account.journal', 'Journal'), | ||
1053 | 54 | 'date_base_on': fields.selection( | ||
1054 | 55 | _get_rec_base_date, | ||
1055 | 56 | required=True, | ||
1056 | 57 | string='Date of reconciliation'), | ||
1057 | 58 | 'filter': fields.char('Filter', size=128), | ||
1058 | 59 | } | ||
1059 | 60 | |||
1060 | 61 | _defaults = { | ||
1061 | 62 | 'write_off': 0., | ||
1062 | 63 | 'date_base_on': 'end_period_last_credit', | ||
1063 | 64 | } | ||
1064 | 65 | |||
1065 | 66 | |||
1066 | 67 | class account_easy_reconcile_method(orm.Model): | ||
1067 | 68 | |||
1068 | 69 | _name = 'account.easy.reconcile.method' | ||
1069 | 70 | _description = 'reconcile method for account_easy_reconcile' | ||
1070 | 71 | |||
1071 | 72 | _inherit = 'easy.reconcile.options' | ||
1072 | 73 | |||
1073 | 74 | _order = 'sequence' | ||
1074 | 75 | |||
1075 | 76 | def _get_all_rec_method(self, cr, uid, context=None): | ||
1076 | 77 | return [ | ||
1077 | 78 | ('easy.reconcile.simple.name', 'Simple. Amount and Name'), | ||
1078 | 79 | ('easy.reconcile.simple.partner', 'Simple. Amount and Partner'), | ||
1079 | 80 | ('easy.reconcile.simple.reference', 'Simple. Amount and Reference'), | ||
1080 | 81 | ] | ||
1081 | 82 | |||
1082 | 83 | def _get_rec_method(self, cr, uid, context=None): | ||
1083 | 84 | return self._get_all_rec_method(cr, uid, context=None) | ||
1084 | 85 | |||
1085 | 86 | _columns = { | ||
1086 | 87 | 'name': fields.selection( | ||
1087 | 88 | _get_rec_method, 'Type', required=True), | ||
1088 | 89 | 'sequence': fields.integer( | ||
1089 | 90 | 'Sequence', | ||
1090 | 91 | required=True, | ||
1091 | 92 | help="The sequence field is used to order " | ||
1092 | 93 | "the reconcile method"), | ||
1093 | 94 | 'task_id': fields.many2one( | ||
1094 | 95 | 'account.easy.reconcile', | ||
1095 | 96 | string='Task', | ||
1096 | 97 | required=True, | ||
1097 | 98 | ondelete='cascade'), | ||
1098 | 99 | 'company_id': fields.related('task_id','company_id', | ||
1099 | 100 | relation='res.company', | ||
1100 | 101 | type='many2one', | ||
1101 | 102 | string='Company', | ||
1102 | 103 | store=True, | ||
1103 | 104 | readonly=True), | ||
1104 | 105 | } | ||
1105 | 106 | |||
1106 | 107 | _defaults = { | ||
1107 | 108 | 'sequence': 1, | ||
1108 | 109 | } | ||
1109 | 110 | |||
1110 | 111 | def init(self, cr): | ||
1111 | 112 | """ Migration stuff | ||
1112 | 113 | |||
1113 | 114 | Name is not anymore methods names but the name | ||
1114 | 115 | of the model which does the reconciliation | ||
1115 | 116 | """ | ||
1116 | 117 | cr.execute(""" | ||
1117 | 118 | UPDATE account_easy_reconcile_method | ||
1118 | 119 | SET name = 'easy.reconcile.simple.partner' | ||
1119 | 120 | WHERE name = 'action_rec_auto_partner' | ||
1120 | 121 | """) | ||
1121 | 122 | cr.execute(""" | ||
1122 | 123 | UPDATE account_easy_reconcile_method | ||
1123 | 124 | SET name = 'easy.reconcile.simple.name' | ||
1124 | 125 | WHERE name = 'action_rec_auto_name' | ||
1125 | 126 | """) | ||
1126 | 127 | |||
1127 | 128 | |||
1128 | 129 | class account_easy_reconcile(orm.Model): | ||
1129 | 130 | |||
1130 | 131 | _name = 'account.easy.reconcile' | ||
1131 | 132 | _description = 'account easy reconcile' | ||
1132 | 133 | |||
1133 | 134 | def _get_total_unrec(self, cr, uid, ids, name, arg, context=None): | ||
1134 | 135 | obj_move_line = self.pool.get('account.move.line') | ||
1135 | 136 | res = {} | ||
1136 | 137 | for task in self.browse(cr, uid, ids, context=context): | ||
1137 | 138 | res[task.id] = len(obj_move_line.search( | ||
1138 | 139 | cr, uid, | ||
1139 | 140 | [('account_id', '=', task.account.id), | ||
1140 | 141 | ('reconcile_id', '=', False), | ||
1141 | 142 | ('reconcile_partial_id', '=', False)], | ||
1142 | 143 | context=context)) | ||
1143 | 144 | return res | ||
1144 | 145 | |||
1145 | 146 | def _get_partial_rec(self, cr, uid, ids, name, arg, context=None): | ||
1146 | 147 | obj_move_line = self.pool.get('account.move.line') | ||
1147 | 148 | res = {} | ||
1148 | 149 | for task in self.browse(cr, uid, ids, context=context): | ||
1149 | 150 | res[task.id] = len(obj_move_line.search( | ||
1150 | 151 | cr, uid, | ||
1151 | 152 | [('account_id', '=', task.account.id), | ||
1152 | 153 | ('reconcile_id', '=', False), | ||
1153 | 154 | ('reconcile_partial_id', '!=', False)], | ||
1154 | 155 | context=context)) | ||
1155 | 156 | return res | ||
1156 | 157 | |||
1157 | 158 | def _last_history(self, cr, uid, ids, name, args, context=None): | ||
1158 | 159 | result = {} | ||
1159 | 160 | for history in self.browse(cr, uid, ids, context=context): | ||
1160 | 161 | result[history.id] = False | ||
1161 | 162 | if history.history_ids: | ||
1162 | 163 | # history is sorted by date desc | ||
1163 | 164 | result[history.id] = history.history_ids[0].id | ||
1164 | 165 | return result | ||
1165 | 166 | |||
1166 | 167 | _columns = { | ||
1167 | 168 | 'name': fields.char('Name', required=True), | ||
1168 | 169 | 'account': fields.many2one( | ||
1169 | 170 | 'account.account', 'Account', required=True), | ||
1170 | 171 | 'reconcile_method': fields.one2many( | ||
1171 | 172 | 'account.easy.reconcile.method', 'task_id', 'Method'), | ||
1172 | 173 | 'unreconciled_count': fields.function( | ||
1173 | 174 | _get_total_unrec, type='integer', string='Unreconciled Items'), | ||
1174 | 175 | 'reconciled_partial_count': fields.function( | ||
1175 | 176 | _get_partial_rec, | ||
1176 | 177 | type='integer', | ||
1177 | 178 | string='Partially Reconciled Items'), | ||
1178 | 179 | 'history_ids': fields.one2many( | ||
1179 | 180 | 'easy.reconcile.history', | ||
1180 | 181 | 'easy_reconcile_id', | ||
1181 | 182 | string='History', | ||
1182 | 183 | readonly=True), | ||
1183 | 184 | 'last_history': | ||
1184 | 185 | fields.function( | ||
1185 | 186 | _last_history, | ||
1186 | 187 | string='Last History', | ||
1187 | 188 | type='many2one', | ||
1188 | 189 | relation='easy.reconcile.history', | ||
1189 | 190 | readonly=True), | ||
1190 | 191 | 'company_id': fields.many2one('res.company', 'Company'), | ||
1191 | 192 | } | ||
1192 | 193 | |||
1193 | 194 | def _prepare_run_transient(self, cr, uid, rec_method, context=None): | ||
1194 | 195 | return {'account_id': rec_method.task_id.account.id, | ||
1195 | 196 | 'write_off': rec_method.write_off, | ||
1196 | 197 | 'account_lost_id': (rec_method.account_lost_id and | ||
1197 | 198 | rec_method.account_lost_id.id), | ||
1198 | 199 | 'account_profit_id': (rec_method.account_profit_id and | ||
1199 | 200 | rec_method.account_profit_id.id), | ||
1200 | 201 | 'journal_id': (rec_method.journal_id and | ||
1201 | 202 | rec_method.journal_id.id), | ||
1202 | 203 | 'date_base_on': rec_method.date_base_on, | ||
1203 | 204 | 'filter': rec_method.filter} | ||
1204 | 205 | |||
1205 | 206 | def run_reconcile(self, cr, uid, ids, context=None): | ||
1206 | 207 | def find_reconcile_ids(fieldname, move_line_ids): | ||
1207 | 208 | if not move_line_ids: | ||
1208 | 209 | return [] | ||
1209 | 210 | sql = ("SELECT DISTINCT " + fieldname + | ||
1210 | 211 | " FROM account_move_line " | ||
1211 | 212 | " WHERE id in %s " | ||
1212 | 213 | " AND " + fieldname + " IS NOT NULL") | ||
1213 | 214 | cr.execute(sql, (tuple(move_line_ids),)) | ||
1214 | 215 | res = cr.fetchall() | ||
1215 | 216 | return [row[0] for row in res] | ||
1216 | 217 | |||
1217 | 218 | for rec in self.browse(cr, uid, ids, context=context): | ||
1218 | 219 | all_ml_rec_ids = [] | ||
1219 | 220 | all_ml_partial_ids = [] | ||
1220 | 221 | |||
1221 | 222 | for method in rec.reconcile_method: | ||
1222 | 223 | rec_model = self.pool.get(method.name) | ||
1223 | 224 | auto_rec_id = rec_model.create( | ||
1224 | 225 | cr, uid, | ||
1225 | 226 | self._prepare_run_transient( | ||
1226 | 227 | cr, uid, method, context=context), | ||
1227 | 228 | context=context) | ||
1228 | 229 | |||
1229 | 230 | ml_rec_ids, ml_partial_ids = rec_model.automatic_reconcile( | ||
1230 | 231 | cr, uid, auto_rec_id, context=context) | ||
1231 | 232 | |||
1232 | 233 | all_ml_rec_ids += ml_rec_ids | ||
1233 | 234 | all_ml_partial_ids += ml_partial_ids | ||
1234 | 235 | |||
1235 | 236 | reconcile_ids = find_reconcile_ids( | ||
1236 | 237 | 'reconcile_id', all_ml_rec_ids) | ||
1237 | 238 | partial_ids = find_reconcile_ids( | ||
1238 | 239 | 'reconcile_partial_id', all_ml_partial_ids) | ||
1239 | 240 | |||
1240 | 241 | self.pool.get('easy.reconcile.history').create( | ||
1241 | 242 | cr, | ||
1242 | 243 | uid, | ||
1243 | 244 | {'easy_reconcile_id': rec.id, | ||
1244 | 245 | 'date': fields.datetime.now(), | ||
1245 | 246 | 'reconcile_ids': [(4, rid) for rid in reconcile_ids], | ||
1246 | 247 | 'reconcile_partial_ids': [(4, rid) for rid in partial_ids]}, | ||
1247 | 248 | context=context) | ||
1248 | 249 | return True | ||
1249 | 250 | |||
1250 | 251 | def _no_history(self, cr, uid, rec, context=None): | ||
1251 | 252 | """ Raise an `osv.except_osv` error, supposed to | ||
1252 | 253 | be called when there is no history on the reconciliation | ||
1253 | 254 | task. | ||
1254 | 255 | """ | ||
1255 | 256 | raise osv.except_osv( | ||
1256 | 257 | _('Error'), | ||
1257 | 258 | _('There is no history of reconciled ' | ||
1258 | 259 | 'items on the task: %s.') % rec.name) | ||
1259 | 260 | |||
1260 | 261 | def last_history_reconcile(self, cr, uid, rec_id, context=None): | ||
1261 | 262 | """ Get the last history record for this reconciliation profile | ||
1262 | 263 | and return the action which opens move lines reconciled | ||
1263 | 264 | """ | ||
1264 | 265 | if isinstance(rec_id, (tuple, list)): | ||
1265 | 266 | assert len(rec_id) == 1, \ | ||
1266 | 267 | "Only 1 id expected" | ||
1267 | 268 | rec_id = rec_id[0] | ||
1268 | 269 | rec = self.browse(cr, uid, rec_id, context=context) | ||
1269 | 270 | if not rec.last_history: | ||
1270 | 271 | self._no_history(cr, uid, rec, context=context) | ||
1271 | 272 | return rec.last_history.open_reconcile() | ||
1272 | 273 | |||
1273 | 274 | def last_history_partial(self, cr, uid, rec_id, context=None): | ||
1274 | 275 | """ Get the last history record for this reconciliation profile | ||
1275 | 276 | and return the action which opens move lines reconciled | ||
1276 | 277 | """ | ||
1277 | 278 | if isinstance(rec_id, (tuple, list)): | ||
1278 | 279 | assert len(rec_id) == 1, \ | ||
1279 | 280 | "Only 1 id expected" | ||
1280 | 281 | rec_id = rec_id[0] | ||
1281 | 282 | rec = self.browse(cr, uid, rec_id, context=context) | ||
1282 | 283 | if not rec.last_history: | ||
1283 | 284 | self._no_history(cr, uid, rec, context=context) | ||
1284 | 285 | return rec.last_history.open_partial() | ||
1285 | 0 | 286 | ||
1286 | === added file 'account_easy_reconcile/easy_reconcile.xml' | |||
1287 | --- account_easy_reconcile/easy_reconcile.xml 1970-01-01 00:00:00 +0000 | |||
1288 | +++ account_easy_reconcile/easy_reconcile.xml 2013-07-17 14:55:41 +0000 | |||
1289 | @@ -0,0 +1,156 @@ | |||
1290 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
1291 | 2 | <openerp> | ||
1292 | 3 | <data> | ||
1293 | 4 | |||
1294 | 5 | <!-- account.easy.reconcile view --> | ||
1295 | 6 | <record id="account_easy_reconcile_form" model="ir.ui.view"> | ||
1296 | 7 | <field name="name">account.easy.reconcile.form</field> | ||
1297 | 8 | <field name="priority">20</field> | ||
1298 | 9 | <field name="model">account.easy.reconcile</field> | ||
1299 | 10 | <field name="arch" type="xml"> | ||
1300 | 11 | <form string="Automatic Easy Reconcile" version="7.0"> | ||
1301 | 12 | <header> | ||
1302 | 13 | <button name="run_reconcile" class="oe_highlight" | ||
1303 | 14 | string="Start Auto Reconciliation" type="object"/> | ||
1304 | 15 | <button icon="STOCK_JUMP_TO" name="last_history_reconcile" | ||
1305 | 16 | class="oe_highlight" | ||
1306 | 17 | string="Display items reconciled on the last run" | ||
1307 | 18 | type="object"/> | ||
1308 | 19 | <button icon="STOCK_JUMP_TO" name="last_history_partial" | ||
1309 | 20 | class="oe_highlight" | ||
1310 | 21 | string="Display items partially reconciled on the last run" | ||
1311 | 22 | type="object"/> | ||
1312 | 23 | </header> | ||
1313 | 24 | <sheet> | ||
1314 | 25 | <separator colspan="4" string="Profile Information" /> | ||
1315 | 26 | <group> | ||
1316 | 27 | <group> | ||
1317 | 28 | <field name="name" select="1"/> | ||
1318 | 29 | <field name="account"/> | ||
1319 | 30 | <field name="company_id" groups="base.group_multi_company"/> | ||
1320 | 31 | </group> | ||
1321 | 32 | <group> | ||
1322 | 33 | <field name="unreconciled_count"/> | ||
1323 | 34 | <field name="reconciled_partial_count"/> | ||
1324 | 35 | </group> | ||
1325 | 36 | </group> | ||
1326 | 37 | <notebook colspan="4"> | ||
1327 | 38 | <page name="methods" string="Configuration"> | ||
1328 | 39 | <field name="reconcile_method" colspan = "4" nolabel="1"/> | ||
1329 | 40 | </page> | ||
1330 | 41 | <page name="history" string="History"> | ||
1331 | 42 | <field name="history_ids" nolabel="1"> | ||
1332 | 43 | <tree string="Automatic Easy Reconcile History"> | ||
1333 | 44 | <field name="date"/> | ||
1334 | 45 | <button icon="STOCK_JUMP_TO" name="open_reconcile" | ||
1335 | 46 | string="Go to reconciled items" type="object"/> | ||
1336 | 47 | <button icon="STOCK_JUMP_TO" name="open_partial" | ||
1337 | 48 | string="Go to partially reconciled items" type="object"/> | ||
1338 | 49 | </tree> | ||
1339 | 50 | </field> | ||
1340 | 51 | </page> | ||
1341 | 52 | <page name="information" string="Information"> | ||
1342 | 53 | <separator colspan="4" string="Simple. Amount and Name"/> | ||
1343 | 54 | <label string="Match one debit line vs one credit line. Do not allow partial reconciliation. | ||
1344 | 55 | The lines should have the same amount (with the write-off) and the same name to be reconciled." colspan="4"/> | ||
1345 | 56 | |||
1346 | 57 | <separator colspan="4" string="Simple. Amount and Partner"/> | ||
1347 | 58 | <label string="Match one debit line vs one credit line. Do not allow partial reconciliation. | ||
1348 | 59 | The lines should have the same amount (with the write-off) and the same partner to be reconciled." colspan="4"/> | ||
1349 | 60 | |||
1350 | 61 | <separator colspan="4" string="Simple. Amount and Reference"/> | ||
1351 | 62 | <label string="Match one debit line vs one credit line. Do not allow partial reconciliation. | ||
1352 | 63 | The lines should have the same amount (with the write-off) and the same reference to be reconciled." colspan="4"/> | ||
1353 | 64 | |||
1354 | 65 | </page> | ||
1355 | 66 | </notebook> | ||
1356 | 67 | </sheet> | ||
1357 | 68 | </form> | ||
1358 | 69 | </field> | ||
1359 | 70 | </record> | ||
1360 | 71 | |||
1361 | 72 | <record id="account_easy_reconcile_tree" model="ir.ui.view"> | ||
1362 | 73 | <field name="name">account.easy.reconcile.tree</field> | ||
1363 | 74 | <field name="priority">20</field> | ||
1364 | 75 | <field name="model">account.easy.reconcile</field> | ||
1365 | 76 | <field name="arch" type="xml"> | ||
1366 | 77 | <tree string="Automatic Easy Reconcile"> | ||
1367 | 78 | <field name="name"/> | ||
1368 | 79 | <field name="account"/> | ||
1369 | 80 | <field name="company_id" groups="base.group_multi_company"/> | ||
1370 | 81 | <field name="unreconciled_count"/> | ||
1371 | 82 | <field name="reconciled_partial_count"/> | ||
1372 | 83 | <button icon="gtk-ok" name="run_reconcile" colspan="4" | ||
1373 | 84 | string="Start Auto Reconcilation" type="object"/> | ||
1374 | 85 | <button icon="STOCK_JUMP_TO" name="last_history_reconcile" colspan="2" | ||
1375 | 86 | string="Display items reconciled on the last run" type="object"/> | ||
1376 | 87 | <button icon="STOCK_JUMP_TO" name="last_history_partial" colspan="2" | ||
1377 | 88 | string="Display items partially reconciled on the last run" | ||
1378 | 89 | type="object"/> | ||
1379 | 90 | </tree> | ||
1380 | 91 | </field> | ||
1381 | 92 | </record> | ||
1382 | 93 | |||
1383 | 94 | <record id="action_account_easy_reconcile" model="ir.actions.act_window"> | ||
1384 | 95 | <field name="name">Easy Automatic Reconcile</field> | ||
1385 | 96 | <field name="type">ir.actions.act_window</field> | ||
1386 | 97 | <field name="res_model">account.easy.reconcile</field> | ||
1387 | 98 | <field name="view_type">form</field> | ||
1388 | 99 | <field name="view_mode">tree,form</field> | ||
1389 | 100 | <field name="help" type="html"> | ||
1390 | 101 | <p class="oe_view_nocontent_create"> | ||
1391 | 102 | Click to add a reconciliation profile. | ||
1392 | 103 | </p><p> | ||
1393 | 104 | A reconciliation profile specifies, for one account, how | ||
1394 | 105 | the entries should be reconciled. | ||
1395 | 106 | You can select one or many reconciliation methods which will | ||
1396 | 107 | be run sequentially to match the entries between them. | ||
1397 | 108 | </p> | ||
1398 | 109 | </field> | ||
1399 | 110 | </record> | ||
1400 | 111 | |||
1401 | 112 | |||
1402 | 113 | <!-- account.easy.reconcile.method view --> | ||
1403 | 114 | |||
1404 | 115 | <record id="account_easy_reconcile_method_form" model="ir.ui.view"> | ||
1405 | 116 | <field name="name">account.easy.reconcile.method.form</field> | ||
1406 | 117 | <field name="priority">20</field> | ||
1407 | 118 | <field name="model">account.easy.reconcile.method</field> | ||
1408 | 119 | <field name="arch" type="xml"> | ||
1409 | 120 | <form string="Automatic Easy Reconcile Method"> | ||
1410 | 121 | <field name="sequence"/> | ||
1411 | 122 | <field name="name"/> | ||
1412 | 123 | <field name="write_off"/> | ||
1413 | 124 | <field name="account_lost_id" attrs="{'required':[('write_off','>',0)]}"/> | ||
1414 | 125 | <field name="account_profit_id" attrs="{'required':[('write_off','>',0)]}"/> | ||
1415 | 126 | <field name="journal_id" attrs="{'required':[('write_off','>',0)]}"/> | ||
1416 | 127 | <field name="date_base_on"/> | ||
1417 | 128 | </form> | ||
1418 | 129 | </field> | ||
1419 | 130 | </record> | ||
1420 | 131 | |||
1421 | 132 | <record id="account_easy_reconcile_method_tree" model="ir.ui.view"> | ||
1422 | 133 | <field name="name">account.easy.reconcile.method.tree</field> | ||
1423 | 134 | <field name="priority">20</field> | ||
1424 | 135 | <field name="model">account.easy.reconcile.method</field> | ||
1425 | 136 | <field name="arch" type="xml"> | ||
1426 | 137 | <tree editable="top" string="Automatic Easy Reconcile Method"> | ||
1427 | 138 | <field name="sequence"/> | ||
1428 | 139 | <field name="name"/> | ||
1429 | 140 | <field name="write_off"/> | ||
1430 | 141 | <field name="account_lost_id" attrs="{'required':[('write_off','>',0)]}"/> | ||
1431 | 142 | <field name="account_profit_id" attrs="{'required':[('write_off','>',0)]}"/> | ||
1432 | 143 | <field name="journal_id" attrs="{'required':[('write_off','>',0)]}"/> | ||
1433 | 144 | <field name="date_base_on"/> | ||
1434 | 145 | </tree> | ||
1435 | 146 | </field> | ||
1436 | 147 | </record> | ||
1437 | 148 | |||
1438 | 149 | <!-- menu item --> | ||
1439 | 150 | |||
1440 | 151 | <menuitem action="action_account_easy_reconcile" | ||
1441 | 152 | id="menu_easy_reconcile" | ||
1442 | 153 | parent="account.periodical_processing_reconciliation"/> | ||
1443 | 154 | |||
1444 | 155 | </data> | ||
1445 | 156 | </openerp> | ||
1446 | 0 | 157 | ||
1447 | === added file 'account_easy_reconcile/easy_reconcile_history.py' | |||
1448 | --- account_easy_reconcile/easy_reconcile_history.py 1970-01-01 00:00:00 +0000 | |||
1449 | +++ account_easy_reconcile/easy_reconcile_history.py 2013-07-17 14:55:41 +0000 | |||
1450 | @@ -0,0 +1,153 @@ | |||
1451 | 1 | # -*- coding: utf-8 -*- | ||
1452 | 2 | ############################################################################## | ||
1453 | 3 | # | ||
1454 | 4 | # Author: Guewen Baconnier | ||
1455 | 5 | # Copyright 2012 Camptocamp SA | ||
1456 | 6 | # | ||
1457 | 7 | # This program is free software: you can redistribute it and/or modify | ||
1458 | 8 | # it under the terms of the GNU Affero General Public License as | ||
1459 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
1460 | 10 | # License, or (at your option) any later version. | ||
1461 | 11 | # | ||
1462 | 12 | # This program is distributed in the hope that it will be useful, | ||
1463 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1464 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1465 | 15 | # GNU Affero General Public License for more details. | ||
1466 | 16 | # | ||
1467 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
1468 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1469 | 19 | # | ||
1470 | 20 | ############################################################################## | ||
1471 | 21 | |||
1472 | 22 | from openerp.osv import orm, fields | ||
1473 | 23 | from openerp.tools.translate import _ | ||
1474 | 24 | |||
1475 | 25 | |||
1476 | 26 | class easy_reconcile_history(orm.Model): | ||
1477 | 27 | """ Store an history of the runs per profile | ||
1478 | 28 | Each history stores the list of reconciliations done""" | ||
1479 | 29 | |||
1480 | 30 | _name = 'easy.reconcile.history' | ||
1481 | 31 | _rec_name = 'easy_reconcile_id' | ||
1482 | 32 | _order = 'date DESC' | ||
1483 | 33 | |||
1484 | 34 | def _reconcile_line_ids(self, cr, uid, ids, name, args, context=None): | ||
1485 | 35 | result = {} | ||
1486 | 36 | |||
1487 | 37 | for history in self.browse(cr, uid, ids, context=context): | ||
1488 | 38 | result[history.id] = {} | ||
1489 | 39 | |||
1490 | 40 | move_line_ids = [] | ||
1491 | 41 | for reconcile in history.reconcile_ids: | ||
1492 | 42 | move_line_ids += [line.id | ||
1493 | 43 | for line | ||
1494 | 44 | in reconcile.line_id] | ||
1495 | 45 | result[history.id]['reconcile_line_ids'] = move_line_ids | ||
1496 | 46 | |||
1497 | 47 | move_line_ids = [] | ||
1498 | 48 | for reconcile in history.reconcile_partial_ids: | ||
1499 | 49 | move_line_ids += [line.id | ||
1500 | 50 | for line | ||
1501 | 51 | in reconcile.line_partial_ids] | ||
1502 | 52 | result[history.id]['partial_line_ids'] = move_line_ids | ||
1503 | 53 | |||
1504 | 54 | return result | ||
1505 | 55 | |||
1506 | 56 | _columns = { | ||
1507 | 57 | 'easy_reconcile_id': fields.many2one( | ||
1508 | 58 | 'account.easy.reconcile', 'Reconcile Profile', readonly=True), | ||
1509 | 59 | 'date': fields.datetime('Run date', readonly=True), | ||
1510 | 60 | 'reconcile_ids': fields.many2many( | ||
1511 | 61 | 'account.move.reconcile', | ||
1512 | 62 | 'account_move_reconcile_history_rel', | ||
1513 | 63 | string='Reconciliations', readonly=True), | ||
1514 | 64 | 'reconcile_partial_ids': fields.many2many( | ||
1515 | 65 | 'account.move.reconcile', | ||
1516 | 66 | 'account_move_reconcile_history_partial_rel', | ||
1517 | 67 | string='Partial Reconciliations', readonly=True), | ||
1518 | 68 | 'reconcile_line_ids': | ||
1519 | 69 | fields.function( | ||
1520 | 70 | _reconcile_line_ids, | ||
1521 | 71 | string='Reconciled Items', | ||
1522 | 72 | type='many2many', | ||
1523 | 73 | relation='account.move.line', | ||
1524 | 74 | readonly=True, | ||
1525 | 75 | multi='lines'), | ||
1526 | 76 | 'partial_line_ids': | ||
1527 | 77 | fields.function( | ||
1528 | 78 | _reconcile_line_ids, | ||
1529 | 79 | string='Partially Reconciled Items', | ||
1530 | 80 | type='many2many', | ||
1531 | 81 | relation='account.move.line', | ||
1532 | 82 | readonly=True, | ||
1533 | 83 | multi='lines'), | ||
1534 | 84 | 'company_id': fields.related('easy_reconcile_id','company_id', | ||
1535 | 85 | relation='res.company', | ||
1536 | 86 | type='many2one', | ||
1537 | 87 | string='Company', | ||
1538 | 88 | store=True, | ||
1539 | 89 | readonly=True), | ||
1540 | 90 | |||
1541 | 91 | } | ||
1542 | 92 | |||
1543 | 93 | def _open_move_lines(self, cr, uid, history_id, rec_type='full', context=None): | ||
1544 | 94 | """ For an history record, open the view of move line with | ||
1545 | 95 | the reconciled or partially reconciled move lines | ||
1546 | 96 | |||
1547 | 97 | :param history_id: id of the history | ||
1548 | 98 | :param rec_type: 'full' or 'partial' | ||
1549 | 99 | :return: action to open the move lines | ||
1550 | 100 | """ | ||
1551 | 101 | assert rec_type in ('full', 'partial'), \ | ||
1552 | 102 | "rec_type must be 'full' or 'partial'" | ||
1553 | 103 | |||
1554 | 104 | history = self.browse(cr, uid, history_id, context=context) | ||
1555 | 105 | |||
1556 | 106 | if rec_type == 'full': | ||
1557 | 107 | field = 'reconcile_line_ids' | ||
1558 | 108 | name = _('Reconciliations') | ||
1559 | 109 | else: | ||
1560 | 110 | field = 'partial_line_ids' | ||
1561 | 111 | name = _('Partial Reconciliations') | ||
1562 | 112 | |||
1563 | 113 | move_line_ids = [line.id for line in getattr(history, field)] | ||
1564 | 114 | |||
1565 | 115 | return { | ||
1566 | 116 | 'name': name, | ||
1567 | 117 | 'view_mode': 'tree,form', | ||
1568 | 118 | 'view_id': False, | ||
1569 | 119 | 'view_type': 'form', | ||
1570 | 120 | 'res_model': 'account.move.line', | ||
1571 | 121 | 'type': 'ir.actions.act_window', | ||
1572 | 122 | 'nodestroy': True, | ||
1573 | 123 | 'target': 'current', | ||
1574 | 124 | 'domain': unicode([('id', 'in', move_line_ids)]), | ||
1575 | 125 | } | ||
1576 | 126 | |||
1577 | 127 | def open_reconcile(self, cr, uid, history_ids, context=None): | ||
1578 | 128 | """ For an history record, open the view of move line | ||
1579 | 129 | with the reconciled move lines | ||
1580 | 130 | |||
1581 | 131 | :param history_ids: id of the record as int or long | ||
1582 | 132 | Accept a list with 1 id too to be | ||
1583 | 133 | used from the client. | ||
1584 | 134 | """ | ||
1585 | 135 | if isinstance(history_ids, (tuple, list)): | ||
1586 | 136 | assert len(history_ids) == 1, "only 1 ID is accepted" | ||
1587 | 137 | history_ids = history_ids[0] | ||
1588 | 138 | return self._open_move_lines( | ||
1589 | 139 | cr, uid, history_ids, rec_type='full', context=None) | ||
1590 | 140 | |||
1591 | 141 | def open_partial(self, cr, uid, history_ids, context=None): | ||
1592 | 142 | """ For an history record, open the view of move line | ||
1593 | 143 | with the partially reconciled move lines | ||
1594 | 144 | |||
1595 | 145 | :param history_ids: id of the record as int or long | ||
1596 | 146 | Accept a list with 1 id too to be | ||
1597 | 147 | used from the client. | ||
1598 | 148 | """ | ||
1599 | 149 | if isinstance(history_ids, (tuple, list)): | ||
1600 | 150 | assert len(history_ids) == 1, "only 1 ID is accepted" | ||
1601 | 151 | history_ids = history_ids[0] | ||
1602 | 152 | return self._open_move_lines( | ||
1603 | 153 | cr, uid, history_ids, rec_type='partial', context=None) | ||
1604 | 0 | 154 | ||
1605 | === added file 'account_easy_reconcile/easy_reconcile_history_view.xml' | |||
1606 | --- account_easy_reconcile/easy_reconcile_history_view.xml 1970-01-01 00:00:00 +0000 | |||
1607 | +++ account_easy_reconcile/easy_reconcile_history_view.xml 2013-07-17 14:55:41 +0000 | |||
1608 | @@ -0,0 +1,98 @@ | |||
1609 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
1610 | 2 | <openerp> | ||
1611 | 3 | <data noupdate="0"> | ||
1612 | 4 | |||
1613 | 5 | <record id="view_easy_reconcile_history_search" model="ir.ui.view"> | ||
1614 | 6 | <field name="name">easy.reconcile.history.search</field> | ||
1615 | 7 | <field name="model">easy.reconcile.history</field> | ||
1616 | 8 | <field name="arch" type="xml"> | ||
1617 | 9 | <search string="Automatic Easy Reconcile History"> | ||
1618 | 10 | <filter icon="terp-go-today" string="Today" | ||
1619 | 11 | domain="[('date','<', time.strftime('%%Y-%%m-%%d 23:59:59')), ('date','>=', time.strftime('%%Y-%%m-%%d 00:00:00'))]" | ||
1620 | 12 | help="Todays' Reconcilations" /> | ||
1621 | 13 | <filter icon="terp-go-week" string="7 Days" | ||
1622 | 14 | help="Reconciliations of last 7 days" | ||
1623 | 15 | domain="[('date','<', time.strftime('%%Y-%%m-%%d 23:59:59')),('date','>=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d 00:00:00'))]" | ||
1624 | 16 | /> | ||
1625 | 17 | |||
1626 | 18 | <separator orientation="vertical"/> | ||
1627 | 19 | <field name="easy_reconcile_id"/> | ||
1628 | 20 | <field name="date"/> | ||
1629 | 21 | |||
1630 | 22 | <newline/> | ||
1631 | 23 | <group expand="0" string="Group By..."> | ||
1632 | 24 | <filter string="Reconciliation Profile" | ||
1633 | 25 | icon="terp-stock_effects-object-colorize" | ||
1634 | 26 | domain="[]" context="{'group_by': 'easy_reconcile_id'}"/> | ||
1635 | 27 | <filter string="Date" icon="terp-go-month" domain="[]" | ||
1636 | 28 | context="{'group_by': 'date'}"/> | ||
1637 | 29 | </group> | ||
1638 | 30 | </search> | ||
1639 | 31 | </field> | ||
1640 | 32 | </record> | ||
1641 | 33 | |||
1642 | 34 | <record id="easy_reconcile_history_form" model="ir.ui.view"> | ||
1643 | 35 | <field name="name">easy.reconcile.history.form</field> | ||
1644 | 36 | <field name="model">easy.reconcile.history</field> | ||
1645 | 37 | <field name="arch" type="xml"> | ||
1646 | 38 | <form string="Automatic Easy Reconcile History" version="7.0"> | ||
1647 | 39 | <header> | ||
1648 | 40 | <button name="open_reconcile" | ||
1649 | 41 | string="Go to reconciled items" | ||
1650 | 42 | icon="STOCK_JUMP_TO" type="object"/> | ||
1651 | 43 | <button name="open_partial" | ||
1652 | 44 | string="Go to partially reconciled items" | ||
1653 | 45 | icon="STOCK_JUMP_TO" type="object"/> | ||
1654 | 46 | </header> | ||
1655 | 47 | <sheet> | ||
1656 | 48 | <group> | ||
1657 | 49 | <field name="easy_reconcile_id"/> | ||
1658 | 50 | <field name="date"/> | ||
1659 | 51 | <field name="company_id" groups="base.group_multi_company"/> | ||
1660 | 52 | </group> | ||
1661 | 53 | <group col="2"> | ||
1662 | 54 | <separator colspan="2" string="Reconciliations"/> | ||
1663 | 55 | <field name="reconcile_ids" nolabel="1"/> | ||
1664 | 56 | </group> | ||
1665 | 57 | <group col="2"> | ||
1666 | 58 | <separator colspan="2" string="Partial Reconciliations"/> | ||
1667 | 59 | <field name="reconcile_partial_ids" nolabel="1"/> | ||
1668 | 60 | </group> | ||
1669 | 61 | </sheet> | ||
1670 | 62 | </form> | ||
1671 | 63 | </field> | ||
1672 | 64 | </record> | ||
1673 | 65 | |||
1674 | 66 | <record id="easy_reconcile_history_tree" model="ir.ui.view"> | ||
1675 | 67 | <field name="name">easy.reconcile.history.tree</field> | ||
1676 | 68 | <field name="model">easy.reconcile.history</field> | ||
1677 | 69 | <field name="arch" type="xml"> | ||
1678 | 70 | <tree string="Automatic Easy Reconcile History"> | ||
1679 | 71 | <field name="easy_reconcile_id"/> | ||
1680 | 72 | <field name="date"/> | ||
1681 | 73 | <button icon="STOCK_JUMP_TO" name="open_reconcile" | ||
1682 | 74 | string="Go to reconciled items" type="object"/> | ||
1683 | 75 | <button icon="STOCK_JUMP_TO" name="open_partial" | ||
1684 | 76 | string="Go to partially reconciled items" type="object"/> | ||
1685 | 77 | </tree> | ||
1686 | 78 | </field> | ||
1687 | 79 | </record> | ||
1688 | 80 | |||
1689 | 81 | <record id="action_easy_reconcile_history" model="ir.actions.act_window"> | ||
1690 | 82 | <field name="name">Easy Automatic Reconcile History</field> | ||
1691 | 83 | <field name="type">ir.actions.act_window</field> | ||
1692 | 84 | <field name="res_model">easy.reconcile.history</field> | ||
1693 | 85 | <field name="view_type">form</field> | ||
1694 | 86 | <field name="view_mode">tree,form</field> | ||
1695 | 87 | </record> | ||
1696 | 88 | |||
1697 | 89 | <act_window | ||
1698 | 90 | context="{'search_default_easy_reconcile_id': [active_id], 'default_easy_reconcile_id': active_id}" | ||
1699 | 91 | id="act_easy_reconcile_to_history" | ||
1700 | 92 | name="History Details" | ||
1701 | 93 | groups="" | ||
1702 | 94 | res_model="easy.reconcile.history" | ||
1703 | 95 | src_model="account.easy.reconcile"/> | ||
1704 | 96 | |||
1705 | 97 | </data> | ||
1706 | 98 | </openerp> | ||
1707 | 0 | 99 | ||
1708 | === added directory 'account_easy_reconcile/i18n' | |||
1709 | === added file 'account_easy_reconcile/i18n/fr.po' | |||
1710 | --- account_easy_reconcile/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
1711 | +++ account_easy_reconcile/i18n/fr.po 2013-07-17 14:55:41 +0000 | |||
1712 | @@ -0,0 +1,425 @@ | |||
1713 | 1 | # Translation of OpenERP Server. | ||
1714 | 2 | # This file contains the translation of the following modules: | ||
1715 | 3 | # * account_easy_reconcile | ||
1716 | 4 | # | ||
1717 | 5 | msgid "" | ||
1718 | 6 | msgstr "" | ||
1719 | 7 | "Project-Id-Version: OpenERP Server 6.1\n" | ||
1720 | 8 | "Report-Msgid-Bugs-To: \n" | ||
1721 | 9 | "POT-Creation-Date: 2013-01-04 08:39+0000\n" | ||
1722 | 10 | "PO-Revision-Date: 2013-01-04 09:55+0100\n" | ||
1723 | 11 | "Last-Translator: Guewen Baconnier <guewen.baconnier@camptocamp.com>\n" | ||
1724 | 12 | "Language-Team: \n" | ||
1725 | 13 | "Language: \n" | ||
1726 | 14 | "MIME-Version: 1.0\n" | ||
1727 | 15 | "Content-Type: text/plain; charset=UTF-8\n" | ||
1728 | 16 | "Content-Transfer-Encoding: 8bit\n" | ||
1729 | 17 | "Plural-Forms: \n" | ||
1730 | 18 | |||
1731 | 19 | #. module: account_easy_reconcile | ||
1732 | 20 | #: code:addons/account_easy_reconcile/easy_reconcile_history.py:101 | ||
1733 | 21 | #: view:easy.reconcile.history:0 | ||
1734 | 22 | #: field:easy.reconcile.history,reconcile_ids:0 | ||
1735 | 23 | #, python-format | ||
1736 | 24 | msgid "Reconciliations" | ||
1737 | 25 | msgstr "Lettrages" | ||
1738 | 26 | |||
1739 | 27 | #. module: account_easy_reconcile | ||
1740 | 28 | #: view:account.easy.reconcile:0 | ||
1741 | 29 | #: view:easy.reconcile.history:0 | ||
1742 | 30 | msgid "Automatic Easy Reconcile History" | ||
1743 | 31 | msgstr "Historique des lettrages automatisés" | ||
1744 | 32 | |||
1745 | 33 | #. module: account_easy_reconcile | ||
1746 | 34 | #: view:account.easy.reconcile:0 | ||
1747 | 35 | msgid "Information" | ||
1748 | 36 | msgstr "Information" | ||
1749 | 37 | |||
1750 | 38 | #. module: account_easy_reconcile | ||
1751 | 39 | #: view:account.easy.reconcile:0 | ||
1752 | 40 | #: view:easy.reconcile.history:0 | ||
1753 | 41 | msgid "Go to partially reconciled items" | ||
1754 | 42 | msgstr "Voir les entrées partiellement lettrées" | ||
1755 | 43 | |||
1756 | 44 | #. module: account_easy_reconcile | ||
1757 | 45 | #: help:account.easy.reconcile.method,sequence:0 | ||
1758 | 46 | msgid "The sequence field is used to order the reconcile method" | ||
1759 | 47 | msgstr "La séquence détermine l'ordre des méthodes de lettrage" | ||
1760 | 48 | |||
1761 | 49 | #. module: account_easy_reconcile | ||
1762 | 50 | #: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_history | ||
1763 | 51 | msgid "easy.reconcile.history" | ||
1764 | 52 | msgstr "easy.reconcile.history" | ||
1765 | 53 | |||
1766 | 54 | #. module: account_easy_reconcile | ||
1767 | 55 | #: model:ir.actions.act_window,help:account_easy_reconcile.action_account_easy_reconcile | ||
1768 | 56 | msgid "" | ||
1769 | 57 | "<p class=\"oe_view_nocontent_create\">\n" | ||
1770 | 58 | " Click to add a reconciliation profile.\n" | ||
1771 | 59 | " </p><p>\n" | ||
1772 | 60 | " A reconciliation profile specifies, for one account, how\n" | ||
1773 | 61 | " the entries should be reconciled.\n" | ||
1774 | 62 | " You can select one or many reconciliation methods which will\n" | ||
1775 | 63 | " be run sequentially to match the entries between them.\n" | ||
1776 | 64 | " </p>\n" | ||
1777 | 65 | " " | ||
1778 | 66 | msgstr "" | ||
1779 | 67 | "<p class=\"oe_view_nocontent_create\">\n" | ||
1780 | 68 | " Cliquez pour ajouter un profil de lettrage.\n" | ||
1781 | 69 | " </p><p>\n" | ||
1782 | 70 | " Un profil de lettrage spécifie, pour un compte, comment\n" | ||
1783 | 71 | " les écritures doivent être lettrées.\n" | ||
1784 | 72 | " Vous pouvez sélectionner une ou plusieurs méthodes de lettrage\n" | ||
1785 | 73 | " qui seront lancées successivement pour identifier les écritures\n" | ||
1786 | 74 | " devant être lettrées. </p>\n" | ||
1787 | 75 | " " | ||
1788 | 76 | |||
1789 | 77 | #. module: account_easy_reconcile | ||
1790 | 78 | #: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_options | ||
1791 | 79 | msgid "easy.reconcile.options" | ||
1792 | 80 | msgstr "easy.reconcile.options" | ||
1793 | 81 | |||
1794 | 82 | #. module: account_easy_reconcile | ||
1795 | 83 | #: view:easy.reconcile.history:0 | ||
1796 | 84 | msgid "Group By..." | ||
1797 | 85 | msgstr "Grouper par..." | ||
1798 | 86 | |||
1799 | 87 | #. module: account_easy_reconcile | ||
1800 | 88 | #: field:account.easy.reconcile,unreconciled_count:0 | ||
1801 | 89 | msgid "Unreconciled Items" | ||
1802 | 90 | msgstr "Écritures non lettrées" | ||
1803 | 91 | |||
1804 | 92 | #. module: account_easy_reconcile | ||
1805 | 93 | #: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_base | ||
1806 | 94 | msgid "easy.reconcile.base" | ||
1807 | 95 | msgstr "easy.reconcile.base" | ||
1808 | 96 | |||
1809 | 97 | #. module: account_easy_reconcile | ||
1810 | 98 | #: field:easy.reconcile.history,reconcile_line_ids:0 | ||
1811 | 99 | msgid "Reconciled Items" | ||
1812 | 100 | msgstr "Écritures lettrées" | ||
1813 | 101 | |||
1814 | 102 | #. module: account_easy_reconcile | ||
1815 | 103 | #: field:account.easy.reconcile,reconcile_method:0 | ||
1816 | 104 | msgid "Method" | ||
1817 | 105 | msgstr "Méthode" | ||
1818 | 106 | |||
1819 | 107 | #. module: account_easy_reconcile | ||
1820 | 108 | #: view:easy.reconcile.history:0 | ||
1821 | 109 | msgid "7 Days" | ||
1822 | 110 | msgstr "7 jours" | ||
1823 | 111 | |||
1824 | 112 | #. module: account_easy_reconcile | ||
1825 | 113 | #: model:ir.actions.act_window,name:account_easy_reconcile.action_easy_reconcile_history | ||
1826 | 114 | msgid "Easy Automatic Reconcile History" | ||
1827 | 115 | msgstr "Lettrage automatisé" | ||
1828 | 116 | |||
1829 | 117 | #. module: account_easy_reconcile | ||
1830 | 118 | #: field:easy.reconcile.history,date:0 | ||
1831 | 119 | msgid "Run date" | ||
1832 | 120 | msgstr "Date de lancement" | ||
1833 | 121 | |||
1834 | 122 | #. module: account_easy_reconcile | ||
1835 | 123 | #: view:account.easy.reconcile:0 | ||
1836 | 124 | msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same reference to be reconciled." | ||
1837 | 125 | msgstr "Lettre un débit avec un crédit ayant le même montant et la même référence. Le lettrage ne peut être partiel (écriture d'ajustement en cas d'écart)." | ||
1838 | 126 | |||
1839 | 127 | #. module: account_easy_reconcile | ||
1840 | 128 | #: model:ir.actions.act_window,name:account_easy_reconcile.act_easy_reconcile_to_history | ||
1841 | 129 | msgid "History Details" | ||
1842 | 130 | msgstr "Détails de l'historique" | ||
1843 | 131 | |||
1844 | 132 | #. module: account_easy_reconcile | ||
1845 | 133 | #: view:account.easy.reconcile:0 | ||
1846 | 134 | msgid "Display items reconciled on the last run" | ||
1847 | 135 | msgstr "Voir les entrées lettrées au dernier lettrage" | ||
1848 | 136 | |||
1849 | 137 | #. module: account_easy_reconcile | ||
1850 | 138 | #: field:account.easy.reconcile.method,name:0 | ||
1851 | 139 | msgid "Type" | ||
1852 | 140 | msgstr "Type" | ||
1853 | 141 | |||
1854 | 142 | #. module: account_easy_reconcile | ||
1855 | 143 | #: field:account.easy.reconcile.method,journal_id:0 | ||
1856 | 144 | #: field:easy.reconcile.base,journal_id:0 | ||
1857 | 145 | #: field:easy.reconcile.options,journal_id:0 | ||
1858 | 146 | #: field:easy.reconcile.simple,journal_id:0 | ||
1859 | 147 | #: field:easy.reconcile.simple.name,journal_id:0 | ||
1860 | 148 | #: field:easy.reconcile.simple.partner,journal_id:0 | ||
1861 | 149 | #: field:easy.reconcile.simple.reference,journal_id:0 | ||
1862 | 150 | msgid "Journal" | ||
1863 | 151 | msgstr "Journal" | ||
1864 | 152 | |||
1865 | 153 | #. module: account_easy_reconcile | ||
1866 | 154 | #: field:account.easy.reconcile.method,account_profit_id:0 | ||
1867 | 155 | #: field:easy.reconcile.base,account_profit_id:0 | ||
1868 | 156 | #: field:easy.reconcile.options,account_profit_id:0 | ||
1869 | 157 | #: field:easy.reconcile.simple,account_profit_id:0 | ||
1870 | 158 | #: field:easy.reconcile.simple.name,account_profit_id:0 | ||
1871 | 159 | #: field:easy.reconcile.simple.partner,account_profit_id:0 | ||
1872 | 160 | #: field:easy.reconcile.simple.reference,account_profit_id:0 | ||
1873 | 161 | msgid "Account Profit" | ||
1874 | 162 | msgstr "Compte de profits" | ||
1875 | 163 | |||
1876 | 164 | #. module: account_easy_reconcile | ||
1877 | 165 | #: view:easy.reconcile.history:0 | ||
1878 | 166 | msgid "Todays' Reconcilations" | ||
1879 | 167 | msgstr "Lettrages du jour" | ||
1880 | 168 | |||
1881 | 169 | #. module: account_easy_reconcile | ||
1882 | 170 | #: view:account.easy.reconcile:0 | ||
1883 | 171 | msgid "Simple. Amount and Name" | ||
1884 | 172 | msgstr "Simple. Montant et description" | ||
1885 | 173 | |||
1886 | 174 | #. module: account_easy_reconcile | ||
1887 | 175 | #: field:easy.reconcile.base,partner_ids:0 | ||
1888 | 176 | #: field:easy.reconcile.simple,partner_ids:0 | ||
1889 | 177 | #: field:easy.reconcile.simple.name,partner_ids:0 | ||
1890 | 178 | #: field:easy.reconcile.simple.partner,partner_ids:0 | ||
1891 | 179 | #: field:easy.reconcile.simple.reference,partner_ids:0 | ||
1892 | 180 | msgid "Restrict on partners" | ||
1893 | 181 | msgstr "Filtrer sur des partenaires" | ||
1894 | 182 | |||
1895 | 183 | #. module: account_easy_reconcile | ||
1896 | 184 | #: model:ir.actions.act_window,name:account_easy_reconcile.action_account_easy_reconcile | ||
1897 | 185 | #: model:ir.ui.menu,name:account_easy_reconcile.menu_easy_reconcile | ||
1898 | 186 | msgid "Easy Automatic Reconcile" | ||
1899 | 187 | msgstr "Lettrage automatisé" | ||
1900 | 188 | |||
1901 | 189 | #. module: account_easy_reconcile | ||
1902 | 190 | #: view:easy.reconcile.history:0 | ||
1903 | 191 | msgid "Today" | ||
1904 | 192 | msgstr "Aujourd'hui" | ||
1905 | 193 | |||
1906 | 194 | #. module: account_easy_reconcile | ||
1907 | 195 | #: view:easy.reconcile.history:0 | ||
1908 | 196 | msgid "Date" | ||
1909 | 197 | msgstr "Date" | ||
1910 | 198 | |||
1911 | 199 | #. module: account_easy_reconcile | ||
1912 | 200 | #: field:account.easy.reconcile,last_history:0 | ||
1913 | 201 | msgid "Last History" | ||
1914 | 202 | msgstr "Dernier historique" | ||
1915 | 203 | |||
1916 | 204 | #. module: account_easy_reconcile | ||
1917 | 205 | #: view:account.easy.reconcile:0 | ||
1918 | 206 | msgid "Configuration" | ||
1919 | 207 | msgstr "Configuration" | ||
1920 | 208 | |||
1921 | 209 | #. module: account_easy_reconcile | ||
1922 | 210 | #: field:account.easy.reconcile,reconciled_partial_count:0 | ||
1923 | 211 | #: field:easy.reconcile.history,partial_line_ids:0 | ||
1924 | 212 | msgid "Partially Reconciled Items" | ||
1925 | 213 | msgstr "Écritures partiellement lettrées" | ||
1926 | 214 | |||
1927 | 215 | #. module: account_easy_reconcile | ||
1928 | 216 | #: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_partner | ||
1929 | 217 | msgid "easy.reconcile.simple.partner" | ||
1930 | 218 | msgstr "easy.reconcile.simple.partner" | ||
1931 | 219 | |||
1932 | 220 | #. module: account_easy_reconcile | ||
1933 | 221 | #: field:account.easy.reconcile.method,write_off:0 | ||
1934 | 222 | #: field:easy.reconcile.base,write_off:0 | ||
1935 | 223 | #: field:easy.reconcile.options,write_off:0 | ||
1936 | 224 | #: field:easy.reconcile.simple,write_off:0 | ||
1937 | 225 | #: field:easy.reconcile.simple.name,write_off:0 | ||
1938 | 226 | #: field:easy.reconcile.simple.partner,write_off:0 | ||
1939 | 227 | #: field:easy.reconcile.simple.reference,write_off:0 | ||
1940 | 228 | msgid "Write off allowed" | ||
1941 | 229 | msgstr "Écart autorisé" | ||
1942 | 230 | |||
1943 | 231 | #. module: account_easy_reconcile | ||
1944 | 232 | #: view:account.easy.reconcile:0 | ||
1945 | 233 | msgid "Automatic Easy Reconcile" | ||
1946 | 234 | msgstr "Lettrage automatisé" | ||
1947 | 235 | |||
1948 | 236 | #. module: account_easy_reconcile | ||
1949 | 237 | #: field:account.easy.reconcile,account:0 | ||
1950 | 238 | #: field:easy.reconcile.base,account_id:0 | ||
1951 | 239 | #: field:easy.reconcile.simple,account_id:0 | ||
1952 | 240 | #: field:easy.reconcile.simple.name,account_id:0 | ||
1953 | 241 | #: field:easy.reconcile.simple.partner,account_id:0 | ||
1954 | 242 | #: field:easy.reconcile.simple.reference,account_id:0 | ||
1955 | 243 | msgid "Account" | ||
1956 | 244 | msgstr "Compte" | ||
1957 | 245 | |||
1958 | 246 | #. module: account_easy_reconcile | ||
1959 | 247 | #: field:account.easy.reconcile.method,task_id:0 | ||
1960 | 248 | msgid "Task" | ||
1961 | 249 | msgstr "Tâche" | ||
1962 | 250 | |||
1963 | 251 | #. module: account_easy_reconcile | ||
1964 | 252 | #: field:account.easy.reconcile,name:0 | ||
1965 | 253 | msgid "Name" | ||
1966 | 254 | msgstr "Nom" | ||
1967 | 255 | |||
1968 | 256 | #. module: account_easy_reconcile | ||
1969 | 257 | #: view:account.easy.reconcile:0 | ||
1970 | 258 | msgid "Simple. Amount and Partner" | ||
1971 | 259 | msgstr "Simple. Montant et partenaire" | ||
1972 | 260 | |||
1973 | 261 | #. module: account_easy_reconcile | ||
1974 | 262 | #: view:account.easy.reconcile:0 | ||
1975 | 263 | msgid "Start Auto Reconcilation" | ||
1976 | 264 | msgstr "Lancer le lettrage automatisé" | ||
1977 | 265 | |||
1978 | 266 | #. module: account_easy_reconcile | ||
1979 | 267 | #: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_name | ||
1980 | 268 | msgid "easy.reconcile.simple.name" | ||
1981 | 269 | msgstr "easy.reconcile.simple.name" | ||
1982 | 270 | |||
1983 | 271 | #. module: account_easy_reconcile | ||
1984 | 272 | #: field:account.easy.reconcile.method,filter:0 | ||
1985 | 273 | #: field:easy.reconcile.base,filter:0 | ||
1986 | 274 | #: field:easy.reconcile.options,filter:0 | ||
1987 | 275 | #: field:easy.reconcile.simple,filter:0 | ||
1988 | 276 | #: field:easy.reconcile.simple.name,filter:0 | ||
1989 | 277 | #: field:easy.reconcile.simple.partner,filter:0 | ||
1990 | 278 | #: field:easy.reconcile.simple.reference,filter:0 | ||
1991 | 279 | msgid "Filter" | ||
1992 | 280 | msgstr "Filtre" | ||
1993 | 281 | |||
1994 | 282 | #. module: account_easy_reconcile | ||
1995 | 283 | #: view:account.easy.reconcile:0 | ||
1996 | 284 | msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same partner to be reconciled." | ||
1997 | 285 | msgstr "Lettre un débit avec un crédit ayant le même montant et le même partenaire. Le lettrage ne peut être partiel (écriture d'ajustement en cas d'écart)." | ||
1998 | 286 | |||
1999 | 287 | #. module: account_easy_reconcile | ||
2000 | 288 | #: field:easy.reconcile.history,easy_reconcile_id:0 | ||
2001 | 289 | msgid "Reconcile Profile" | ||
2002 | 290 | msgstr "Profil de réconciliation" | ||
2003 | 291 | |||
2004 | 292 | #. module: account_easy_reconcile | ||
2005 | 293 | #: view:account.easy.reconcile:0 | ||
2006 | 294 | msgid "Start Auto Reconciliation" | ||
2007 | 295 | msgstr "Lancer le lettrage automatisé" | ||
2008 | 296 | |||
2009 | 297 | #. module: account_easy_reconcile | ||
2010 | 298 | #: code:addons/account_easy_reconcile/easy_reconcile.py:250 | ||
2011 | 299 | #, python-format | ||
2012 | 300 | msgid "Error" | ||
2013 | 301 | msgstr "Erreur" | ||
2014 | 302 | |||
2015 | 303 | #. module: account_easy_reconcile | ||
2016 | 304 | #: code:addons/account_easy_reconcile/easy_reconcile.py:251 | ||
2017 | 305 | #, python-format | ||
2018 | 306 | msgid "There is no history of reconciled items on the task: %s." | ||
2019 | 307 | msgstr "Il n'y a pas d'historique d'écritures lettrées sur la tâche: %s." | ||
2020 | 308 | |||
2021 | 309 | #. module: account_easy_reconcile | ||
2022 | 310 | #: view:account.easy.reconcile:0 | ||
2023 | 311 | msgid "Match one debit line vs one credit line. Do not allow partial reconciliation. The lines should have the same amount (with the write-off) and the same name to be reconciled." | ||
2024 | 312 | msgstr "Lettre un débit avec un crédit ayant le même montant et la même description. Le lettrage ne peut être partiel (écriture d'ajustement en cas d'écart)." | ||
2025 | 313 | |||
2026 | 314 | #. module: account_easy_reconcile | ||
2027 | 315 | #: field:account.easy.reconcile.method,account_lost_id:0 | ||
2028 | 316 | #: field:easy.reconcile.base,account_lost_id:0 | ||
2029 | 317 | #: field:easy.reconcile.options,account_lost_id:0 | ||
2030 | 318 | #: field:easy.reconcile.simple,account_lost_id:0 | ||
2031 | 319 | #: field:easy.reconcile.simple.name,account_lost_id:0 | ||
2032 | 320 | #: field:easy.reconcile.simple.partner,account_lost_id:0 | ||
2033 | 321 | #: field:easy.reconcile.simple.reference,account_lost_id:0 | ||
2034 | 322 | msgid "Account Lost" | ||
2035 | 323 | msgstr "Compte de pertes" | ||
2036 | 324 | |||
2037 | 325 | #. module: account_easy_reconcile | ||
2038 | 326 | #: view:easy.reconcile.history:0 | ||
2039 | 327 | msgid "Reconciliation Profile" | ||
2040 | 328 | msgstr "Profil de réconciliation" | ||
2041 | 329 | |||
2042 | 330 | #. module: account_easy_reconcile | ||
2043 | 331 | #: view:account.easy.reconcile:0 | ||
2044 | 332 | #: field:account.easy.reconcile,history_ids:0 | ||
2045 | 333 | msgid "History" | ||
2046 | 334 | msgstr "Historique" | ||
2047 | 335 | |||
2048 | 336 | #. module: account_easy_reconcile | ||
2049 | 337 | #: view:account.easy.reconcile:0 | ||
2050 | 338 | #: view:easy.reconcile.history:0 | ||
2051 | 339 | msgid "Go to reconciled items" | ||
2052 | 340 | msgstr "Voir les entrées lettrées" | ||
2053 | 341 | |||
2054 | 342 | #. module: account_easy_reconcile | ||
2055 | 343 | #: view:account.easy.reconcile:0 | ||
2056 | 344 | msgid "Profile Information" | ||
2057 | 345 | msgstr "Information sur le profil" | ||
2058 | 346 | |||
2059 | 347 | #. module: account_easy_reconcile | ||
2060 | 348 | #: view:account.easy.reconcile.method:0 | ||
2061 | 349 | msgid "Automatic Easy Reconcile Method" | ||
2062 | 350 | msgstr "Méthode de lettrage automatisé" | ||
2063 | 351 | |||
2064 | 352 | #. module: account_easy_reconcile | ||
2065 | 353 | #: view:account.easy.reconcile:0 | ||
2066 | 354 | msgid "Simple. Amount and Reference" | ||
2067 | 355 | msgstr "Simple. Montant et référence" | ||
2068 | 356 | |||
2069 | 357 | #. module: account_easy_reconcile | ||
2070 | 358 | #: view:account.easy.reconcile:0 | ||
2071 | 359 | msgid "Display items partially reconciled on the last run" | ||
2072 | 360 | msgstr "Afficher les entrées partiellement lettrées au dernier lettrage" | ||
2073 | 361 | |||
2074 | 362 | #. module: account_easy_reconcile | ||
2075 | 363 | #: field:account.easy.reconcile.method,sequence:0 | ||
2076 | 364 | msgid "Sequence" | ||
2077 | 365 | msgstr "Séquence" | ||
2078 | 366 | |||
2079 | 367 | #. module: account_easy_reconcile | ||
2080 | 368 | #: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple | ||
2081 | 369 | msgid "easy.reconcile.simple" | ||
2082 | 370 | msgstr "easy.reconcile.simple" | ||
2083 | 371 | |||
2084 | 372 | #. module: account_easy_reconcile | ||
2085 | 373 | #: view:easy.reconcile.history:0 | ||
2086 | 374 | msgid "Reconciliations of last 7 days" | ||
2087 | 375 | msgstr "Lettrages des 7 derniers jours" | ||
2088 | 376 | |||
2089 | 377 | #. module: account_easy_reconcile | ||
2090 | 378 | #: field:account.easy.reconcile.method,date_base_on:0 | ||
2091 | 379 | #: field:easy.reconcile.base,date_base_on:0 | ||
2092 | 380 | #: field:easy.reconcile.options,date_base_on:0 | ||
2093 | 381 | #: field:easy.reconcile.simple,date_base_on:0 | ||
2094 | 382 | #: field:easy.reconcile.simple.name,date_base_on:0 | ||
2095 | 383 | #: field:easy.reconcile.simple.partner,date_base_on:0 | ||
2096 | 384 | #: field:easy.reconcile.simple.reference,date_base_on:0 | ||
2097 | 385 | msgid "Date of reconciliation" | ||
2098 | 386 | msgstr "Date de lettrage" | ||
2099 | 387 | |||
2100 | 388 | #. module: account_easy_reconcile | ||
2101 | 389 | #: code:addons/account_easy_reconcile/easy_reconcile_history.py:104 | ||
2102 | 390 | #: view:easy.reconcile.history:0 | ||
2103 | 391 | #: field:easy.reconcile.history,reconcile_partial_ids:0 | ||
2104 | 392 | #, python-format | ||
2105 | 393 | msgid "Partial Reconciliations" | ||
2106 | 394 | msgstr "Lettrages partiels" | ||
2107 | 395 | |||
2108 | 396 | #. module: account_easy_reconcile | ||
2109 | 397 | #: model:ir.model,name:account_easy_reconcile.model_account_easy_reconcile_method | ||
2110 | 398 | msgid "reconcile method for account_easy_reconcile" | ||
2111 | 399 | msgstr "Méthode de lettrage" | ||
2112 | 400 | |||
2113 | 401 | #. module: account_easy_reconcile | ||
2114 | 402 | #: model:ir.model,name:account_easy_reconcile.model_easy_reconcile_simple_reference | ||
2115 | 403 | msgid "easy.reconcile.simple.reference" | ||
2116 | 404 | msgstr "easy.reconcile.simple.reference" | ||
2117 | 405 | |||
2118 | 406 | #. module: account_easy_reconcile | ||
2119 | 407 | #: model:ir.model,name:account_easy_reconcile.model_account_easy_reconcile | ||
2120 | 408 | msgid "account easy reconcile" | ||
2121 | 409 | msgstr "Lettrage automatisé" | ||
2122 | 410 | |||
2123 | 411 | #~ msgid "Unreconciled Entries" | ||
2124 | 412 | #~ msgstr "Écritures non lettrées" | ||
2125 | 413 | |||
2126 | 414 | #, fuzzy | ||
2127 | 415 | #~ msgid "Partially Reconciled Entries" | ||
2128 | 416 | #~ msgstr "Lettrages partiels" | ||
2129 | 417 | |||
2130 | 418 | #~ msgid "Task Information" | ||
2131 | 419 | #~ msgstr "Information sur la tâche" | ||
2132 | 420 | |||
2133 | 421 | #~ msgid "Reconcile Method" | ||
2134 | 422 | #~ msgstr "Méthode de lettrage" | ||
2135 | 423 | |||
2136 | 424 | #~ msgid "Log" | ||
2137 | 425 | #~ msgstr "Historique" | ||
2138 | 0 | 426 | ||
2139 | === added directory 'account_easy_reconcile/security' | |||
2140 | === added file 'account_easy_reconcile/security/ir.model.access.csv' | |||
2141 | --- account_easy_reconcile/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 | |||
2142 | +++ account_easy_reconcile/security/ir.model.access.csv 2013-07-17 14:55:41 +0000 | |||
2143 | @@ -0,0 +1,15 @@ | |||
2144 | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
2145 | 2 | access_easy_reconcile_options_acc_user,easy.reconcile.options,model_easy_reconcile_options,account.group_account_user,1,0,0,0 | ||
2146 | 3 | access_account_easy_reconcile_method_acc_user,account.easy.reconcile.method,model_account_easy_reconcile_method,account.group_account_user,1,0,0,0 | ||
2147 | 4 | access_account_easy_reconcile_acc_user,account.easy.reconcile,model_account_easy_reconcile,account.group_account_user,1,1,0,0 | ||
2148 | 5 | access_easy_reconcile_simple_name_acc_user,easy.reconcile.simple.name,model_easy_reconcile_simple_name,account.group_account_user,1,0,0,0 | ||
2149 | 6 | access_easy_reconcile_simple_partner_acc_user,easy.reconcile.simple.partner,model_easy_reconcile_simple_partner,account.group_account_user,1,0,0,0 | ||
2150 | 7 | access_easy_reconcile_simple_reference_acc_user,easy.reconcile.simple.reference,model_easy_reconcile_simple_reference,account.group_account_user,1,0,0,0 | ||
2151 | 8 | access_easy_reconcile_options_acc_mgr,easy.reconcile.options,model_easy_reconcile_options,account.group_account_user,1,0,0,0 | ||
2152 | 9 | access_account_easy_reconcile_method_acc_mgr,account.easy.reconcile.method,model_account_easy_reconcile_method,account.group_account_user,1,1,1,1 | ||
2153 | 10 | access_account_easy_reconcile_acc_mgr,account.easy.reconcile,model_account_easy_reconcile,account.group_account_user,1,1,1,1 | ||
2154 | 11 | access_easy_reconcile_simple_name_acc_mgr,easy.reconcile.simple.name,model_easy_reconcile_simple_name,account.group_account_user,1,0,0,0 | ||
2155 | 12 | access_easy_reconcile_simple_partner_acc_mgr,easy.reconcile.simple.partner,model_easy_reconcile_simple_partner,account.group_account_user,1,0,0,0 | ||
2156 | 13 | access_easy_reconcile_simple_reference_acc_mgr,easy.reconcile.simple.reference,model_easy_reconcile_simple_reference,account.group_account_user,1,0,0,0 | ||
2157 | 14 | access_easy_reconcile_history_acc_user,easy.reconcile.history,model_easy_reconcile_history,account.group_account_user,1,1,1,0 | ||
2158 | 15 | access_easy_reconcile_history_acc_mgr,easy.reconcile.history,model_easy_reconcile_history,account.group_account_manager,1,1,1,1 | ||
2159 | 0 | 16 | ||
2160 | === added file 'account_easy_reconcile/security/ir_rule.xml' | |||
2161 | --- account_easy_reconcile/security/ir_rule.xml 1970-01-01 00:00:00 +0000 | |||
2162 | +++ account_easy_reconcile/security/ir_rule.xml 2013-07-17 14:55:41 +0000 | |||
2163 | @@ -0,0 +1,25 @@ | |||
2164 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2165 | 2 | <openerp> | ||
2166 | 3 | <data noupdate="1"> | ||
2167 | 4 | <record id="easy_reconcile_rule" model="ir.rule"> | ||
2168 | 5 | <field name="name">Easy reconcile multi-company</field> | ||
2169 | 6 | <field name="model_id" ref="model_account_easy_reconcile"/> | ||
2170 | 7 | <field name="global" eval="True"/> | ||
2171 | 8 | <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field> | ||
2172 | 9 | </record> | ||
2173 | 10 | |||
2174 | 11 | <record id="easy_reconcile_history_rule" model="ir.rule"> | ||
2175 | 12 | <field name="name">Easy reconcile history multi-company</field> | ||
2176 | 13 | <field name="model_id" ref="model_easy_reconcile_history"/> | ||
2177 | 14 | <field name="global" eval="True"/> | ||
2178 | 15 | <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field> | ||
2179 | 16 | </record> | ||
2180 | 17 | |||
2181 | 18 | <record id="easy_reconcile_method_rule" model="ir.rule"> | ||
2182 | 19 | <field name="name">Easy reconcile method multi-company</field> | ||
2183 | 20 | <field name="model_id" ref="model_account_easy_reconcile_method"/> | ||
2184 | 21 | <field name="global" eval="True"/> | ||
2185 | 22 | <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field> | ||
2186 | 23 | </record> | ||
2187 | 24 | </data> | ||
2188 | 25 | </openerp> | ||
2189 | 0 | 26 | ||
2190 | === added file 'account_easy_reconcile/simple_reconciliation.py' | |||
2191 | --- account_easy_reconcile/simple_reconciliation.py 1970-01-01 00:00:00 +0000 | |||
2192 | +++ account_easy_reconcile/simple_reconciliation.py 2013-07-17 14:55:41 +0000 | |||
2193 | @@ -0,0 +1,120 @@ | |||
2194 | 1 | # -*- coding: utf-8 -*- | ||
2195 | 2 | ############################################################################## | ||
2196 | 3 | # | ||
2197 | 4 | # Copyright 2012-2013 Camptocamp SA (Guewen Baconnier) | ||
2198 | 5 | # Copyright (C) 2010 Sébastien Beau | ||
2199 | 6 | # | ||
2200 | 7 | # This program is free software: you can redistribute it and/or modify | ||
2201 | 8 | # it under the terms of the GNU Affero General Public License as | ||
2202 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
2203 | 10 | # License, or (at your option) any later version. | ||
2204 | 11 | # | ||
2205 | 12 | # This program is distributed in the hope that it will be useful, | ||
2206 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2207 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2208 | 15 | # GNU Affero General Public License for more details. | ||
2209 | 16 | # | ||
2210 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
2211 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2212 | 19 | # | ||
2213 | 20 | ############################################################################## | ||
2214 | 21 | |||
2215 | 22 | from openerp.osv.orm import AbstractModel, TransientModel | ||
2216 | 23 | |||
2217 | 24 | |||
2218 | 25 | class easy_reconcile_simple(AbstractModel): | ||
2219 | 26 | |||
2220 | 27 | _name = 'easy.reconcile.simple' | ||
2221 | 28 | _inherit = 'easy.reconcile.base' | ||
2222 | 29 | |||
2223 | 30 | # has to be subclassed | ||
2224 | 31 | # field name used as key for matching the move lines | ||
2225 | 32 | _key_field = None | ||
2226 | 33 | |||
2227 | 34 | def rec_auto_lines_simple(self, cr, uid, rec, lines, context=None): | ||
2228 | 35 | if context is None: | ||
2229 | 36 | context = {} | ||
2230 | 37 | |||
2231 | 38 | if self._key_field is None: | ||
2232 | 39 | raise ValueError("_key_field has to be defined") | ||
2233 | 40 | |||
2234 | 41 | count = 0 | ||
2235 | 42 | res = [] | ||
2236 | 43 | while (count < len(lines)): | ||
2237 | 44 | for i in xrange(count+1, len(lines)): | ||
2238 | 45 | writeoff_account_id = False | ||
2239 | 46 | if lines[count][self._key_field] != lines[i][self._key_field]: | ||
2240 | 47 | break | ||
2241 | 48 | |||
2242 | 49 | check = False | ||
2243 | 50 | if lines[count]['credit'] > 0 and lines[i]['debit'] > 0: | ||
2244 | 51 | credit_line = lines[count] | ||
2245 | 52 | debit_line = lines[i] | ||
2246 | 53 | check = True | ||
2247 | 54 | elif lines[i]['credit'] > 0 and lines[count]['debit'] > 0: | ||
2248 | 55 | credit_line = lines[i] | ||
2249 | 56 | debit_line = lines[count] | ||
2250 | 57 | check = True | ||
2251 | 58 | if not check: | ||
2252 | 59 | continue | ||
2253 | 60 | |||
2254 | 61 | reconciled, dummy = self._reconcile_lines( | ||
2255 | 62 | cr, uid, rec, [credit_line, debit_line], | ||
2256 | 63 | allow_partial=False, context=context) | ||
2257 | 64 | if reconciled: | ||
2258 | 65 | res += [credit_line['id'], debit_line['id']] | ||
2259 | 66 | del lines[i] | ||
2260 | 67 | break | ||
2261 | 68 | count += 1 | ||
2262 | 69 | return res, [] # empty list for partial, only full rec in "simple" rec | ||
2263 | 70 | |||
2264 | 71 | def _simple_order(self, rec, *args, **kwargs): | ||
2265 | 72 | return "ORDER BY account_move_line.%s" % self._key_field | ||
2266 | 73 | |||
2267 | 74 | def _action_rec(self, cr, uid, rec, context=None): | ||
2268 | 75 | """Match only 2 move lines, do not allow partial reconcile""" | ||
2269 | 76 | select = self._select(rec) | ||
2270 | 77 | select += ", account_move_line.%s " % self._key_field | ||
2271 | 78 | where, params = self._where(rec) | ||
2272 | 79 | where += " AND account_move_line.%s IS NOT NULL " % self._key_field | ||
2273 | 80 | |||
2274 | 81 | where2, params2 = self._get_filter(cr, uid, rec, context=context) | ||
2275 | 82 | query = ' '.join(( | ||
2276 | 83 | select, | ||
2277 | 84 | self._from(rec), | ||
2278 | 85 | where, where2, | ||
2279 | 86 | self._simple_order(rec))) | ||
2280 | 87 | |||
2281 | 88 | cr.execute(query, params + params2) | ||
2282 | 89 | lines = cr.dictfetchall() | ||
2283 | 90 | return self.rec_auto_lines_simple(cr, uid, rec, lines, context) | ||
2284 | 91 | |||
2285 | 92 | |||
2286 | 93 | class easy_reconcile_simple_name(TransientModel): | ||
2287 | 94 | |||
2288 | 95 | _name = 'easy.reconcile.simple.name' | ||
2289 | 96 | _inherit = 'easy.reconcile.simple' | ||
2290 | 97 | |||
2291 | 98 | # has to be subclassed | ||
2292 | 99 | # field name used as key for matching the move lines | ||
2293 | 100 | _key_field = 'name' | ||
2294 | 101 | |||
2295 | 102 | |||
2296 | 103 | class easy_reconcile_simple_partner(TransientModel): | ||
2297 | 104 | |||
2298 | 105 | _name = 'easy.reconcile.simple.partner' | ||
2299 | 106 | _inherit = 'easy.reconcile.simple' | ||
2300 | 107 | |||
2301 | 108 | # has to be subclassed | ||
2302 | 109 | # field name used as key for matching the move lines | ||
2303 | 110 | _key_field = 'partner_id' | ||
2304 | 111 | |||
2305 | 112 | |||
2306 | 113 | class easy_reconcile_simple_reference(TransientModel): | ||
2307 | 114 | |||
2308 | 115 | _name = 'easy.reconcile.simple.reference' | ||
2309 | 116 | _inherit = 'easy.reconcile.simple' | ||
2310 | 117 | |||
2311 | 118 | # has to be subclassed | ||
2312 | 119 | # field name used as key for matching the move lines | ||
2313 | 120 | _key_field = 'ref' | ||
2314 | 0 | 121 | ||
2315 | === added directory 'account_statement_base_completion' | |||
2316 | === added file 'account_statement_base_completion/__init__.py' | |||
2317 | --- account_statement_base_completion/__init__.py 1970-01-01 00:00:00 +0000 | |||
2318 | +++ account_statement_base_completion/__init__.py 2013-07-17 14:55:41 +0000 | |||
2319 | @@ -0,0 +1,23 @@ | |||
2320 | 1 | # -*- coding: utf-8 -*- | ||
2321 | 2 | ############################################################################## | ||
2322 | 3 | # | ||
2323 | 4 | # Author: Joel Grand-Guillaume | ||
2324 | 5 | # Copyright 2011-2012 Camptocamp SA | ||
2325 | 6 | # | ||
2326 | 7 | # This program is free software: you can redistribute it and/or modify | ||
2327 | 8 | # it under the terms of the GNU Affero General Public License as | ||
2328 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
2329 | 10 | # License, or (at your option) any later version. | ||
2330 | 11 | # | ||
2331 | 12 | # This program is distributed in the hope that it will be useful, | ||
2332 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2333 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2334 | 15 | # GNU Affero General Public License for more details. | ||
2335 | 16 | # | ||
2336 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
2337 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2338 | 19 | # | ||
2339 | 20 | ############################################################################## | ||
2340 | 21 | |||
2341 | 22 | import statement | ||
2342 | 23 | import partner | ||
2343 | 0 | 24 | ||
2344 | === added file 'account_statement_base_completion/__openerp__.py' | |||
2345 | --- account_statement_base_completion/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
2346 | +++ account_statement_base_completion/__openerp__.py 2013-07-17 14:55:41 +0000 | |||
2347 | @@ -0,0 +1,74 @@ | |||
2348 | 1 | # -*- coding: utf-8 -*- | ||
2349 | 2 | ############################################################################## | ||
2350 | 3 | # | ||
2351 | 4 | # Author: Joel Grand-Guillaume | ||
2352 | 5 | # Copyright 2011-2012 Camptocamp SA | ||
2353 | 6 | # | ||
2354 | 7 | # This program is free software: you can redistribute it and/or modify | ||
2355 | 8 | # it under the terms of the GNU Affero General Public License as | ||
2356 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
2357 | 10 | # License, or (at your option) any later version. | ||
2358 | 11 | # | ||
2359 | 12 | # This program is distributed in the hope that it will be useful, | ||
2360 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2361 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2362 | 15 | # GNU Affero General Public License for more details. | ||
2363 | 16 | # | ||
2364 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
2365 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2366 | 19 | # | ||
2367 | 20 | ############################################################################## | ||
2368 | 21 | |||
2369 | 22 | {'name': "Bank statement base completion", | ||
2370 | 23 | 'version': '1.0', | ||
2371 | 24 | 'author': 'Camptocamp', | ||
2372 | 25 | 'maintainer': 'Camptocamp', | ||
2373 | 26 | 'category': 'Finance', | ||
2374 | 27 | 'complexity': 'normal', | ||
2375 | 28 | 'depends': ['account_statement_ext'], | ||
2376 | 29 | 'description': """ | ||
2377 | 30 | The goal of this module is to improve the basic bank statement, help dealing with huge volume of | ||
2378 | 31 | reconciliation by providing basic rules to identify the partner of a bank statement line. | ||
2379 | 32 | Each bank statement profile can have its own rules to be applied according to a sequence order. | ||
2380 | 33 | |||
2381 | 34 | Some basic rules are provided in this module: | ||
2382 | 35 | |||
2383 | 36 | 1) Match from statement line label (based on partner field 'Bank Statement Label') | ||
2384 | 37 | 2) Match from statement line label (based on partner name) | ||
2385 | 38 | 3) Match from statement line reference (based on SO number) | ||
2386 | 39 | 3) Match from statement line reference (based on Invoice number) | ||
2387 | 40 | |||
2388 | 41 | You can easily override this module and add your own rules in your own one. The basic rules only | ||
2389 | 42 | fill in the partner, but you can use them to fill in any value of the line (in the future, we will | ||
2390 | 43 | add a rule to automatically match and reconcile the line). | ||
2391 | 44 | |||
2392 | 45 | It adds as well a label on the bank statement line (on which the pre-define rules can match) and | ||
2393 | 46 | a char field on the partner called 'Bank Statement Label'. Using the pre-define rules, you will be | ||
2394 | 47 | able to match various labels for a partner. | ||
2395 | 48 | |||
2396 | 49 | The reference of the line is always used by the reconciliation process. We're supposed to copy | ||
2397 | 50 | there (or write manually) the matching string. This can be: the order Number or an invoice number, | ||
2398 | 51 | or anything that will be found in the invoice accounting entry part to make the match. | ||
2399 | 52 | |||
2400 | 53 | You can use it with our account_advanced_reconcile module to automatize the reconciliation process. | ||
2401 | 54 | |||
2402 | 55 | |||
2403 | 56 | TODO: The rules that look for invoices to find out the partner should take back the payable / receivable | ||
2404 | 57 | account from there directly instead of retrieving it from partner properties ! | ||
2405 | 58 | |||
2406 | 59 | """, | ||
2407 | 60 | 'website': 'http://www.camptocamp.com', | ||
2408 | 61 | 'init_xml': [], | ||
2409 | 62 | 'update_xml': [ | ||
2410 | 63 | 'statement_view.xml', | ||
2411 | 64 | 'partner_view.xml', | ||
2412 | 65 | 'data.xml', | ||
2413 | 66 | 'security/ir.model.access.csv', | ||
2414 | 67 | ], | ||
2415 | 68 | 'demo_xml': [], | ||
2416 | 69 | 'test': [], | ||
2417 | 70 | 'installable': True, | ||
2418 | 71 | 'images': [], | ||
2419 | 72 | 'auto_install': False, | ||
2420 | 73 | 'license': 'AGPL-3', | ||
2421 | 74 | } | ||
2422 | 0 | 75 | ||
2423 | === added file 'account_statement_base_completion/data.xml' | |||
2424 | --- account_statement_base_completion/data.xml 1970-01-01 00:00:00 +0000 | |||
2425 | +++ account_statement_base_completion/data.xml 2013-07-17 14:55:41 +0000 | |||
2426 | @@ -0,0 +1,37 @@ | |||
2427 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2428 | 2 | <openerp> | ||
2429 | 3 | <data noupdate="1"> | ||
2430 | 4 | |||
2431 | 5 | <record id="bank_statement_completion_rule_2" model="account.statement.completion.rule"> | ||
2432 | 6 | <field name="name">Match from line label (based on partner field 'Bank Statement Label')</field> | ||
2433 | 7 | <field name="sequence">60</field> | ||
2434 | 8 | <field name="function_to_call">get_from_label_and_partner_field</field> | ||
2435 | 9 | </record> | ||
2436 | 10 | |||
2437 | 11 | <record id="bank_statement_completion_rule_3" model="account.statement.completion.rule"> | ||
2438 | 12 | <field name="name">Match from line label (based on partner name)</field> | ||
2439 | 13 | <field name="sequence">70</field> | ||
2440 | 14 | <field name="function_to_call">get_from_label_and_partner_name</field> | ||
2441 | 15 | </record> | ||
2442 | 16 | |||
2443 | 17 | <record id="bank_statement_completion_rule_1" model="account.statement.completion.rule"> | ||
2444 | 18 | <field name="name">Match from line reference (based on SO number)</field> | ||
2445 | 19 | <field name="sequence">50</field> | ||
2446 | 20 | <field name="function_to_call">get_from_ref_and_so</field> | ||
2447 | 21 | </record> | ||
2448 | 22 | |||
2449 | 23 | <record id="bank_statement_completion_rule_4" model="account.statement.completion.rule"> | ||
2450 | 24 | <field name="name">Match from line reference (based on Invoice number)</field> | ||
2451 | 25 | <field name="sequence">40</field> | ||
2452 | 26 | <field name="function_to_call">get_from_ref_and_invoice</field> | ||
2453 | 27 | </record> | ||
2454 | 28 | |||
2455 | 29 | <record id="bank_statement_completion_rule_5" model="account.statement.completion.rule"> | ||
2456 | 30 | <field name="name">Match from line reference (based on Invoice Supplier number)</field> | ||
2457 | 31 | <field name="sequence">45</field> | ||
2458 | 32 | <field name="function_to_call">get_from_ref_and_supplier_invoice</field> | ||
2459 | 33 | </record> | ||
2460 | 34 | |||
2461 | 35 | |||
2462 | 36 | </data> | ||
2463 | 37 | </openerp> | ||
2464 | 0 | 38 | ||
2465 | === added directory 'account_statement_base_completion/i18n' | |||
2466 | === added file 'account_statement_base_completion/i18n/fr.po' | |||
2467 | --- account_statement_base_completion/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
2468 | +++ account_statement_base_completion/i18n/fr.po 2013-07-17 14:55:41 +0000 | |||
2469 | @@ -0,0 +1,180 @@ | |||
2470 | 1 | #. module: account_statement_base_completion | ||
2471 | 2 | #: view:account.statement.completion.rule:0 | ||
2472 | 3 | msgid "Related Profiles" | ||
2473 | 4 | msgstr "Profils liés" | ||
2474 | 5 | |||
2475 | 6 | #. module: account_statement_base_completion | ||
2476 | 7 | #: help:account.statement.completion.rule,sequence:0 | ||
2477 | 8 | msgid "Lower means parsed first." | ||
2478 | 9 | msgstr "Plus petite séquence analysée en premier." | ||
2479 | 10 | |||
2480 | 11 | #. module: account_statement_base_completion | ||
2481 | 12 | #: code:addons/account_statement_base_completion/statement.py:150 | ||
2482 | 13 | #: code:addons/account_statement_base_completion/statement.py:182 | ||
2483 | 14 | #: code:addons/account_statement_base_completion/statement.py:219 | ||
2484 | 15 | #: code:addons/account_statement_base_completion/statement.py:252 | ||
2485 | 16 | #, python-format | ||
2486 | 17 | msgid "Line named \"%s\" (Ref:%s) was matched by more than one partner." | ||
2487 | 18 | msgstr "La ligne nommée \"%s\" (Ref:%s) correspond à plusieurs partenaires." | ||
2488 | 19 | |||
2489 | 20 | #. module: account_statement_base_completion | ||
2490 | 21 | #: field:account.bank.statement,completion_logs:0 | ||
2491 | 22 | msgid "Completion Log" | ||
2492 | 23 | msgstr "Journal des complétions" | ||
2493 | 24 | |||
2494 | 25 | #. module: account_statement_base_completion | ||
2495 | 26 | #: field:account.bank.statement.line,label:0 | ||
2496 | 27 | msgid "Label" | ||
2497 | 28 | msgstr "Description" | ||
2498 | 29 | |||
2499 | 30 | #. module: account_statement_base_completion | ||
2500 | 31 | #: help:account.bank.statement.line,label:0 | ||
2501 | 32 | msgid "" | ||
2502 | 33 | "Generiy field to store a label given from the bank/office on which we " | ||
2503 | 34 | "can base the default/standard providen rule." | ||
2504 | 35 | msgstr "" | ||
2505 | 36 | "Ce champs permet de stocker une description complémentaire fournie par la banque." | ||
2506 | 37 | "Le lettrage avancé pourra être effectué sur ce critère." | ||
2507 | 38 | |||
2508 | 39 | #. module: account_statement_base_completion | ||
2509 | 40 | #: model:ir.model,name:account_statement_base_completion.model_account_bank_statement | ||
2510 | 41 | msgid "Bank Statement" | ||
2511 | 42 | msgstr "Relevé bancaire" | ||
2512 | 43 | |||
2513 | 44 | #. module: account_statement_base_completion | ||
2514 | 45 | #: field:account.statement.completion.rule,function_to_call:0 | ||
2515 | 46 | msgid "Method" | ||
2516 | 47 | msgstr "Méthode" | ||
2517 | 48 | |||
2518 | 49 | #. module: account_statement_base_completion | ||
2519 | 50 | #: code:addons/account_statement_base_completion/statement.py:352 | ||
2520 | 51 | #, python-format | ||
2521 | 52 | msgid "Bank Statement ID %s has %s lines completed by %s" | ||
2522 | 53 | msgstr "Le relevé bancaire avec l'ID %s a %s lignes completées par %s" | ||
2523 | 54 | |||
2524 | 55 | #. module: account_statement_base_completion | ||
2525 | 56 | #: field:account.bank.statement.line,additionnal_bank_fields:0 | ||
2526 | 57 | msgid "Additionnal infos from bank" | ||
2527 | 58 | msgstr "Informations additionnelles de la banque" | ||
2528 | 59 | |||
2529 | 60 | #. module: account_statement_base_completion | ||
2530 | 61 | #: view:account.statement.profile:0 | ||
2531 | 62 | msgid "Auto-Completion Rules" | ||
2532 | 63 | msgstr "Règles d'auto-complétion" | ||
2533 | 64 | |||
2534 | 65 | #. module: account_statement_base_completion | ||
2535 | 66 | #: help:account.bank.statement.line,additionnal_bank_fields:0 | ||
2536 | 67 | msgid "" | ||
2537 | 68 | "Used by completion and import system. Adds every field that is present in " | ||
2538 | 69 | "your bank/office statement file" | ||
2539 | 70 | msgstr "" | ||
2540 | 71 | "Utilisé au niveau de l'auto-complétion et de l'import. Permet l'ajout de n'importe quel " | ||
2541 | 72 | "champs additionnel communiqué par la banque" | ||
2542 | 73 | |||
2543 | 74 | #. module: account_statement_base_completion | ||
2544 | 75 | #: view:account.bank.statement:0 | ||
2545 | 76 | msgid "Importation related infos" | ||
2546 | 77 | msgstr "Importation des informations liées" | ||
2547 | 78 | |||
2548 | 79 | #. module: account_statement_base_completion | ||
2549 | 80 | #: model:ir.model,name:account_statement_base_completion.model_account_statement_profile | ||
2550 | 81 | msgid "Statement Profil" | ||
2551 | 82 | msgstr "Profil de relevé" | ||
2552 | 83 | |||
2553 | 84 | #. module: account_statement_base_completion | ||
2554 | 85 | #: field:account.statement.completion.rule,name:0 | ||
2555 | 86 | msgid "Name" | ||
2556 | 87 | msgstr "Nom" | ||
2557 | 88 | |||
2558 | 89 | #. module: account_statement_base_completion | ||
2559 | 90 | #: constraint:account.statement.profile:0 | ||
2560 | 91 | msgid "You need to put a partner if you tic the 'Force partner on bank move' !" | ||
2561 | 92 | msgstr "" | ||
2562 | 93 | "Vous devez indiquer un partenaire si vous avez coché 'Indiquer un partenaire sur la ligne d'écriture de la banque' !" | ||
2563 | 94 | |||
2564 | 95 | #. module: account_statement_base_completion | ||
2565 | 96 | #: model:ir.model,name:account_statement_base_completion.model_account_bank_statement_line | ||
2566 | 97 | msgid "Bank Statement Line" | ||
2567 | 98 | msgstr "Ligne de relevé bancaire" | ||
2568 | 99 | |||
2569 | 100 | #. module: account_statement_base_completion | ||
2570 | 101 | #: view:account.statement.completion.rule:0 | ||
2571 | 102 | #: model:ir.actions.act_window,name:account_statement_base_completion.action_st_completion_rule_tree | ||
2572 | 103 | #: model:ir.ui.menu,name:account_statement_base_completion.menu_action_st_completion_rule_tree_menu | ||
2573 | 104 | msgid "Statement Completion Rule" | ||
2574 | 105 | msgstr "Règle d'auto-complétion du relevé" | ||
2575 | 106 | |||
2576 | 107 | #. module: account_statement_base_completion | ||
2577 | 108 | #: model:ir.model,name:account_statement_base_completion.model_account_statement_completion_rule | ||
2578 | 109 | msgid "account.statement.completion.rule" | ||
2579 | 110 | msgstr "account.statement.completion.rule" | ||
2580 | 111 | |||
2581 | 112 | #. module: account_statement_base_completion | ||
2582 | 113 | #: field:account.statement.completion.rule,profile_ids:0 | ||
2583 | 114 | #: field:account.statement.profile,rule_ids:0 | ||
2584 | 115 | msgid "Related statement profiles" | ||
2585 | 116 | msgstr "Profils liés" | ||
2586 | 117 | |||
2587 | 118 | #. module: account_statement_base_completion | ||
2588 | 119 | #: constraint:account.bank.statement.line:0 | ||
2589 | 120 | msgid "" | ||
2590 | 121 | "The amount of the voucher must be the same amount as the one on the " | ||
2591 | 122 | "statement line" | ||
2592 | 123 | msgstr "" | ||
2593 | 124 | "Le montant du justificatif doit être identique à celui de la ligne le " | ||
2594 | 125 | "concernant sur le relevé" | ||
2595 | 126 | |||
2596 | 127 | #. module: account_statement_base_completion | ||
2597 | 128 | #: field:account.bank.statement.line,already_completed:0 | ||
2598 | 129 | msgid "Auto-Completed" | ||
2599 | 130 | msgstr "Auto-Completé" | ||
2600 | 131 | |||
2601 | 132 | #. module: account_statement_base_completion | ||
2602 | 133 | #: view:account.bank.statement:0 | ||
2603 | 134 | msgid "Auto Completion" | ||
2604 | 135 | msgstr "Auto-complétion" | ||
2605 | 136 | |||
2606 | 137 | #. module: account_statement_base_completion | ||
2607 | 138 | #: field:account.statement.completion.rule,sequence:0 | ||
2608 | 139 | msgid "Sequence" | ||
2609 | 140 | msgstr "Séquence" | ||
2610 | 141 | |||
2611 | 142 | #. module: account_statement_base_completion | ||
2612 | 143 | #: constraint:account.bank.statement:0 | ||
2613 | 144 | msgid "The journal and period chosen have to belong to the same company." | ||
2614 | 145 | msgstr "Le journal et la période doivent appartenir à la même société." | ||
2615 | 146 | |||
2616 | 147 | #. module: account_statement_base_completion | ||
2617 | 148 | #: field:res.partner,bank_statement_label:0 | ||
2618 | 149 | msgid "Bank Statement Label" | ||
2619 | 150 | msgstr "Description de relevé bancaire" | ||
2620 | 151 | |||
2621 | 152 | #. module: account_statement_base_completion | ||
2622 | 153 | #: help:account.bank.statement.line,already_completed:0 | ||
2623 | 154 | msgid "" | ||
2624 | 155 | "When this checkbox is ticked, the auto-completion process/button will ignore " | ||
2625 | 156 | "this line." | ||
2626 | 157 | msgstr "" | ||
2627 | 158 | "Les lignes cochées seront ignorées lorsque vous cliquez sur le bouton auto-complétion" | ||
2628 | 159 | |||
2629 | 160 | #. module: account_statement_base_completion | ||
2630 | 161 | #: help:res.partner,bank_statement_label:0 | ||
2631 | 162 | msgid "" | ||
2632 | 163 | "Enter the various label found on your bank statement separated by a ; " | ||
2633 | 164 | "If one of this label is include in the bank statement line, " | ||
2634 | 165 | "the partner will be automatically filled (as long as you " | ||
2635 | 166 | "use this method/rules in your statement profile)." | ||
2636 | 167 | msgstr "" | ||
2637 | 168 | "Entrez les différentes descriptions/informations sur votre relevé bancaire séparées par un ';' " | ||
2638 | 169 | "Si l'une d'entre elles figure dans la ligne du relevé, le partenaire correspondant pourra" | ||
2639 | 170 | "être automatiquement retrouvé (à condition d'utiliser un règle de lettrage dans le profil)." | ||
2640 | 171 | |||
2641 | 172 | #. module: account_statement_base_completion | ||
2642 | 173 | #: model:ir.model,name:account_statement_base_completion.model_res_partner | ||
2643 | 174 | msgid "Partner" | ||
2644 | 175 | msgstr "Partenaire" | ||
2645 | 176 | |||
2646 | 177 | #. module: account_statement_base_completion | ||
2647 | 178 | #: view:account.bank.statement:0 | ||
2648 | 179 | msgid "Completion Logs" | ||
2649 | 180 | msgstr "Journaux d'auto-complétion" | ||
2650 | 0 | 181 | ||
2651 | === added file 'account_statement_base_completion/partner.py' | |||
2652 | --- account_statement_base_completion/partner.py 1970-01-01 00:00:00 +0000 | |||
2653 | +++ account_statement_base_completion/partner.py 2013-07-17 14:55:41 +0000 | |||
2654 | @@ -0,0 +1,38 @@ | |||
2655 | 1 | # -*- coding: utf-8 -*- | ||
2656 | 2 | ################################################################################# | ||
2657 | 3 | # # | ||
2658 | 4 | # Copyright (C) 2011 Akretion & Camptocamp | ||
2659 | 5 | # Author : Sébastien BEAU, Joel Grand-Guillaume # | ||
2660 | 6 | # # | ||
2661 | 7 | # This program is free software: you can redistribute it and/or modify # | ||
2662 | 8 | # it under the terms of the GNU Affero General Public License as # | ||
2663 | 9 | # published by the Free Software Foundation, either version 3 of the # | ||
2664 | 10 | # License, or (at your option) any later version. # | ||
2665 | 11 | # # | ||
2666 | 12 | # This program is distributed in the hope that it will be useful, # | ||
2667 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | ||
2668 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | ||
2669 | 15 | # GNU Affero General Public License for more details. # | ||
2670 | 16 | # # | ||
2671 | 17 | # You should have received a copy of the GNU Affero General Public License # | ||
2672 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | ||
2673 | 19 | # # | ||
2674 | 20 | ################################################################################# | ||
2675 | 21 | |||
2676 | 22 | from openerp.osv.orm import Model | ||
2677 | 23 | from openerp.osv import fields, osv | ||
2678 | 24 | |||
2679 | 25 | |||
2680 | 26 | class res_partner(Model): | ||
2681 | 27 | """ | ||
2682 | 28 | Add a bank label on the partner so that we can use it to match | ||
2683 | 29 | this partner when we found this in a statement line. | ||
2684 | 30 | """ | ||
2685 | 31 | _inherit = 'res.partner' | ||
2686 | 32 | |||
2687 | 33 | _columns = { | ||
2688 | 34 | 'bank_statement_label': fields.char('Bank Statement Label', size=100, | ||
2689 | 35 | help="Enter the various label found on your bank statement separated by a ; If \ | ||
2690 | 36 | one of this label is include in the bank statement line, the partner will be automatically \ | ||
2691 | 37 | filled (as long as you use this method/rules in your statement profile)."), | ||
2692 | 38 | } | ||
2693 | 0 | 39 | ||
2694 | === added file 'account_statement_base_completion/partner_view.xml' | |||
2695 | --- account_statement_base_completion/partner_view.xml 1970-01-01 00:00:00 +0000 | |||
2696 | +++ account_statement_base_completion/partner_view.xml 2013-07-17 14:55:41 +0000 | |||
2697 | @@ -0,0 +1,22 @@ | |||
2698 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2699 | 2 | |||
2700 | 3 | |||
2701 | 4 | <openerp> | ||
2702 | 5 | <data> | ||
2703 | 6 | |||
2704 | 7 | <record id="bk_view_partner_form" model="ir.ui.view"> | ||
2705 | 8 | <field name="name">account_bank_statement_import.view.partner.form</field> | ||
2706 | 9 | <field name="model">res.partner</field> | ||
2707 | 10 | <field name="type">form</field> | ||
2708 | 11 | <field name="priority">20</field> | ||
2709 | 12 | <field name="inherit_id" ref="account.view_partner_property_form"/> | ||
2710 | 13 | <field name="arch" type="xml"> | ||
2711 | 14 | <field name="property_account_payable" position="after"> | ||
2712 | 15 | <field name="bank_statement_label"/> | ||
2713 | 16 | </field> | ||
2714 | 17 | </field> | ||
2715 | 18 | </record> | ||
2716 | 19 | |||
2717 | 20 | |||
2718 | 21 | </data> | ||
2719 | 22 | </openerp> | ||
2720 | 0 | 23 | ||
2721 | === added directory 'account_statement_base_completion/security' | |||
2722 | === added file 'account_statement_base_completion/security/ir.model.access.csv' | |||
2723 | --- account_statement_base_completion/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 | |||
2724 | +++ account_statement_base_completion/security/ir.model.access.csv 2013-07-17 14:55:41 +0000 | |||
2725 | @@ -0,0 +1,3 @@ | |||
2726 | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
2727 | 2 | access_account_bank_st_cmpl_user,account.statement.completion.rule,model_account_statement_completion_rule,account.group_account_user,1,0,0,0 | ||
2728 | 3 | access_account_bank_st_cmpl_manager,account.statement.completion.rule,model_account_statement_completion_rule,account.group_account_manager,1,1,1,1 | ||
2729 | 0 | 4 | ||
2730 | === added file 'account_statement_base_completion/statement.py' | |||
2731 | --- account_statement_base_completion/statement.py 1970-01-01 00:00:00 +0000 | |||
2732 | +++ account_statement_base_completion/statement.py 2013-07-17 14:55:41 +0000 | |||
2733 | @@ -0,0 +1,527 @@ | |||
2734 | 1 | # -*- coding: utf-8 -*- | ||
2735 | 2 | ############################################################################## | ||
2736 | 3 | # | ||
2737 | 4 | # Author: Nicolas Bessi, Joel Grand-Guillaume | ||
2738 | 5 | # Copyright 2011-2012 Camptocamp SA | ||
2739 | 6 | # | ||
2740 | 7 | # This program is free software: you can redistribute it and/or modify | ||
2741 | 8 | # it under the terms of the GNU Affero General Public License as | ||
2742 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
2743 | 10 | # License, or (at your option) any later version. | ||
2744 | 11 | # | ||
2745 | 12 | # This program is distributed in the hope that it will be useful, | ||
2746 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2747 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2748 | 15 | # GNU Affero General Public License for more details. | ||
2749 | 16 | # | ||
2750 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
2751 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2752 | 19 | # | ||
2753 | 20 | ############################################################################## | ||
2754 | 21 | # TODO replace customer supplier by package constant | ||
2755 | 22 | import traceback | ||
2756 | 23 | import sys | ||
2757 | 24 | import logging | ||
2758 | 25 | |||
2759 | 26 | from collections import defaultdict | ||
2760 | 27 | import re | ||
2761 | 28 | from tools.translate import _ | ||
2762 | 29 | from openerp.osv import osv, orm, fields | ||
2763 | 30 | from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT | ||
2764 | 31 | from operator import attrgetter | ||
2765 | 32 | import datetime | ||
2766 | 33 | |||
2767 | 34 | _logger = logging.getLogger(__name__) | ||
2768 | 35 | |||
2769 | 36 | |||
2770 | 37 | class ErrorTooManyPartner(Exception): | ||
2771 | 38 | """ | ||
2772 | 39 | New Exception definition that is raised when more than one partner is matched by | ||
2773 | 40 | the completion rule. | ||
2774 | 41 | """ | ||
2775 | 42 | def __init__(self, value): | ||
2776 | 43 | self.value = value | ||
2777 | 44 | |||
2778 | 45 | def __str__(self): | ||
2779 | 46 | return repr(self.value) | ||
2780 | 47 | |||
2781 | 48 | def __repr__(self): | ||
2782 | 49 | return repr(self.value) | ||
2783 | 50 | |||
2784 | 51 | |||
2785 | 52 | class AccountStatementProfil(orm.Model): | ||
2786 | 53 | """ | ||
2787 | 54 | Extend the class to add rules per profile that will match at least the partner, | ||
2788 | 55 | but it could also be used to match other values as well. | ||
2789 | 56 | """ | ||
2790 | 57 | |||
2791 | 58 | _inherit = "account.statement.profile" | ||
2792 | 59 | |||
2793 | 60 | _columns = { | ||
2794 | 61 | # @Akretion: For now, we don't implement this features, but this would probably be there: | ||
2795 | 62 | # 'auto_completion': fields.text('Auto Completion'), | ||
2796 | 63 | # 'transferts_account_id':fields.many2one('account.account', 'Transferts Account'), | ||
2797 | 64 | # => You can implement it in a module easily, we design it with your needs in mind | ||
2798 | 65 | # as well! | ||
2799 | 66 | |||
2800 | 67 | 'rule_ids': fields.many2many( | ||
2801 | 68 | 'account.statement.completion.rule', | ||
2802 | 69 | string='Related statement profiles', | ||
2803 | 70 | rel='as_rul_st_prof_rel'), | ||
2804 | 71 | } | ||
2805 | 72 | |||
2806 | 73 | def _get_callable(self, cr, uid, profile, context=None): | ||
2807 | 74 | if isinstance(profile, (int, long)): | ||
2808 | 75 | prof = self.browse(cr, uid, profile, context=context) | ||
2809 | 76 | else: | ||
2810 | 77 | prof = profile | ||
2811 | 78 | # We need to respect the sequence order | ||
2812 | 79 | sorted_array = sorted(prof.rule_ids, key=attrgetter('sequence')) | ||
2813 | 80 | return tuple((x.function_to_call for x in sorted_array)) | ||
2814 | 81 | |||
2815 | 82 | def _find_values_from_rules(self, cr, uid, calls, line, context=None): | ||
2816 | 83 | """ | ||
2817 | 84 | This method will execute all related rules, in their sequence order, | ||
2818 | 85 | to retrieve all the values returned by the first rules that will match. | ||
2819 | 86 | :param calls: list of lookup function name available in rules | ||
2820 | 87 | :param dict line: read of the concerned account.bank.statement.line | ||
2821 | 88 | :return: | ||
2822 | 89 | A dict of value that can be passed directly to the write method of | ||
2823 | 90 | the statement line or {} | ||
2824 | 91 | {'partner_id': value, | ||
2825 | 92 | 'account_id: value, | ||
2826 | 93 | |||
2827 | 94 | ...} | ||
2828 | 95 | """ | ||
2829 | 96 | if context is None: | ||
2830 | 97 | context = {} | ||
2831 | 98 | if not calls: | ||
2832 | 99 | calls = self._get_callable(cr, uid, line['profile_id'], context=context) | ||
2833 | 100 | rule_obj = self.pool.get('account.statement.completion.rule') | ||
2834 | 101 | |||
2835 | 102 | for call in calls: | ||
2836 | 103 | method_to_call = getattr(rule_obj, call) | ||
2837 | 104 | result = method_to_call(cr, uid, line, context) | ||
2838 | 105 | if result: | ||
2839 | 106 | result['already_completed'] = True | ||
2840 | 107 | return result | ||
2841 | 108 | return None | ||
2842 | 109 | |||
2843 | 110 | |||
2844 | 111 | class AccountStatementCompletionRule(orm.Model): | ||
2845 | 112 | """ | ||
2846 | 113 | This will represent all the completion method that we can have to | ||
2847 | 114 | fullfill the bank statement lines. You'll be able to extend them in you own module | ||
2848 | 115 | and choose those to apply for every statement profile. | ||
2849 | 116 | The goal of a rule is to fullfill at least the partner of the line, but | ||
2850 | 117 | if possible also the reference because we'll use it in the reconciliation | ||
2851 | 118 | process. The reference should contain the invoice number or the SO number | ||
2852 | 119 | or any reference that will be matched by the invoice accounting move. | ||
2853 | 120 | """ | ||
2854 | 121 | |||
2855 | 122 | _name = "account.statement.completion.rule" | ||
2856 | 123 | _order = "sequence asc" | ||
2857 | 124 | |||
2858 | 125 | def _get_functions(self, cr, uid, context=None): | ||
2859 | 126 | """ | ||
2860 | 127 | List of available methods for rules. Override this to add you own. | ||
2861 | 128 | """ | ||
2862 | 129 | return [ | ||
2863 | 130 | ('get_from_ref_and_invoice', 'From line reference (based on customer invoice number)'), | ||
2864 | 131 | ('get_from_ref_and_supplier_invoice', 'From line reference (based on supplier invoice number)'), | ||
2865 | 132 | ('get_from_ref_and_so', 'From line reference (based on SO number)'), | ||
2866 | 133 | ('get_from_label_and_partner_field', 'From line label (based on partner field)'), | ||
2867 | 134 | ('get_from_label_and_partner_name', 'From line label (based on partner name)')] | ||
2868 | 135 | |||
2869 | 136 | _columns = { | ||
2870 | 137 | 'sequence': fields.integer('Sequence', help="Lower means parsed first."), | ||
2871 | 138 | 'name': fields.char('Name', size=128), | ||
2872 | 139 | 'profile_ids': fields.many2many( | ||
2873 | 140 | 'account.statement.profile', | ||
2874 | 141 | rel='as_rul_st_prof_rel', | ||
2875 | 142 | string='Related statement profiles'), | ||
2876 | 143 | 'function_to_call': fields.selection(_get_functions, 'Method'), | ||
2877 | 144 | } | ||
2878 | 145 | |||
2879 | 146 | def _find_invoice(self, cr, uid, st_line, inv_type, context=None): | ||
2880 | 147 | """Find invoice related to statement line""" | ||
2881 | 148 | inv_obj = self.pool.get('account.invoice') | ||
2882 | 149 | if inv_type == 'supplier': | ||
2883 | 150 | type_domain = ('in_invoice', 'in_refund') | ||
2884 | 151 | number_field = 'supplier_invoice_number' | ||
2885 | 152 | elif inv_type == 'customer': | ||
2886 | 153 | type_domain = ('out_invoice', 'out_refund') | ||
2887 | 154 | number_field = 'number' | ||
2888 | 155 | else: | ||
2889 | 156 | raise osv.except_osv(_('System error'), | ||
2890 | 157 | _('Invalid invoice type for completion: %') % inv_type) | ||
2891 | 158 | |||
2892 | 159 | inv_id = inv_obj.search(cr, uid, | ||
2893 | 160 | [(number_field, '=', st_line['ref'].strip()), | ||
2894 | 161 | ('type', 'in', type_domain)], | ||
2895 | 162 | context=context) | ||
2896 | 163 | if inv_id: | ||
2897 | 164 | if len(inv_id) == 1: | ||
2898 | 165 | inv = inv_obj.browse(cr, uid, inv_id[0], context=context) | ||
2899 | 166 | else: | ||
2900 | 167 | raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more ' | ||
2901 | 168 | 'than one partner while looking on %s invoices') % | ||
2902 | 169 | (st_line['name'], st_line['ref'], inv_type)) | ||
2903 | 170 | return inv | ||
2904 | 171 | return False | ||
2905 | 172 | |||
2906 | 173 | def _from_invoice(self, cr, uid, line, inv_type, context): | ||
2907 | 174 | """Populate statement line values""" | ||
2908 | 175 | if not inv_type in ('supplier', 'customer'): | ||
2909 | 176 | raise osv.except_osv(_('System error'), | ||
2910 | 177 | _('Invalid invoice type for completion: %') % inv_type) | ||
2911 | 178 | res = {} | ||
2912 | 179 | inv = self._find_invoice(cr, uid, line, inv_type, context=context) | ||
2913 | 180 | if inv: | ||
2914 | 181 | res = {'partner_id': inv.partner_id.id, | ||
2915 | 182 | 'account_id': inv.account_id.id, | ||
2916 | 183 | 'type': inv_type} | ||
2917 | 184 | override_acc = line['master_account_id'] | ||
2918 | 185 | if override_acc: | ||
2919 | 186 | res['account_id'] = override_acc | ||
2920 | 187 | return res | ||
2921 | 188 | |||
2922 | 189 | # Should be private but data are initialised with no update XML | ||
2923 | 190 | def get_from_ref_and_supplier_invoice(self, cr, uid, line, context=None): | ||
2924 | 191 | """ | ||
2925 | 192 | Match the partner based on the invoice supplier invoice number and the reference of the statement | ||
2926 | 193 | line. Then, call the generic get_values_for_line method to complete other values. | ||
2927 | 194 | If more than one partner matched, raise the ErrorTooManyPartner error. | ||
2928 | 195 | |||
2929 | 196 | :param dict line: read of the concerned account.bank.statement.line | ||
2930 | 197 | :return: | ||
2931 | 198 | A dict of value that can be passed directly to the write method of | ||
2932 | 199 | the statement line or {} | ||
2933 | 200 | {'partner_id': value, | ||
2934 | 201 | 'account_id': value, | ||
2935 | 202 | |||
2936 | 203 | ...} | ||
2937 | 204 | """ | ||
2938 | 205 | return self._from_invoice(cr, uid, line, 'supplier', context=context) | ||
2939 | 206 | |||
2940 | 207 | # Should be private but data are initialised with no update XML | ||
2941 | 208 | def get_from_ref_and_invoice(self, cr, uid, line, context=None): | ||
2942 | 209 | """ | ||
2943 | 210 | Match the partner based on the invoice number and the reference of the statement | ||
2944 | 211 | line. Then, call the generic get_values_for_line method to complete other values. | ||
2945 | 212 | If more than one partner matched, raise the ErrorTooManyPartner error. | ||
2946 | 213 | |||
2947 | 214 | :param dict line: read of the concerned account.bank.statement.line | ||
2948 | 215 | :return: | ||
2949 | 216 | A dict of value that can be passed directly to the write method of | ||
2950 | 217 | the statement line or {} | ||
2951 | 218 | {'partner_id': value, | ||
2952 | 219 | 'account_id': value, | ||
2953 | 220 | ...} | ||
2954 | 221 | """ | ||
2955 | 222 | return self._from_invoice(cr, uid, line, 'customer', context=context) | ||
2956 | 223 | |||
2957 | 224 | # Should be private but data are initialised with no update XML | ||
2958 | 225 | def get_from_ref_and_so(self, cr, uid, st_line, context=None): | ||
2959 | 226 | """ | ||
2960 | 227 | Match the partner based on the SO number and the reference of the statement | ||
2961 | 228 | line. Then, call the generic get_values_for_line method to complete other values. | ||
2962 | 229 | If more than one partner matched, raise the ErrorTooManyPartner error. | ||
2963 | 230 | |||
2964 | 231 | :param int/long st_line: read of the concerned account.bank.statement.line | ||
2965 | 232 | :return: | ||
2966 | 233 | A dict of value that can be passed directly to the write method of | ||
2967 | 234 | the statement line or {} | ||
2968 | 235 | {'partner_id': value, | ||
2969 | 236 | 'account_id': value, | ||
2970 | 237 | |||
2971 | 238 | ...} | ||
2972 | 239 | """ | ||
2973 | 240 | st_obj = self.pool.get('account.bank.statement.line') | ||
2974 | 241 | res = {} | ||
2975 | 242 | if st_line: | ||
2976 | 243 | so_obj = self.pool.get('sale.order') | ||
2977 | 244 | so_id = so_obj.search(cr, | ||
2978 | 245 | uid, | ||
2979 | 246 | [('name', '=', st_line['ref'])], | ||
2980 | 247 | context=context) | ||
2981 | 248 | if so_id: | ||
2982 | 249 | if so_id and len(so_id) == 1: | ||
2983 | 250 | so = so_obj.browse(cr, uid, so_id[0], context=context) | ||
2984 | 251 | res['partner_id'] = so.partner_id.id | ||
2985 | 252 | elif so_id and len(so_id) > 1: | ||
2986 | 253 | raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more ' | ||
2987 | 254 | 'than one partner while looking on SO by ref.') % | ||
2988 | 255 | (st_line['name'], st_line['ref'])) | ||
2989 | 256 | st_vals = st_obj.get_values_for_line(cr, | ||
2990 | 257 | uid, | ||
2991 | 258 | profile_id=st_line['profile_id'], | ||
2992 | 259 | master_account_id=st_line['master_account_id'], | ||
2993 | 260 | partner_id=res.get('partner_id', False), | ||
2994 | 261 | line_type='customer', | ||
2995 | 262 | amount=st_line['amount'] if st_line['amount'] else 0.0, | ||
2996 | 263 | context=context) | ||
2997 | 264 | res.update(st_vals) | ||
2998 | 265 | return res | ||
2999 | 266 | |||
3000 | 267 | # Should be private but data are initialised with no update XML | ||
3001 | 268 | def get_from_label_and_partner_field(self, cr, uid, st_line, context=None): | ||
3002 | 269 | """ | ||
3003 | 270 | Match the partner based on the label field of the statement line | ||
3004 | 271 | and the text defined in the 'bank_statement_label' field of the partner. | ||
3005 | 272 | Remember that we can have values separated with ; Then, call the generic | ||
3006 | 273 | get_values_for_line method to complete other values. | ||
3007 | 274 | If more than one partner matched, raise the ErrorTooManyPartner error. | ||
3008 | 275 | |||
3009 | 276 | :param dict st_line: read of the concerned account.bank.statement.line | ||
3010 | 277 | :return: | ||
3011 | 278 | A dict of value that can be passed directly to the write method of | ||
3012 | 279 | the statement line or {} | ||
3013 | 280 | {'partner_id': value, | ||
3014 | 281 | 'account_id': value, | ||
3015 | 282 | |||
3016 | 283 | ...} | ||
3017 | 284 | """ | ||
3018 | 285 | partner_obj = self.pool.get('res.partner') | ||
3019 | 286 | st_obj = self.pool.get('account.bank.statement.line') | ||
3020 | 287 | res = {} | ||
3021 | 288 | # As we have to iterate on each partner for each line, | ||
3022 | 289 | # we memoize the pair to avoid | ||
3023 | 290 | # to redo computation for each line. | ||
3024 | 291 | # Following code can be done by a single SQL query | ||
3025 | 292 | # but this option is not really maintanable | ||
3026 | 293 | if not context.get('label_memoizer'): | ||
3027 | 294 | context['label_memoizer'] = defaultdict(list) | ||
3028 | 295 | partner_ids = partner_obj.search(cr, | ||
3029 | 296 | uid, | ||
3030 | 297 | [('bank_statement_label', '!=', False)]) | ||
3031 | 298 | line_ids = context.get('line_ids', []) | ||
3032 | 299 | for partner in partner_obj.browse(cr, uid, partner_ids, context=context): | ||
3033 | 300 | vals = '|'.join(re.escape(x.strip()) for x in partner.bank_statement_label.split(';')) | ||
3034 | 301 | or_regex = ".*%s.*" % vals | ||
3035 | 302 | sql = ("SELECT id from account_bank_statement_line" | ||
3036 | 303 | " WHERE id in %s" | ||
3037 | 304 | " AND name ~* %s") | ||
3038 | 305 | cr.execute(sql, (line_ids, or_regex)) | ||
3039 | 306 | pairs = cr.fetchall() | ||
3040 | 307 | for pair in pairs: | ||
3041 | 308 | context['label_memoizer'][pair[0]].append(partner) | ||
3042 | 309 | |||
3043 | 310 | if st_line['id'] in context['label_memoizer']: | ||
3044 | 311 | found_partner = context['label_memoizer'][st_line['id']] | ||
3045 | 312 | if len(found_partner) > 1: | ||
3046 | 313 | msg = (_('Line named "%s" (Ref:%s) was matched by ' | ||
3047 | 314 | 'more than one partner while looking on partner label: %s') % | ||
3048 | 315 | (st_line['name'], st_line['ref'], ','.join([x.name for x in found_partner]))) | ||
3049 | 316 | raise ErrorTooManyPartner(msg) | ||
3050 | 317 | res['partner_id'] = found_partner[0].id | ||
3051 | 318 | st_vals = st_obj.get_values_for_line(cr, | ||
3052 | 319 | uid, | ||
3053 | 320 | profile_id=st_line['profile_id'], | ||
3054 | 321 | master_account_id=st_line['master_account_id'], | ||
3055 | 322 | partner_id=found_partner[0].id, | ||
3056 | 323 | line_type=False, | ||
3057 | 324 | amount=st_line['amount'] if st_line['amount'] else 0.0, | ||
3058 | 325 | context=context) | ||
3059 | 326 | res.update(st_vals) | ||
3060 | 327 | return res | ||
3061 | 328 | |||
3062 | 329 | def get_from_label_and_partner_name(self, cr, uid, st_line, context=None): | ||
3063 | 330 | """ | ||
3064 | 331 | Match the partner based on the label field of the statement line | ||
3065 | 332 | and the name of the partner. | ||
3066 | 333 | Then, call the generic get_values_for_line method to complete other values. | ||
3067 | 334 | If more than one partner matched, raise the ErrorTooManyPartner error. | ||
3068 | 335 | |||
3069 | 336 | :param dict st_line: read of the concerned account.bank.statement.line | ||
3070 | 337 | :return: | ||
3071 | 338 | A dict of value that can be passed directly to the write method of | ||
3072 | 339 | the statement line or {} | ||
3073 | 340 | {'partner_id': value, | ||
3074 | 341 | 'account_id': value, | ||
3075 | 342 | |||
3076 | 343 | ...} | ||
3077 | 344 | """ | ||
3078 | 345 | res = {} | ||
3079 | 346 | # We memoize allowed partner | ||
3080 | 347 | if not context.get('partner_memoizer'): | ||
3081 | 348 | context['partner_memoizer'] = tuple(self.pool['res.partner'].search(cr, uid, [])) | ||
3082 | 349 | if not context['partner_memoizer']: | ||
3083 | 350 | return res | ||
3084 | 351 | st_obj = self.pool.get('account.bank.statement.line') | ||
3085 | 352 | sql = "SELECT id FROM res_partner WHERE name ~* %s and id in %s" | ||
3086 | 353 | pattern = ".*%s.*" % re.escape(st_line['name']) | ||
3087 | 354 | cr.execute(sql, (pattern, context['partner_memoizer'])) | ||
3088 | 355 | result = cr.fetchall() | ||
3089 | 356 | if not result: | ||
3090 | 357 | return res | ||
3091 | 358 | if len(result) > 1: | ||
3092 | 359 | raise ErrorTooManyPartner(_('Line named "%s" (Ref:%s) was matched by more ' | ||
3093 | 360 | 'than one partner while looking on partner by name') % | ||
3094 | 361 | (st_line['name'], st_line['ref'])) | ||
3095 | 362 | res['partner_id'] = result[0][0] | ||
3096 | 363 | st_vals = st_obj.get_values_for_line(cr, | ||
3097 | 364 | uid, | ||
3098 | 365 | profile_id=st_line['porfile_id'], | ||
3099 | 366 | master_account_id=st_line['master_account_id'], | ||
3100 | 367 | partner_id=res['partner_id'], | ||
3101 | 368 | line_type=False, | ||
3102 | 369 | amount=st_line['amount'] if st_line['amount'] else 0.0, | ||
3103 | 370 | context=context) | ||
3104 | 371 | res.update(st_vals) | ||
3105 | 372 | return res | ||
3106 | 373 | |||
3107 | 374 | |||
3108 | 375 | class AccountStatementLine(orm.Model): | ||
3109 | 376 | """ | ||
3110 | 377 | Add sparse field on the statement line to allow to store all the | ||
3111 | 378 | bank infos that are given by a bank/office. You can then add you own in your | ||
3112 | 379 | module. The idea here is to store all bank/office infos in the additionnal_bank_fields | ||
3113 | 380 | serialized field when importing the file. If many values, add a tab in the bank | ||
3114 | 381 | statement line to store your specific one. Have a look in account_statement_base_import | ||
3115 | 382 | module to see how we've done it. | ||
3116 | 383 | """ | ||
3117 | 384 | _inherit = "account.bank.statement.line" | ||
3118 | 385 | |||
3119 | 386 | _columns = { | ||
3120 | 387 | 'additionnal_bank_fields': fields.serialized( | ||
3121 | 388 | 'Additionnal infos from bank', | ||
3122 | 389 | help="Used by completion and import system. Adds every field that " | ||
3123 | 390 | "is present in your bank/office statement file"), | ||
3124 | 391 | 'label': fields.sparse( | ||
3125 | 392 | type='char', | ||
3126 | 393 | string='Label', | ||
3127 | 394 | serialization_field='additionnal_bank_fields', | ||
3128 | 395 | help="Generic field to store a label given from the " | ||
3129 | 396 | "bank/office on which we can base the default/standard " | ||
3130 | 397 | "providen rule."), | ||
3131 | 398 | 'already_completed': fields.boolean( | ||
3132 | 399 | "Auto-Completed", | ||
3133 | 400 | help="When this checkbox is ticked, the auto-completion " | ||
3134 | 401 | "process/button will ignore this line."), | ||
3135 | 402 | } | ||
3136 | 403 | |||
3137 | 404 | _defaults = { | ||
3138 | 405 | 'already_completed': False, | ||
3139 | 406 | } | ||
3140 | 407 | |||
3141 | 408 | def _get_line_values_from_rules(self, cr, uid, line, rules, context=None): | ||
3142 | 409 | """ | ||
3143 | 410 | We'll try to find out the values related to the line based on rules setted on | ||
3144 | 411 | the profile.. We will ignore line for which already_completed is ticked. | ||
3145 | 412 | |||
3146 | 413 | :return: | ||
3147 | 414 | A dict of dict value that can be passed directly to the write method of | ||
3148 | 415 | the statement line or {}. The first dict has statement line ID as a key: | ||
3149 | 416 | {117009: {'partner_id': 100997, 'account_id': 489L}} | ||
3150 | 417 | """ | ||
3151 | 418 | profile_obj = self.pool.get('account.statement.profile') | ||
3152 | 419 | if line.get('already_completed'): | ||
3153 | 420 | return {} | ||
3154 | 421 | # Ask the rule | ||
3155 | 422 | vals = profile_obj._find_values_from_rules(cr, uid, rules, line, context) | ||
3156 | 423 | if vals: | ||
3157 | 424 | vals['id'] = line['id'] | ||
3158 | 425 | return vals | ||
3159 | 426 | return {} | ||
3160 | 427 | |||
3161 | 428 | |||
3162 | 429 | class AccountBankSatement(orm.Model): | ||
3163 | 430 | """ | ||
3164 | 431 | We add a basic button and stuff to support the auto-completion | ||
3165 | 432 | of the bank statement once line have been imported or manually fullfill. | ||
3166 | 433 | """ | ||
3167 | 434 | _inherit = "account.bank.statement" | ||
3168 | 435 | |||
3169 | 436 | _columns = { | ||
3170 | 437 | 'completion_logs': fields.text('Completion Log', readonly=True), | ||
3171 | 438 | } | ||
3172 | 439 | |||
3173 | 440 | def write_completion_log(self, cr, uid, stat_id, error_msg, number_imported, context=None): | ||
3174 | 441 | """ | ||
3175 | 442 | Write the log in the completion_logs field of the bank statement to let the user | ||
3176 | 443 | know what have been done. This is an append mode, so we don't overwrite what | ||
3177 | 444 | already recoded. | ||
3178 | 445 | |||
3179 | 446 | :param int/long stat_id: ID of the account.bank.statement | ||
3180 | 447 | :param char error_msg: Message to add | ||
3181 | 448 | :number_imported int/long: Number of lines that have been completed | ||
3182 | 449 | :return True | ||
3183 | 450 | """ | ||
3184 | 451 | user_name = self.pool.get('res.users').read(cr, uid, uid, | ||
3185 | 452 | ['name'], context=context)['name'] | ||
3186 | 453 | |||
3187 | 454 | log = self.read(cr, uid, stat_id, ['completion_logs'], | ||
3188 | 455 | context=context)['completion_logs'] | ||
3189 | 456 | log = log if log else "" | ||
3190 | 457 | |||
3191 | 458 | completion_date = datetime.datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT) | ||
3192 | 459 | message = (_("%s Bank Statement ID %s has %s lines completed by %s \n%s\n%s\n") % | ||
3193 | 460 | (completion_date, stat_id, number_imported, user_name, error_msg, log)) | ||
3194 | 461 | self.write(cr, uid, [stat_id], {'completion_logs': message}, context=context) | ||
3195 | 462 | |||
3196 | 463 | body = (_('Statement ID %s auto-completed for %s lines completed') % | ||
3197 | 464 | (stat_id, number_imported)), | ||
3198 | 465 | self.message_post(cr, uid, | ||
3199 | 466 | [stat_id], | ||
3200 | 467 | body=body, | ||
3201 | 468 | context=context) | ||
3202 | 469 | return True | ||
3203 | 470 | |||
3204 | 471 | def button_auto_completion(self, cr, uid, ids, context=None): | ||
3205 | 472 | """ | ||
3206 | 473 | Complete line with values given by rules and tic the already_completed | ||
3207 | 474 | checkbox so we won't compute them again unless the user untick them! | ||
3208 | 475 | """ | ||
3209 | 476 | if context is None: | ||
3210 | 477 | context = {} | ||
3211 | 478 | stat_line_obj = self.pool['account.bank.statement.line'] | ||
3212 | 479 | profile_obj = self.pool.get('account.statement.profile') | ||
3213 | 480 | compl_lines = 0 | ||
3214 | 481 | stat_line_obj.check_access_rule(cr, uid, [], 'create') | ||
3215 | 482 | stat_line_obj.check_access_rights(cr, uid, 'create', raise_exception=True) | ||
3216 | 483 | for stat in self.browse(cr, uid, ids, context=context): | ||
3217 | 484 | msg_lines = [] | ||
3218 | 485 | ctx = context.copy() | ||
3219 | 486 | ctx['line_ids'] = tuple((x.id for x in stat.line_ids)) | ||
3220 | 487 | b_profile = stat.profile_id | ||
3221 | 488 | rules = profile_obj._get_callable(cr, uid, b_profile, context=context) | ||
3222 | 489 | profile_id = b_profile.id # Only for perfo even it gains almost nothing | ||
3223 | 490 | master_account_id = b_profile.receivable_account_id | ||
3224 | 491 | master_account_id = master_account_id.id if master_account_id else False | ||
3225 | 492 | res = False | ||
3226 | 493 | for line in stat_line_obj.read(cr, uid, ctx['line_ids']): | ||
3227 | 494 | try: | ||
3228 | 495 | # performance trick | ||
3229 | 496 | line['master_account_id'] = master_account_id | ||
3230 | 497 | line['profile_id'] = profile_id | ||
3231 | 498 | res = stat_line_obj._get_line_values_from_rules(cr, uid, line, | ||
3232 | 499 | rules, context=ctx) | ||
3233 | 500 | if res: | ||
3234 | 501 | compl_lines += 1 | ||
3235 | 502 | except ErrorTooManyPartner, exc: | ||
3236 | 503 | msg_lines.append(repr(exc)) | ||
3237 | 504 | except Exception, exc: | ||
3238 | 505 | msg_lines.append(repr(exc)) | ||
3239 | 506 | error_type, error_value, trbk = sys.exc_info() | ||
3240 | 507 | st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value) | ||
3241 | 508 | st += ''.join(traceback.format_tb(trbk, 30)) | ||
3242 | 509 | _logger.error(st) | ||
3243 | 510 | if res: | ||
3244 | 511 | #stat_line_obj.write(cr, uid, [line.id], vals, context=ctx) | ||
3245 | 512 | try: | ||
3246 | 513 | stat_line_obj._update_line(cr, uid, res, context=context) | ||
3247 | 514 | except Exception as exc: | ||
3248 | 515 | msg_lines.append(repr(exc)) | ||
3249 | 516 | error_type, error_value, trbk = sys.exc_info() | ||
3250 | 517 | st = "Error: %s\nDescription: %s\nTraceback:" % (error_type.__name__, error_value) | ||
3251 | 518 | st += ''.join(traceback.format_tb(trbk, 30)) | ||
3252 | 519 | _logger.error(st) | ||
3253 | 520 | # we can commit as it is not needed to be atomic | ||
3254 | 521 | # commiting here adds a nice perfo boost | ||
3255 | 522 | if not compl_lines % 500: | ||
3256 | 523 | cr.commit() | ||
3257 | 524 | msg = u'\n'.join(msg_lines) | ||
3258 | 525 | self.write_completion_log(cr, uid, stat.id, | ||
3259 | 526 | msg, compl_lines, context=context) | ||
3260 | 527 | return True | ||
3261 | 0 | 528 | ||
3262 | === added file 'account_statement_base_completion/statement_view.xml' | |||
3263 | --- account_statement_base_completion/statement_view.xml 1970-01-01 00:00:00 +0000 | |||
3264 | +++ account_statement_base_completion/statement_view.xml 2013-07-17 14:55:41 +0000 | |||
3265 | @@ -0,0 +1,104 @@ | |||
3266 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
3267 | 2 | <openerp> | ||
3268 | 3 | <data> | ||
3269 | 4 | |||
3270 | 5 | <record id="bank_statement_view_form" model="ir.ui.view"> | ||
3271 | 6 | <field name="name">account_bank_statement_import_base.bank_statement.view_form</field> | ||
3272 | 7 | <field name="model">account.bank.statement</field> | ||
3273 | 8 | <field name="inherit_id" ref="account.view_bank_statement_form" /> | ||
3274 | 9 | <field eval="16" name="priority"/> | ||
3275 | 10 | <field name="type">form</field> | ||
3276 | 11 | <field name="arch" type="xml"> | ||
3277 | 12 | <data> | ||
3278 | 13 | <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/form/group/field[@name='sequence']" position="after"> | ||
3279 | 14 | <separator colspan="4" string="Importation related infos"/> | ||
3280 | 15 | <field name="label" /> | ||
3281 | 16 | <field name="already_completed" /> | ||
3282 | 17 | </xpath> | ||
3283 | 18 | |||
3284 | 19 | <!-- <xpath expr="/form/group[2]" position="attributes"> | ||
3285 | 20 | <attribute name="col">10</attribute> | ||
3286 | 21 | </xpath> --> | ||
3287 | 22 | |||
3288 | 23 | <xpath expr="/form/sheet/div[@name='import_buttons']" position="after"> | ||
3289 | 24 | <button name="button_auto_completion" string="Auto Completion" states='draft,open' type="object" colspan="1"/> | ||
3290 | 25 | </xpath> | ||
3291 | 26 | |||
3292 | 27 | <xpath expr="/form/sheet/notebook/page[@string='Transactions']" position="after"> | ||
3293 | 28 | <page string="Completion Logs" attrs="{'invisible':[('completion_logs','=',False)]}"> | ||
3294 | 29 | <field name="completion_logs" colspan="4" nolabel="1" attrs="{'invisible':[('completion_logs','=',False)]}"/> | ||
3295 | 30 | </page> | ||
3296 | 31 | </xpath> | ||
3297 | 32 | |||
3298 | 33 | </data> | ||
3299 | 34 | </field> | ||
3300 | 35 | </record> | ||
3301 | 36 | <record id="bank_statement_view_form2" model="ir.ui.view"> | ||
3302 | 37 | <field name="name">account_bank_statement_import_base.bank_statement.auto_cmpl</field> | ||
3303 | 38 | <field name="model">account.bank.statement</field> | ||
3304 | 39 | <field name="inherit_id" ref="account.view_bank_statement_form" /> | ||
3305 | 40 | <field name="type">form</field> | ||
3306 | 41 | <field name="arch" type="xml"> | ||
3307 | 42 | <data> | ||
3308 | 43 | <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='amount']" position="after"> | ||
3309 | 44 | <field name="already_completed" /> | ||
3310 | 45 | </xpath> | ||
3311 | 46 | </data> | ||
3312 | 47 | </field> | ||
3313 | 48 | </record> | ||
3314 | 49 | |||
3315 | 50 | <record id="statement_rules_view_form" model="ir.ui.view"> | ||
3316 | 51 | <field name="name">account.statement.profile.view</field> | ||
3317 | 52 | <field name="model">account.statement.profile</field> | ||
3318 | 53 | <field name="inherit_id" ref="account_statement_ext.statement_importer_view_form"/> | ||
3319 | 54 | <field name="type">form</field> | ||
3320 | 55 | <field name="arch" type="xml"> | ||
3321 | 56 | <field name="bank_statement_prefix" position="after"> | ||
3322 | 57 | <separator colspan="4" string="Auto-Completion Rules"/> | ||
3323 | 58 | <field name="rule_ids" colspan="4" nolabel="1"/> | ||
3324 | 59 | </field> | ||
3325 | 60 | </field> | ||
3326 | 61 | </record> | ||
3327 | 62 | |||
3328 | 63 | |||
3329 | 64 | <record id="statement_st_completion_rule_view_form" model="ir.ui.view"> | ||
3330 | 65 | <field name="name">account.statement.completion.rule.view</field> | ||
3331 | 66 | <field name="model">account.statement.completion.rule</field> | ||
3332 | 67 | <field name="type">form</field> | ||
3333 | 68 | <field name="arch" type="xml"> | ||
3334 | 69 | <form string="Statement Completion Rule"> | ||
3335 | 70 | <field name="sequence"/> | ||
3336 | 71 | <field name="name" select="1" /> | ||
3337 | 72 | <field name="function_to_call"/> | ||
3338 | 73 | <separator colspan="4" string="Related Profiles"/> | ||
3339 | 74 | <field name="profile_ids" nolabel="1" colspan="4"/> | ||
3340 | 75 | </form> | ||
3341 | 76 | </field> | ||
3342 | 77 | </record> | ||
3343 | 78 | |||
3344 | 79 | <record id="statement_st_completion_rule_view_tree" model="ir.ui.view"> | ||
3345 | 80 | <field name="name">account.statement.completion.rule.view</field> | ||
3346 | 81 | <field name="model">account.statement.completion.rule</field> | ||
3347 | 82 | <field name="type">tree</field> | ||
3348 | 83 | <field name="arch" type="xml"> | ||
3349 | 84 | <tree string="Statement Completion Rule"> | ||
3350 | 85 | <field name="sequence"/> | ||
3351 | 86 | <field name="name" select="1" /> | ||
3352 | 87 | <field name="profile_ids" /> | ||
3353 | 88 | <field name="function_to_call"/> | ||
3354 | 89 | </tree> | ||
3355 | 90 | </field> | ||
3356 | 91 | </record> | ||
3357 | 92 | <record id="action_st_completion_rule_tree" model="ir.actions.act_window"> | ||
3358 | 93 | <field name="name">Statement Completion Rule</field> | ||
3359 | 94 | <field name="res_model">account.statement.completion.rule</field> | ||
3360 | 95 | <field name="view_type">form</field> | ||
3361 | 96 | <field name="view_mode">tree,form</field> | ||
3362 | 97 | </record> | ||
3363 | 98 | |||
3364 | 99 | <menuitem string="Statement Completion Rule" action="action_st_completion_rule_tree" | ||
3365 | 100 | id="menu_action_st_completion_rule_tree_menu" parent="account.menu_configuration_misc" | ||
3366 | 101 | sequence="30"/> | ||
3367 | 102 | |||
3368 | 103 | </data> | ||
3369 | 104 | </openerp> | ||
3370 | 0 | 105 | ||
3371 | === added directory 'account_statement_base_import' | |||
3372 | === added file 'account_statement_base_import/__init__.py' | |||
3373 | --- account_statement_base_import/__init__.py 1970-01-01 00:00:00 +0000 | |||
3374 | +++ account_statement_base_import/__init__.py 2013-07-17 14:55:41 +0000 | |||
3375 | @@ -0,0 +1,23 @@ | |||
3376 | 1 | # -*- coding: utf-8 -*- | ||
3377 | 2 | ############################################################################## | ||
3378 | 3 | # | ||
3379 | 4 | # Author: Joel Grand-Guillaume | ||
3380 | 5 | # Copyright 2011-2012 Camptocamp SA | ||
3381 | 6 | # | ||
3382 | 7 | # This program is free software: you can redistribute it and/or modify | ||
3383 | 8 | # it under the terms of the GNU Affero General Public License as | ||
3384 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
3385 | 10 | # License, or (at your option) any later version. | ||
3386 | 11 | # | ||
3387 | 12 | # This program is distributed in the hope that it will be useful, | ||
3388 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3389 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3390 | 15 | # GNU Affero General Public License for more details. | ||
3391 | 16 | # | ||
3392 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
3393 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3394 | 19 | # | ||
3395 | 20 | ############################################################################## | ||
3396 | 21 | import parser | ||
3397 | 22 | import wizard | ||
3398 | 23 | import statement | ||
3399 | 0 | 24 | ||
3400 | === added file 'account_statement_base_import/__openerp__.py' | |||
3401 | --- account_statement_base_import/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
3402 | +++ account_statement_base_import/__openerp__.py 2013-07-17 14:55:41 +0000 | |||
3403 | @@ -0,0 +1,70 @@ | |||
3404 | 1 | # -*- coding: utf-8 -*- | ||
3405 | 2 | ############################################################################## | ||
3406 | 3 | # | ||
3407 | 4 | # Author: Joel Grand-Guillaume | ||
3408 | 5 | # Copyright 2011-2012 Camptocamp SA | ||
3409 | 6 | # | ||
3410 | 7 | # This program is free software: you can redistribute it and/or modify | ||
3411 | 8 | # it under the terms of the GNU Affero General Public License as | ||
3412 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
3413 | 10 | # License, or (at your option) any later version. | ||
3414 | 11 | # | ||
3415 | 12 | # This program is distributed in the hope that it will be useful, | ||
3416 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3417 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3418 | 15 | # GNU Affero General Public License for more details. | ||
3419 | 16 | # | ||
3420 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
3421 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
3422 | 19 | # | ||
3423 | 20 | ############################################################################## | ||
3424 | 21 | |||
3425 | 22 | {'name': "Bank statement base import", | ||
3426 | 23 | 'version': '1.0', | ||
3427 | 24 | 'author': 'Camptocamp', | ||
3428 | 25 | 'maintainer': 'Camptocamp', | ||
3429 | 26 | 'category': 'Finance', | ||
3430 | 27 | 'complexity': 'normal', | ||
3431 | 28 | 'depends': [ | ||
3432 | 29 | 'account_statement_ext', | ||
3433 | 30 | 'account_statement_base_completion' | ||
3434 | 31 | ], | ||
3435 | 32 | 'description': """ | ||
3436 | 33 | This module brings basic methods and fields on bank statement to deal with | ||
3437 | 34 | the importation of different bank and offices. A generic abstract method is defined and an | ||
3438 | 35 | example that gives you a basic way of importing bank statement through a standard file is provided. | ||
3439 | 36 | |||
3440 | 37 | This module improves the bank statement and allows you to import your bank transactions with | ||
3441 | 38 | a standard .csv or .xls file (you'll find it in the 'data' folder). It respects the profile | ||
3442 | 39 | (provided by the accouhnt_statement_ext module) to pass the entries. That means, | ||
3443 | 40 | you'll have to choose a file format for each profile. | ||
3444 | 41 | In order to achieve this it uses the `xlrd` Python module which you will need to install | ||
3445 | 42 | separately in your environment. | ||
3446 | 43 | |||
3447 | 44 | This module can handle a commission taken by the payment office and has the following format: | ||
3448 | 45 | |||
3449 | 46 | * ref : the SO number, INV number or any matching ref found. It'll be used as reference | ||
3450 | 47 | in the generated entries and will be useful for reconciliation process | ||
3451 | 48 | * date : date of the payment | ||
3452 | 49 | * amount : amount paid in the currency of the journal used in the importation profile | ||
3453 | 50 | * commission_amount : amount of the comission for each line | ||
3454 | 51 | * label : the comunication given by the payment office, used as communication in the | ||
3455 | 52 | generated entries. | ||
3456 | 53 | |||
3457 | 54 | The goal is here to populate the statement lines of a bank statement with the infos that the | ||
3458 | 55 | bank or office give you. Fell free to inherit from this module to add your own format.Then, | ||
3459 | 56 | if you need to complete data from there, add your own account_statement_*_completion module and implement | ||
3460 | 57 | the needed rules. | ||
3461 | 58 | |||
3462 | 59 | """, | ||
3463 | 60 | 'website': 'http://www.camptocamp.com', | ||
3464 | 61 | 'data': [ | ||
3465 | 62 | "wizard/import_statement_view.xml", | ||
3466 | 63 | "statement_view.xml", | ||
3467 | 64 | ], | ||
3468 | 65 | 'test': [], | ||
3469 | 66 | 'installable': True, | ||
3470 | 67 | 'images': [], | ||
3471 | 68 | 'auto_install': False, | ||
3472 | 69 | 'license': 'AGPL-3', | ||
3473 | 70 | } | ||
3474 | 0 | 71 | ||
3475 | === added directory 'account_statement_base_import/data' | |||
3476 | === added file 'account_statement_base_import/data/statement.csv' | |||
3477 | --- account_statement_base_import/data/statement.csv 1970-01-01 00:00:00 +0000 | |||
3478 | +++ account_statement_base_import/data/statement.csv 2013-07-17 14:55:41 +0000 | |||
3479 | @@ -0,0 +1,4 @@ | |||
3480 | 1 | "ref";"date";"amount";"commission_amount";"label" | ||
3481 | 2 | 50969286;2011-03-07 13:45:14;118.4;-11.84;"label a" | ||
3482 | 3 | 51065326;2011-03-05 13:45:14;189;-15.12;"label b" | ||
3483 | 4 | 51179306;2011-03-02 17:45:14;189;-15.12;"label c" | ||
3484 | 0 | 5 | ||
3485 | === added file 'account_statement_base_import/data/statement.xls' | |||
3486 | 1 | Binary files account_statement_base_import/data/statement.xls 1970-01-01 00:00:00 +0000 and account_statement_base_import/data/statement.xls 2013-07-17 14:55:41 +0000 differ | 6 | Binary files account_statement_base_import/data/statement.xls 1970-01-01 00:00:00 +0000 and account_statement_base_import/data/statement.xls 2013-07-17 14:55:41 +0000 differ |
3487 | === added directory 'account_statement_base_import/i18n' | |||
3488 | === added file 'account_statement_base_import/i18n/fr.po' | |||
3489 | --- account_statement_base_import/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
3490 | +++ account_statement_base_import/i18n/fr.po 2013-07-17 14:55:41 +0000 | |||
3491 | @@ -0,0 +1,253 @@ | |||
3492 | 1 | #. module: account_statement_base_import | ||
3493 | 2 | #: view:credit.statement.import:0 | ||
3494 | 3 | #: model:ir.actions.act_window,name:account_statement_base_import.statement_importer_action | ||
3495 | 4 | msgid "Import statement" | ||
3496 | 5 | msgstr "Import de relevé" | ||
3497 | 6 | |||
3498 | 7 | #. module: account_statement_base_import | ||
3499 | 8 | #: model:ir.model,name:account_statement_base_import.model_credit_statement_import | ||
3500 | 9 | msgid "credit.statement.import" | ||
3501 | 10 | msgstr "credit.statement.import" | ||
3502 | 11 | |||
3503 | 12 | #. module: account_statement_base_import | ||
3504 | 13 | #: code:addons/account_statement_base_import/statement.py:218 | ||
3505 | 14 | #, python-format | ||
3506 | 15 | msgid "The statement cannot be created : %s" | ||
3507 | 16 | msgstr "Le relevé ne peut être créé : %s" | ||
3508 | 17 | |||
3509 | 18 | #. module: account_statement_base_import | ||
3510 | 19 | #: field:credit.statement.import,input_statement:0 | ||
3511 | 20 | msgid "Statement file" | ||
3512 | 21 | msgstr "Fichier à importer" | ||
3513 | 22 | |||
3514 | 23 | #. module: account_statement_base_import | ||
3515 | 24 | #: view:account.statement.profile:0 | ||
3516 | 25 | msgid "Import Logs" | ||
3517 | 26 | msgstr "Journaux d'import" | ||
3518 | 27 | |||
3519 | 28 | #. module: account_statement_base_import | ||
3520 | 29 | #: field:credit.statement.import,journal_id:0 | ||
3521 | 30 | msgid "Financial journal to use transaction" | ||
3522 | 31 | msgstr "Journal" | ||
3523 | 32 | |||
3524 | 33 | #. module: account_statement_base_import | ||
3525 | 34 | #: code:addons/account_statement_base_import/parser/file_parser.py:100 | ||
3526 | 35 | #, python-format | ||
3527 | 36 | msgid "Column %s not present in file" | ||
3528 | 37 | msgstr "Colonne %s non présente dans le fichier" | ||
3529 | 38 | |||
3530 | 39 | #. module: account_statement_base_import | ||
3531 | 40 | #: view:account.statement.profile:0 | ||
3532 | 41 | #: model:ir.ui.menu,name:account_statement_base_import.statement_importer_menu | ||
3533 | 42 | msgid "Import Bank Statement" | ||
3534 | 43 | msgstr "Importation de relevé" | ||
3535 | 44 | |||
3536 | 45 | #. module: account_statement_base_import | ||
3537 | 46 | #: model:ir.model,name:account_statement_base_import.model_account_statement_profile | ||
3538 | 47 | msgid "Statement Profil" | ||
3539 | 48 | msgstr "Profil du relevé" | ||
3540 | 49 | |||
3541 | 50 | #. module: account_statement_base_import | ||
3542 | 51 | #: code:addons/account_statement_base_import/statement.py:100 | ||
3543 | 52 | #, python-format | ||
3544 | 53 | msgid "Commission line" | ||
3545 | 54 | msgstr "Ligne de commission" | ||
3546 | 55 | |||
3547 | 56 | #. module: account_statement_base_import | ||
3548 | 57 | #: field:credit.statement.import,commission_account_id:0 | ||
3549 | 58 | msgid "Commission account" | ||
3550 | 59 | msgstr "Compte de commission" | ||
3551 | 60 | |||
3552 | 61 | #. module: account_statement_base_import | ||
3553 | 62 | #: code:addons/account_statement_base_import/statement.py:172 | ||
3554 | 63 | #, python-format | ||
3555 | 64 | msgid "Column %s you try to import is not present in the bank statement line !" | ||
3556 |