Merge lp:~openerp-expert-accounting/openobject-addons/5.0-improvement into lp:openobject-addons
- 5.0-improvement
- Merge into trunk
Proposed by
Anil Nair
Status: | Rejected |
---|---|
Rejected by: | qdp (OpenERP) |
Proposed branch: | lp:~openerp-expert-accounting/openobject-addons/5.0-improvement |
Merge into: | lp:openobject-addons |
Diff against target: |
2536 lines (+2344/-0) 35 files modified
account_3rd_party_generat/__init__.py (+33/-0) account_3rd_party_generat/__terp__.py (+72/-0) account_3rd_party_generat/data/account_seq.xml (+36/-0) account_3rd_party_generat/doc/functional.rst (+31/-0) account_3rd_party_generat/i18n/fr_FR.po (+106/-0) account_3rd_party_generat/object/__init__.py (+32/-0) account_3rd_party_generat/object/modificators.py (+120/-0) account_3rd_party_generat/object/partner.py (+243/-0) account_3rd_party_generat/wizard/__init__.py (+31/-0) account_3rd_party_generat/wizard/install_wizard.py (+121/-0) account_3rd_party_generat/wizard/install_wizard.xml (+46/-0) account_bank_deposit_slip/__init__.py (+26/-0) account_bank_deposit_slip/__terp__.py (+72/-0) account_bank_deposit_slip/data/sequence.xml (+27/-0) account_bank_deposit_slip/object/__init__.py (+26/-0) account_bank_deposit_slip/object/account_bank_deposit_slip.py (+195/-0) account_bank_deposit_slip/report/__init__.py (+23/-0) account_bank_deposit_slip/view/bank_deposit_view.xml (+55/-0) account_bank_deposit_slip/view/menu.xml (+32/-0) account_invoice_merge/__init__.py (+27/-0) account_invoice_merge/__terp__.py (+67/-0) account_invoice_merge/object/__init__.py (+26/-0) account_invoice_merge/object/invoice.py (+122/-0) account_invoice_merge/wizard/__init__.py (+26/-0) account_invoice_merge/wizard/invoice_merge_view.xml (+51/-0) account_invoice_merge/wizard/merge_invoice.py (+91/-0) account_journal_uniq_code/__init__.py (+25/-0) account_journal_uniq_code/__terp__.py (+58/-0) account_journal_uniq_code/object/__init__.py (+25/-0) account_journal_uniq_code/object/account_journal.py (+87/-0) account_move/__init__.py (+28/-0) account_move/__terp__.py (+72/-0) account_move/object/__init__.py (+27/-0) account_move/object/account_move.py (+71/-0) account_move/object/account_move_line.py (+214/-0) |
To merge this branch: | bzr merge lp:~openerp-expert-accounting/openobject-addons/5.0-improvement |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+113964@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
qdp (OpenERP) (qdp) wrote : | # |
Unmerged revisions
- 6. By Claude Brulé
-
[ADD] Add module account_
invoice_ merge : merging draft invoices
* usefull espcially in purchase purpose, but can be used to sales to - 5. By Claude Brulé
-
[ADD] Add module account_
journal_ uniq_code, disallow duplicate code on account journal - 4. By Claude Brulé
-
[ADD] Add module account_move witch add basic function to account moves
* this module will be used by many others, like wizards, banking actions, and so on - 3. By Claude Brulé
-
[ADD] Add module account_
bank_deposit_ slip (developpment version)
* This module is used to transfert moves for a journal to another - 2. By Claude Brulé
-
[ADD] Pulish module account_
3rd_party_ generat done by Sistheo earlier in 2009. - 1. By Claude Brulé
-
[ADD] create empty branch for accoting module on OpenERP 5.0
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'account_3rd_party_generat' |
2 | === added file 'account_3rd_party_generat/__init__.py' |
3 | --- account_3rd_party_generat/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ account_3rd_party_generat/__init__.py 2012-07-09 12:36:28 +0000 |
5 | @@ -0,0 +1,33 @@ |
6 | +# -*- coding: utf-8 -*- |
7 | + |
8 | +############################################################################## |
9 | +# |
10 | +# Copyright (c) 2008 SISTHEO |
11 | +# |
12 | +# WARNING: This program as such is intended to be used by professional |
13 | +# programmers who take the whole responsability of assessing all potential |
14 | +# consequences resulting from its eventual inadequacies and bugs |
15 | +# End users who are looking for a ready-to-use solution with commercial |
16 | +# garantees and support are strongly adviced to contract a Free Software |
17 | +# Service Company |
18 | +# |
19 | +# This program is Free Software; you can redistribute it and/or |
20 | +# modify it under the terms of the GNU General Public License |
21 | +# as published by the Free Software Foundation; either version 2 |
22 | +# of the License, or (at your option) any later version. |
23 | +# |
24 | +# This program is distributed in the hope that it will be useful, |
25 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
26 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
27 | +# GNU General Public License for more details. |
28 | +# |
29 | +# You should have received a copy of the GNU General Public License |
30 | +# along with this program; if not, write to the Free Software |
31 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
32 | +# |
33 | +############################################################################## |
34 | + |
35 | +import object |
36 | +import wizard |
37 | + |
38 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
39 | |
40 | === added file 'account_3rd_party_generat/__terp__.py' |
41 | --- account_3rd_party_generat/__terp__.py 1970-01-01 00:00:00 +0000 |
42 | +++ account_3rd_party_generat/__terp__.py 2012-07-09 12:36:28 +0000 |
43 | @@ -0,0 +1,72 @@ |
44 | +# -*- coding: utf-8 -*- |
45 | + |
46 | +############################################################################## |
47 | +# |
48 | +# Copyright (c) 2009 SISTHEO |
49 | +# |
50 | +# WARNING: This program as such is intended to be used by professional |
51 | +# programmers who take the whole responsability of assessing all potential |
52 | +# consequences resulting from its eventual inadequacies and bugs |
53 | +# End users who are looking for a ready-to-use solution with commercial |
54 | +# garantees and support are strongly adviced to contract a Free Software |
55 | +# Service Company |
56 | +# |
57 | +# This program is Free Software; you can redistribute it and/or |
58 | +# modify it under the terms of the GNU General Public License |
59 | +# as published by the Free Software Foundation; either version 2 |
60 | +# of the License, or (at your option) any later version. |
61 | +# |
62 | +# This program is distributed in the hope that it will be useful, |
63 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
64 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
65 | +# GNU General Public License for more details. |
66 | +# |
67 | +# You should have received a copy of the GNU General Public License |
68 | +# along with this program; if not, write to the Free Software |
69 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
70 | +# |
71 | +############################################################################## |
72 | +# AUTHOR : Claude Brulé for SISTHEO |
73 | +############################################################################## |
74 | +# Date Author Description |
75 | +# 20090604 SYLEAM/CB |
76 | +# 20090604 SYLEAM/CB update terp description |
77 | +# |
78 | +############################################################################## |
79 | + |
80 | +{ |
81 | + "name" : "third parties account number generation", |
82 | + "version" : "1.0.0", |
83 | + "author" : "SISTHEO", |
84 | + "website": "http://www.sistheo.fr", |
85 | + "category" : "Generic Modules/Accounting", |
86 | + "description": """. |
87 | +This module is automaticaly create account number in chat of account according to the partner. |
88 | +If partner is customer it generate third party account and associate this new accoun to partner. |
89 | +The same is also done for suppliers. |
90 | + |
91 | +Please be carefull that you should have an account chart already installed in order to setup this module. |
92 | +Otherwise, configuration wizard won't be able to select account as a model. |
93 | + |
94 | + |
95 | +Credit : |
96 | + EverLibre, Zeekom, Syleam |
97 | + |
98 | +Last-upadte: 2009-10-28 |
99 | +""", |
100 | + "depends" : [ 'base', |
101 | + 'account', |
102 | +# 'account_chart', |
103 | + ], |
104 | + "init_xml" : [ |
105 | + ], |
106 | + "update_xml" : [ |
107 | + "data/account_seq.xml", |
108 | + "wizard/install_wizard.xml", |
109 | + ], |
110 | + "demo_xml" : [], |
111 | + "active": False, |
112 | + "installable": True |
113 | +} |
114 | + |
115 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
116 | |
117 | === added directory 'account_3rd_party_generat/data' |
118 | === added file 'account_3rd_party_generat/data/account_seq.xml' |
119 | --- account_3rd_party_generat/data/account_seq.xml 1970-01-01 00:00:00 +0000 |
120 | +++ account_3rd_party_generat/data/account_seq.xml 2012-07-09 12:36:28 +0000 |
121 | @@ -0,0 +1,36 @@ |
122 | +<?xml version="1.0" encoding="utf-8"?> |
123 | +<openerp> |
124 | + <data noupdate="1"> |
125 | + |
126 | +<!-- |
127 | + Sequences types for invoices |
128 | +--> |
129 | + <record model="ir.sequence.type" id="seq_type_partner_third_part"> |
130 | + <field name="name">Account third part</field> |
131 | + <field name="code">account.partner.third_part</field> |
132 | + </record> |
133 | + |
134 | +<!-- |
135 | + Sequences for invoices |
136 | +--> |
137 | + <record model="ir.sequence" id="seq_supplier_account"> |
138 | + <field name="name">Supplier account</field> |
139 | + <field name="code">account.partner.third_part</field> |
140 | + <field name="prefix">401</field> |
141 | + <field name="number_next" eval="1"/> |
142 | + <field name="number_increment" eval="1"/> |
143 | + <field name="padding" eval="6"/> |
144 | + <!-- field name="suffix"></field --> |
145 | + </record> |
146 | + <record model="ir.sequence" id="seq_customer_account"> |
147 | + <field name="name">Customer account</field> |
148 | + <field name="code">account.partner.third_part</field> |
149 | + <field name="prefix">411</field> |
150 | + <field name="number_next" eval="1"/> |
151 | + <field name="number_increment" eval="1"/> |
152 | + <field name="padding" eval="6"/> |
153 | + <!-- field name="suffix"></field --> |
154 | + </record> |
155 | + |
156 | + </data> |
157 | +</openerp> |
158 | |
159 | === added directory 'account_3rd_party_generat/doc' |
160 | === added file 'account_3rd_party_generat/doc/functional.rst' |
161 | --- account_3rd_party_generat/doc/functional.rst 1970-01-01 00:00:00 +0000 |
162 | +++ account_3rd_party_generat/doc/functional.rst 2012-07-09 12:36:28 +0000 |
163 | @@ -0,0 +1,31 @@ |
164 | +FUNCTIONAL DETAILS / USER GUIDE |
165 | +=============================== |
166 | + |
167 | +The aim of this module is to automaticly create third parts accounts number from partner creation or update. |
168 | +As the partner is flag as customer or supplier, it generate the appropriate account number. |
169 | +This is based on sequences to have benefits of prefix (E.g. root of account number), suffix and increments. |
170 | +It uses ir.properties (witch already exist and are setted by default) as originals accounts numbers and duplicate it (keeping same parameters). |
171 | + |
172 | +The sequence is a kind of parameter value. You can use partner fields (between {}) witch will be replaced bu corresponding values. |
173 | +E.g. {ref} will be replaced by partner.ref (the code of partner) |
174 | + |
175 | +You can also use modificators between pipes (|) modify the above replaced value. |
176 | +Modificators are : |
177 | + * rmspace : remove all spaces |
178 | + * rmponct : remove special characters |
179 | + * rmaccent : convert characters with accent in characeters with no accent |
180 | + * rmspe : keep only letters |
181 | + * truncate1 : keep first character |
182 | + * truncate2 : cut after second character |
183 | + * truncate4 : four first characters |
184 | + * truncate6 : six first characters |
185 | + * charnum : return number of alphabetic character (Eg: G is 07) |
186 | + * capitalize : transforme in upper case |
187 | + * lower : transforme in lower case |
188 | + * zfill2 : padding left with 0 |
189 | + * zfill4 : padding left with 0 (until length = four) |
190 | + * zfill6 : padding left with 0 (until length = four) |
191 | + |
192 | +Modificators can be joined. |
193 | +E.g. {name|truncate4|capitalize} |
194 | + |
195 | |
196 | === added directory 'account_3rd_party_generat/i18n' |
197 | === added file 'account_3rd_party_generat/i18n/fr_FR.po' |
198 | --- account_3rd_party_generat/i18n/fr_FR.po 1970-01-01 00:00:00 +0000 |
199 | +++ account_3rd_party_generat/i18n/fr_FR.po 2012-07-09 12:36:28 +0000 |
200 | @@ -0,0 +1,106 @@ |
201 | +# Translation of OpenERP Server. |
202 | +# This file contains the translation of the following modules: |
203 | +# * account_3rd_party_generat |
204 | +# |
205 | +msgid "" |
206 | +msgstr "" |
207 | +"Project-Id-Version: OpenERP Server 5.0.1\n" |
208 | +"Report-Msgid-Bugs-To: support@openerp.com\n" |
209 | +"POT-Creation-Date: 2009-07-13 14:20:28+0000\n" |
210 | +"PO-Revision-Date: 2009-07-13 16:24+0100\n" |
211 | +"Last-Translator: Claude BRULE <Claude.Brule@Syleam.fr>\n" |
212 | +"Language-Team: \n" |
213 | +"MIME-Version: 1.0\n" |
214 | +"Content-Type: text/plain; charset=UTF-8\n" |
215 | +"Content-Transfer-Encoding: 8bit\n" |
216 | +"Plural-Forms: \n" |
217 | + |
218 | +#. module: account_3rd_party_generat |
219 | +#: constraint:ir.ui.view:0 |
220 | +msgid "Invalid XML for View Architecture!" |
221 | +msgstr "XML non valide pour l'architecture de la vue" |
222 | + |
223 | +#. module: account_3rd_party_generat |
224 | +#: field:wizard.install.third.part.accounts,payable_id:0 |
225 | +msgid "Account payable" |
226 | +msgstr "Compte fournisseur" |
227 | + |
228 | +#. module: account_3rd_party_generat |
229 | +#: view:wizard.install.third.part.accounts:0 |
230 | +msgid "Account number" |
231 | +msgstr "Numéro de compte" |
232 | + |
233 | +#. module: account_3rd_party_generat |
234 | +#: view:wizard.install.third.part.accounts:0 |
235 | +msgid "Accounts Generate" |
236 | +msgstr "Génération des comptes de tiers" |
237 | + |
238 | +#. module: account_3rd_party_generat |
239 | +#: model:ir.module.module,description:account_3rd_party_generat.module_meta_information |
240 | +msgid "" |
241 | +".\n" |
242 | +"This module is automaticaly create account number in chat of account according to the partner.\n" |
243 | +"If partner is customer it generate third party account and associate this new accoun to partner.\n" |
244 | +"The same is also done for suppliers.\n" |
245 | +"\n" |
246 | +"Credit :\n" |
247 | +" EverLibre, Zeekom, Syleam\n" |
248 | +"\n" |
249 | +"Lats-upadte: 2009-06-04\n" |
250 | +msgstr "" |
251 | +".\n" |
252 | +"This module is automaticaly create account number in chat of account according to the partner.\n" |
253 | +"If partner is customer it generate third party account and associate this new accoun to partner.\n" |
254 | +"The same is also done for suppliers.\n" |
255 | +"\n" |
256 | +"Credit :\n" |
257 | +" EverLibre, Zeekom, Syleam\n" |
258 | +"\n" |
259 | +"Lats-upadte: 2009-06-04\n" |
260 | + |
261 | +#. module: account_3rd_party_generat |
262 | +#: field:wizard.install.third.part.accounts,company_id:0 |
263 | +msgid "Company" |
264 | +msgstr "Société" |
265 | + |
266 | +#. module: account_3rd_party_generat |
267 | +#: model:ir.actions.act_window,name:account_3rd_party_generat.action_third_part_account |
268 | +#: model:ir.actions.todo,note:account_3rd_party_generat.config_third_part_account |
269 | +msgid "Configure third party account rules" |
270 | +msgstr "Configurer la règle de création des comptes de tiers" |
271 | + |
272 | +#. module: account_3rd_party_generat |
273 | +#: view:wizard.install.third.part.accounts:0 |
274 | +msgid "Update" |
275 | +msgstr "Mettre à jour" |
276 | + |
277 | +#. module: account_3rd_party_generat |
278 | +#: model:ir.module.module,shortdesc:account_3rd_party_generat.module_meta_information |
279 | +msgid "third parties account number generation" |
280 | +msgstr "Génération automatique des comptes de tiers" |
281 | + |
282 | +#. module: account_3rd_party_generat |
283 | +#: model:ir.model,name:account_3rd_party_generat.model_wizard_install_third_part_accounts |
284 | +msgid "wizard.install.third.part.accounts" |
285 | +msgstr "wizard.install.third.part.accounts" |
286 | + |
287 | +#. module: account_3rd_party_generat |
288 | +#: constraint:ir.actions.act_window:0 |
289 | +msgid "Invalid model name in the action definition." |
290 | +msgstr "Nom du Modèle non valide pour la définition de l'action." |
291 | + |
292 | +#. module: account_3rd_party_generat |
293 | +#: view:wizard.install.third.part.accounts:0 |
294 | +msgid "Cancel" |
295 | +msgstr "Annuler" |
296 | + |
297 | +#. module: account_3rd_party_generat |
298 | +#: constraint:ir.model:0 |
299 | +msgid "The Object name must start with x_ and not contain any special character !" |
300 | +msgstr "Le nom de l'objet doit commencer avec x_ et ne pas contenir de charactères spéciaux !" |
301 | + |
302 | +#. module: account_3rd_party_generat |
303 | +#: field:wizard.install.third.part.accounts,receivable_id:0 |
304 | +msgid "Account receivable" |
305 | +msgstr "Compte client" |
306 | + |
307 | |
308 | === added directory 'account_3rd_party_generat/object' |
309 | === added file 'account_3rd_party_generat/object/__init__.py' |
310 | --- account_3rd_party_generat/object/__init__.py 1970-01-01 00:00:00 +0000 |
311 | +++ account_3rd_party_generat/object/__init__.py 2012-07-09 12:36:28 +0000 |
312 | @@ -0,0 +1,32 @@ |
313 | +# -*- coding: utf-8 -*- |
314 | + |
315 | +############################################################################## |
316 | +# |
317 | +# Copyright (c) 2008 SISTHEO |
318 | +# |
319 | +# WARNING: This program as such is intended to be used by professional |
320 | +# programmers who take the whole responsability of assessing all potential |
321 | +# consequences resulting from its eventual inadequacies and bugs |
322 | +# End users who are looking for a ready-to-use solution with commercial |
323 | +# garantees and support are strongly adviced to contract a Free Software |
324 | +# Service Company |
325 | +# |
326 | +# This program is Free Software; you can redistribute it and/or |
327 | +# modify it under the terms of the GNU General Public License |
328 | +# as published by the Free Software Foundation; either version 2 |
329 | +# of the License, or (at your option) any later version. |
330 | +# |
331 | +# This program is distributed in the hope that it will be useful, |
332 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
333 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
334 | +# GNU General Public License for more details. |
335 | +# |
336 | +# You should have received a copy of the GNU General Public License |
337 | +# along with this program; if not, write to the Free Software |
338 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
339 | +# |
340 | +############################################################################## |
341 | + |
342 | +import partner |
343 | + |
344 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
345 | |
346 | === added file 'account_3rd_party_generat/object/modificators.py' |
347 | --- account_3rd_party_generat/object/modificators.py 1970-01-01 00:00:00 +0000 |
348 | +++ account_3rd_party_generat/object/modificators.py 2012-07-09 12:36:28 +0000 |
349 | @@ -0,0 +1,120 @@ |
350 | +# -*- coding: utf-8 -*- |
351 | +############################################################################## |
352 | +# |
353 | +# OpenERP, Open Source Management Solution |
354 | +# Copyright (C) 2009 SISTHEO |
355 | +# |
356 | +# This program is free software: you can redistribute it and/or modify |
357 | +# it under the terms of the GNU General Public License as published by |
358 | +# the Free Software Foundation, either version 3 of the License, or |
359 | +# (at your option) any later version. |
360 | +# |
361 | +# This program is distributed in the hope that it will be useful, |
362 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
363 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
364 | +# GNU General Public License for more details. |
365 | +# |
366 | +# You should have received a copy of the GNU General Public License |
367 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
368 | +# |
369 | +############################################################################## |
370 | +# AIM : |
371 | +# library to generate account codes |
372 | +# |
373 | +############################################################################## |
374 | +# Date Author Description |
375 | +# 20090603 SYLEAM/CB modificators |
376 | +# |
377 | +############################################################################## |
378 | +# TECHNICAL DETAILS : |
379 | +# 'code': fields.char('Code', size=64) |
380 | +############################################################################## |
381 | + |
382 | + |
383 | +import string |
384 | + |
385 | + |
386 | +class Modificator(object): |
387 | + |
388 | + def __init__(self, strVal): |
389 | + self.strVal = strVal |
390 | + |
391 | + def setval(self, strVal): |
392 | + self.strVal = strVal |
393 | + |
394 | + |
395 | + def rmspace(self): |
396 | + #return self.strVal.replace(' ','') |
397 | + return self.strVal.strip() |
398 | + |
399 | + def strip(self): |
400 | + return self.strVal.strip() |
401 | + |
402 | + def rmponct(self): |
403 | + newval = self.strVal |
404 | + for i in range(len(string.punctuation)): |
405 | + newval = newval.replace(string.punctuation[i], '') |
406 | + return newval |
407 | + |
408 | + def rmaccent(self): |
409 | + #see also : from string import maketrans || string.translate |
410 | + newval = self.strVal.encode('utf-8') |
411 | + oldchar = "àäâéèëêïîöôüûùÿÄÂËÊÏÎÖÔÜÛ".decode('utf-8') |
412 | + newchar = "aaaeeeeiioouuuyAAEEIIOOUU" |
413 | + for i in range(len(oldchar)): |
414 | + newval = newval.replace(oldchar[i].encode('utf-8'), newchar[i]) |
415 | + return newval |
416 | + |
417 | + def rmspe(self): |
418 | + allowed_chars = string.letters + string.digits |
419 | + return ''.join(c for c in self.strVal if c in allowed_chars) |
420 | + |
421 | + def truncate1(self): |
422 | + return self.strVal[:1] |
423 | + |
424 | + def truncate2(self): |
425 | + return self.strVal[:2] |
426 | + |
427 | + def truncate3(self): |
428 | + return self.strVal[:3] |
429 | + |
430 | + def truncate4(self): |
431 | + return self.strVal[:4] |
432 | + |
433 | + def truncate6(self): |
434 | +# print "DEBUG: Modificator::truncate6 --> %r" % self.strVal[:6] |
435 | + return self.strVal[:6] |
436 | + |
437 | + def truncate12(self): |
438 | + return self.strVal[:12] |
439 | + |
440 | + def charnum(self): |
441 | + first_letter = self.strVal[0] |
442 | + if first_letter.isalpha(): |
443 | + num = ord(first_letter.upper()) - 64 |
444 | + return ("%d" % num).zfill(2) |
445 | + else: |
446 | + return "00" |
447 | + |
448 | + def capitalize(self): |
449 | +# print "DEBUG: Modificator::capitalize --> %r" % self.strVal.upper() |
450 | + return self.strVal.upper() |
451 | + def upper(self): |
452 | + return self.strVal.upper() |
453 | + def uppercase(self): |
454 | + return self.strVal.upper() |
455 | + |
456 | + def lower(self): |
457 | + return self.strVal.lower() |
458 | + def lowercase(self): |
459 | + return self.strVal.lower() |
460 | + |
461 | + def zfill2(self): |
462 | + return self.strVal.zfill(2) |
463 | + |
464 | + def zfill4(self): |
465 | + return self.strVal.zfill(4) |
466 | + |
467 | + def zfill6(self): |
468 | + return self.strVal.zfill(6) |
469 | + |
470 | |
471 | === added file 'account_3rd_party_generat/object/partner.py' |
472 | --- account_3rd_party_generat/object/partner.py 1970-01-01 00:00:00 +0000 |
473 | +++ account_3rd_party_generat/object/partner.py 2012-07-09 12:36:28 +0000 |
474 | @@ -0,0 +1,243 @@ |
475 | +# -*- coding: utf-8 -*- |
476 | + |
477 | +############################################################################## |
478 | +# |
479 | +# OpenERP, Open Source Management Solution |
480 | +# Copyright (C) 2009 SISTHEO |
481 | +# |
482 | +# This program is free software: you can redistribute it and/or modify |
483 | +# it under the terms of the GNU General Public License as published by |
484 | +# the Free Software Foundation, either version 3 of the License, or |
485 | +# (at your option) any later version. |
486 | +# |
487 | +# This program is distributed in the hope that it will be useful, |
488 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
489 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
490 | +# GNU General Public License for more details. |
491 | +# |
492 | +# You should have received a copy of the GNU General Public License |
493 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
494 | +# |
495 | +############################################################################## |
496 | +# AIM : |
497 | +# generate third part accunt number on partner's view |
498 | +# |
499 | +############################################################################## |
500 | +# Date Author Description |
501 | +# 20090327 SYLEAM/CB use the default parnet's account value as a patern |
502 | +# 20090603 SYLEAM/CB Add modificators |
503 | +# |
504 | +############################################################################## |
505 | +# TODO : |
506 | +# translate / create po file |
507 | +############################################################################## |
508 | + |
509 | +from osv import fields, osv |
510 | +from tools.translate import _ |
511 | +from modificators import * |
512 | + |
513 | + |
514 | +class res_partner(osv.osv): |
515 | + _inherit = 'res.partner' |
516 | + |
517 | + _defaults = { |
518 | + 'customer': lambda *a: 0, # Do not compute account number if not necessary |
519 | + } |
520 | + |
521 | +#---------------------------------------------------------- |
522 | +# Private methods C&S |
523 | +#---------------------------------------------------------- |
524 | + def _get_compute_account_number(self, cr, uid, partner, seq_patern): |
525 | + """Compute account code based on partner and sequence |
526 | + |
527 | + @param partner: (browse/id) partner's datas |
528 | + @param seq_patern: (string) the sequence witch will be use as a patern/template |
529 | + |
530 | + @return: (string) the account code/number |
531 | + """ |
532 | + if seq_patern.find('{') >= 0: |
533 | + prefix = seq_patern[:seq_patern.index('{')] |
534 | + suffix = seq_patern[seq_patern.index('}')+1:] |
535 | + body = seq_patern[len(prefix)+1:][:len(seq_patern)-len(prefix)-len(suffix)-2] |
536 | + |
537 | + ar_args = body.split('|') |
538 | + # print "DEBUG: compute_account_number ar_args = %r" % ar_args |
539 | + # partner field is always first |
540 | + partner_value = getattr(partner, ar_args[0]) |
541 | + # print "DEBUG: compute_account_number partner_value = %r" % partner_value |
542 | + if partner_value: |
543 | + # Modificators |
544 | + mdf = Modificator(partner_value) |
545 | + for i in range(1, len(ar_args)): |
546 | + mdf_funct = getattr(mdf, ar_args[i]) |
547 | + partner_value = mdf_funct() |
548 | + mdf.setval(partner_value) |
549 | + account_number = prefix + partner_value + suffix |
550 | + else: |
551 | + account_number = prefix + suffix |
552 | + else: |
553 | + account_number = seq_patern |
554 | + |
555 | + # is there internal sequence ? |
556 | + pos_iseq = account_number.find('#') |
557 | + if pos_iseq >= 0: |
558 | + nzf = account_number.count('#') |
559 | + rootpart = account_number[:pos_iseq] |
560 | + # verify if root of this number is existing |
561 | + arAcc_ids = self.pool.get('account.account').search(cr, uid, [('code','like',rootpart)]) |
562 | + cnt = len(arAcc_ids) |
563 | + next_inc = ("%0d" % int(cnt + 1)).zfill(nzf) |
564 | + account_number = account_number.replace('#' * nzf, next_inc) |
565 | + |
566 | + return account_number |
567 | + |
568 | + |
569 | + def _get_account_model(self, cr, uid, model_name): |
570 | + """Retreive default property for partner's account. This will be use as template / default values. |
571 | + |
572 | + @param model_name: (string) the name of the property |
573 | + |
574 | + @return: (browse/id) the account (object) |
575 | + """ |
576 | + property_obj = self.pool.get('ir.property') |
577 | + property_id = property_obj.search(cr, uid, [('name','=', model_name),('res_id','=',False)]) |
578 | + if not property_id or len(property_id) != 1: |
579 | + #raise osv.except_osv(_('Error !'),_('You need to define ONE default account number in properties for %s' % model_name)) |
580 | + return False |
581 | + property_data = self.pool.get('ir.property').browse(cr,uid, property_id)[0] |
582 | + account_id = int(property_data.value.split(',')[1]) |
583 | + account_data = self.pool.get('account.account').browse(cr,uid, account_id) |
584 | + return account_data |
585 | + |
586 | + |
587 | + def _get_data_account_model(self, brobj_account): |
588 | + """Retreive account values from template. |
589 | + |
590 | + @param brobj_account: (browse/id) account template datas/values |
591 | + |
592 | + @return: (dict) the account values |
593 | + """ |
594 | +#FIXME there may be a better way to transfert data form parent to child's patern |
595 | + data_account_model = { |
596 | + 'currency_id': brobj_account.currency_id.id, |
597 | + 'user_type': brobj_account.user_type.id, |
598 | + 'parent_id': brobj_account.id, |
599 | + 'reconcile': brobj_account.reconcile, |
600 | + 'shortcut': brobj_account.shortcut, |
601 | +# 'tax_ids': parent_account., # not a good idea to have tax hear |
602 | +# 'note': parent_account, # keep it blank |
603 | + 'company_currency_id': brobj_account.company_currency_id.id, |
604 | + 'company_id': brobj_account.company_id.id, |
605 | + 'active': True, |
606 | + 'parent_left': brobj_account.parent_left, |
607 | + 'parent_right': brobj_account.parent_right, |
608 | + 'currency_mode': brobj_account.currency_mode, |
609 | + 'check_history': brobj_account.check_history, |
610 | + } |
611 | + #print "_get_data_account_model %r" % data_account_model |
612 | + return data_account_model |
613 | + |
614 | + |
615 | + def _get_account_sequence(self, cr, uid, seq_name): |
616 | + """Retreive sequence value (next number). |
617 | + |
618 | + @param seq_name: (string) name of the sequence (not the same on suppliers and customers) |
619 | + |
620 | + @return: (string) the next value from selected sequence |
621 | + """ |
622 | + sequence_obj = self.pool.get('ir.sequence') |
623 | + sequence_id = sequence_obj.search(cr, uid, [('code','=', 'account.partner.third_part'), ('name','=', seq_name)]) |
624 | + if not sequence_id or len(sequence_id) != 1: |
625 | + raise osv.except_osv(_('Error !'),_('You need to define the %s sequence' % seq_name)) |
626 | + sequence_data = self.pool.get('ir.sequence').get_id(cr, uid, sequence_id[0]) |
627 | + return sequence_data |
628 | + |
629 | + |
630 | +#---------------------------------------------------------- |
631 | +# Private methods CUSTOMER ONLY |
632 | +#---------------------------------------------------------- |
633 | + def _get_customer_account_model(self, cr, uid): |
634 | + """Retreive values from template for customer account. |
635 | + |
636 | + @return: (dict) the account values |
637 | + """ |
638 | + parent_account = self._get_account_model(cr, uid, 'property_account_receivable') |
639 | + if not parent_account: |
640 | + return False |
641 | + customer_account_model = self._get_data_account_model(parent_account) |
642 | + customer_account_model['type'] = 'receivable' |
643 | + return customer_account_model |
644 | + |
645 | + |
646 | + def _get_customer_account_sequence(self, cr, uid): |
647 | + """Retreive customer sequence next value. |
648 | + |
649 | + @return: (string) the next value from selected sequence |
650 | + """ |
651 | + return self._get_account_sequence(cr, uid, 'Customer account') |
652 | + |
653 | + |
654 | +#---------------------------------------------------------- |
655 | +# Private methods SUPPLIER ONLY |
656 | +#---------------------------------------------------------- |
657 | + def _get_supplier_account_model(self, cr, uid): |
658 | + """Retreive values from template for supplier account. |
659 | + |
660 | + @return: (dict) the account values |
661 | + """ |
662 | + parent_account = self._get_account_model(cr, uid, 'property_account_payable') |
663 | + if not parent_account: |
664 | + return False |
665 | + supplier_account_model = self._get_data_account_model(parent_account) |
666 | + supplier_account_model['type'] = 'payable' |
667 | + return supplier_account_model |
668 | + |
669 | + |
670 | + def _get_supplier_account_sequence(self, cr, uid): |
671 | + """Retreive supplier sequence next value. |
672 | + |
673 | + @return: (string) the next value from selected sequence |
674 | + """ |
675 | + return self._get_account_sequence(cr, uid, 'Supplier account') |
676 | + |
677 | + |
678 | +# ######################################################### |
679 | +# O V E R L O A D O S V |
680 | +# ######################################################### |
681 | + def create(self, cr, uid, data, context={}): |
682 | + new_id = super(res_partner, self).create(cr, uid, data, context) |
683 | + if (('customer' in data) and (data['customer'] == 1)) or (('supplier' in data) and (data['supplier'] == 1)): |
684 | + self.write(cr, uid, [new_id], {}, context) # fire account number computation (based on partner datas) |
685 | + return new_id |
686 | + |
687 | + |
688 | + def write(self, cr, uid, ids, vals, context={}): |
689 | + # Update all ids (batch way) |
690 | + osv_stuff = super(res_partner, self).write(cr, uid, ids, vals, context) |
691 | + for id in ids: |
692 | + # Update one by one |
693 | + partner = self.browse(cr, uid, [id])[0] |
694 | + # Customer account number |
695 | + default_receivable_account = self._get_account_model(cr, uid, 'property_account_receivable') |
696 | + if default_receivable_account and partner.customer and (partner.property_account_receivable.id == default_receivable_account.id): |
697 | + account_patern = self._get_customer_account_model(cr, uid) |
698 | + account_code = self._get_compute_account_number(cr, uid, partner, self._get_customer_account_sequence(cr, uid) ) |
699 | + account_patern['name'] = str( _('Customer : ') + partner.name.encode("utf-8"))[:128] #becarefull on translat° & length |
700 | + account_patern['code'] = account_code |
701 | + customer_account_id = self.pool.get('account.account').create(cr, uid, account_patern) |
702 | + super(res_partner, self).write(cr, uid, id, {'property_account_receivable': customer_account_id} ) |
703 | + # Supplier account number |
704 | + default_payable_account = self._get_account_model(cr, uid, 'property_account_payable') |
705 | + if default_payable_account and partner.supplier and (partner.property_account_payable.id == default_payable_account.id): |
706 | + account_patern = self._get_supplier_account_model(cr, uid) |
707 | + account_code = self._get_compute_account_number(cr, uid, partner, self._get_supplier_account_sequence(cr, uid) ) |
708 | + account_patern['name'] = str( _('Supplier : ') + partner.name.encode("utf-8"))[:128] #becarefull on translat° & length |
709 | + account_patern['code'] = account_code |
710 | + supplier_account_id = self.pool.get('account.account').create(cr, uid, account_patern) |
711 | + super(res_partner, self).write(cr, uid, id, {'property_account_payable': supplier_account_id} ) |
712 | + |
713 | + return osv_stuff |
714 | + |
715 | +res_partner() |
716 | + |
717 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
718 | |
719 | === added directory 'account_3rd_party_generat/wizard' |
720 | === added file 'account_3rd_party_generat/wizard/__init__.py' |
721 | --- account_3rd_party_generat/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
722 | +++ account_3rd_party_generat/wizard/__init__.py 2012-07-09 12:36:28 +0000 |
723 | @@ -0,0 +1,31 @@ |
724 | +# -*- coding: utf-8 -*- |
725 | +############################################################################## |
726 | +# |
727 | +# Copyright (c) 2008 SISTHEO |
728 | +# |
729 | +# WARNING: This program as such is intended to be used by professional |
730 | +# programmers who take the whole responsability of assessing all potential |
731 | +# consequences resulting from its eventual inadequacies and bugs |
732 | +# End users who are looking for a ready-to-use solution with commercial |
733 | +# garantees and support are strongly adviced to contract a Free Software |
734 | +# Service Company |
735 | +# |
736 | +# This program is Free Software; you can redistribute it and/or |
737 | +# modify it under the terms of the GNU General Public License |
738 | +# as published by the Free Software Foundation; either version 2 |
739 | +# of the License, or (at your option) any later version. |
740 | +# |
741 | +# This program is distributed in the hope that it will be useful, |
742 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
743 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
744 | +# GNU General Public License for more details. |
745 | +# |
746 | +# You should have received a copy of the GNU General Public License |
747 | +# along with this program; if not, write to the Free Software |
748 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
749 | +# |
750 | +############################################################################## |
751 | + |
752 | +import install_wizard |
753 | + |
754 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
755 | |
756 | === added file 'account_3rd_party_generat/wizard/install_wizard.py' |
757 | --- account_3rd_party_generat/wizard/install_wizard.py 1970-01-01 00:00:00 +0000 |
758 | +++ account_3rd_party_generat/wizard/install_wizard.py 2012-07-09 12:36:28 +0000 |
759 | @@ -0,0 +1,121 @@ |
760 | +# -*- coding: utf-8 -*- |
761 | + |
762 | +############################################################################## |
763 | +# |
764 | +# OpenERP, Open Source Management Solution |
765 | +# Copyright (C) 2009 SISTHEO |
766 | +# |
767 | +# This program is free software: you can redistribute it and/or modify |
768 | +# it under the terms of the GNU General Public License as published by |
769 | +# the Free Software Foundation, either version 3 of the License, or |
770 | +# (at your option) any later version. |
771 | +# |
772 | +# This program is distributed in the hope that it will be useful, |
773 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
774 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
775 | +# GNU General Public License for more details. |
776 | +# |
777 | +# You should have received a copy of the GNU General Public License |
778 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
779 | +# |
780 | +############################################################################## |
781 | +# AIM : |
782 | +# install module / create defaults parameters |
783 | +# |
784 | +############################################################################## |
785 | +# Date Author Description |
786 | +# 20090713 SYLEAM/CB update default 3rd part account numbers |
787 | +# |
788 | +############################################################################## |
789 | +# TECHNICAL DETAILS : |
790 | +############################################################################## |
791 | +from osv import fields,osv,orm |
792 | +import tools #for translations |
793 | +import types |
794 | + |
795 | + |
796 | +class wizard_install_third_part_accounts(osv.osv_memory): |
797 | + """ |
798 | + """ |
799 | + _name='wizard.install.third.part.accounts' |
800 | + |
801 | + _columns = { |
802 | + 'company_id': fields.many2one('res.company', 'Company', required=True), |
803 | +# 'code_digits': fields.integer('# of Digits',required=True,help="No. of Digits to use for account code"), |
804 | +# 'seq_journal': fields.boolean('Separated Journal Sequences',help="Check this box if you want to use a different sequence for each created journal. Otherwise, all will use the same sequence."), |
805 | + 'receivable_id': fields.many2one('account.account', 'Account receivable', domain="[('type', '=', 'view')]", required=True), #,('user_type','=','receivable') |
806 | + 'payable_id': fields.many2one('account.account', 'Account payable', domain="[('type', '=', 'view')]", required=True), |
807 | + } |
808 | + |
809 | + |
810 | + def _default_account_id(self, cr, uid, account_type, context={}): |
811 | + account_type_id = self.pool.get('account.account.type').search(cr, uid, [('code','=',account_type)]) #, context |
812 | + srch_args = [('type', '=', 'view'),('user_type','in',account_type_id)] |
813 | + account_id = self.pool.get('account.account').search(cr, uid, srch_args) #[0] #, limit=1, order='code') |
814 | + if account_id: |
815 | + if type(account_id) is types.IntType: |
816 | + return account_id |
817 | + elif type(account_id) is types.ListType: |
818 | + return account_id[0] |
819 | + return False |
820 | + |
821 | + def _default_receivable_id(self, cr, uid, context={}): |
822 | + receivable_id = self._default_account_id(cr, uid,'receivable', context) |
823 | + return receivable_id |
824 | + |
825 | + def _default_payable_id(self, cr, uid, context={}): |
826 | + payable_id = self._default_account_id(cr, uid, 'payable', context) |
827 | + return payable_id |
828 | + |
829 | + |
830 | + _defaults = { |
831 | + 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr,uid,[uid],c)[0].company_id.id, |
832 | +# 'code_digits': lambda *a:6, |
833 | + 'receivable_id': _default_receivable_id, |
834 | + 'payable_id': _default_payable_id, |
835 | + } |
836 | + |
837 | + |
838 | + def action_start_install(self, cr, uid, ids, context=None): |
839 | + """ Create the properties : specify default account (payable and receivable) for partners |
840 | + """ |
841 | + wiz_data = self.browse(cr,uid,ids[0]) |
842 | + todo_list = [ |
843 | + ('property_account_receivable','res.partner','account.account', wiz_data.receivable_id.id), |
844 | + ('property_account_payable','res.partner','account.account', wiz_data.payable_id.id), |
845 | + ] |
846 | + property_obj = self.pool.get('ir.property') |
847 | + fields_obj = self.pool.get('ir.model.fields') |
848 | + for record in todo_list: |
849 | + r = property_obj.search(cr, uid, [('name','=', record[0] ),('company_id','=',wiz_data.company_id.id)]) |
850 | + if r: #the property exist: modify it |
851 | + vals = { |
852 | + 'value': record[3] and 'account.account,'+str(record[3]) or False, |
853 | + } |
854 | + property_obj.write(cr, uid, r, vals) |
855 | + else: #create the property |
856 | + field = fields_obj.search(cr, uid, [('name','=',record[0]),('model','=',record[1]),('relation','=',record[2])]) |
857 | + vals = { |
858 | + 'name': record[0], |
859 | + 'company_id': wiz_data.company_id.id, |
860 | + 'fields_id': field[0], |
861 | + 'value': record[3] and 'account.account,'+str(record[3]) or False, |
862 | + } |
863 | + property_obj.create(cr, uid, vals) |
864 | + next_action = { |
865 | + 'type': 'ir.actions.act_window', |
866 | + 'res_model': 'ir.actions.configuration.wizard', |
867 | + 'view_type': 'form', |
868 | + 'view_mode': 'form', |
869 | + 'target':'new', |
870 | + } |
871 | + return next_action |
872 | + |
873 | + |
874 | + def action_cancel(self,cr,uid,ids,conect=None): |
875 | + return {'type':'ir.actions.act_window_close' } |
876 | + |
877 | +wizard_install_third_part_accounts() |
878 | + |
879 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
880 | + |
881 | |
882 | === added file 'account_3rd_party_generat/wizard/install_wizard.xml' |
883 | --- account_3rd_party_generat/wizard/install_wizard.xml 1970-01-01 00:00:00 +0000 |
884 | +++ account_3rd_party_generat/wizard/install_wizard.xml 2012-07-09 12:36:28 +0000 |
885 | @@ -0,0 +1,46 @@ |
886 | +<?xml version="1.0" encoding="utf-8"?> |
887 | +<openerp> |
888 | + <data noupdate="0"> |
889 | + |
890 | +<!-- configuration wizard view --> |
891 | + <record model="ir.ui.view" id="view_wizard_third_part_account_form"> |
892 | + <field name="name">Configure Accounts Generation</field> |
893 | + <field name="model">wizard.install.third.part.accounts</field> |
894 | + <field name="type">form</field> |
895 | + <field name="arch" type="xml"> |
896 | + <form string="Accounts Generate"> |
897 | + <!-- separator col="4" colspan="4" string="Generate Chart of Accounts from a Chart Template"/ --> |
898 | + <!--label align="0.0" colspan="4" string="This will automatically configure your chart of accounts, bank accounts, taxes and journals according to the selected template"/--> |
899 | + <field name="company_id" /> |
900 | + <!-- field name ="code_digits" / --> |
901 | + <separator string="Account number" colspan="4"/> |
902 | + <field name="receivable_id" /> |
903 | + <field name="payable_id" /> |
904 | + <separator string="" colspan="4"/> |
905 | + <label string="" colspan="2"/> |
906 | + <group col="2" colspan="2"> |
907 | + <button icon="gtk-cancel" special="cancel" type="object" name="action_cancel" string="Cancel"/> |
908 | + <button icon="gtk-ok" name="action_start_install" string="Update" type="object"/> |
909 | + </group> |
910 | + </form> |
911 | + </field> |
912 | + </record> |
913 | + |
914 | + <record model="ir.actions.act_window" id="action_third_part_account"> |
915 | + <field name="name">Configure third party account rules</field> |
916 | + <field name="type">ir.actions.act_window</field> |
917 | + <field name="res_model">wizard.install.third.part.accounts</field> |
918 | + <field name="view_type">form</field> |
919 | + <field name="view_mode">form</field> |
920 | + <field name="target">new</field> |
921 | + </record> |
922 | + |
923 | +<!-- register configuration wizard --> |
924 | + <record model="ir.actions.todo" id="config_third_part_account"> |
925 | + <field name="name">Account 3rd part Configure Wizard</field> |
926 | + <field name="note">Configure third party account rules</field> |
927 | + <field name="action_id" ref="action_third_part_account"/> |
928 | + </record> |
929 | + |
930 | + </data> |
931 | +</openerp> |
932 | |
933 | === added directory 'account_bank_deposit_slip' |
934 | === added file 'account_bank_deposit_slip/__init__.py' |
935 | --- account_bank_deposit_slip/__init__.py 1970-01-01 00:00:00 +0000 |
936 | +++ account_bank_deposit_slip/__init__.py 2012-07-09 12:36:28 +0000 |
937 | @@ -0,0 +1,26 @@ |
938 | +# -*- coding: utf-8 -*- |
939 | + |
940 | +############################################################################## |
941 | +# |
942 | +# OpenERP, Open Source Management Solution |
943 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
944 | +# All Rights Reserved |
945 | +# |
946 | +# This program is free software: you can redistribute it and/or modify |
947 | +# it under the terms of the GNU General Public License as published by |
948 | +# the Free Software Foundation, either version 3 of the License, or |
949 | +# (at your option) any later version. |
950 | +# |
951 | +# This program is distributed in the hope that it will be useful, |
952 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
953 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
954 | +# GNU General Public License for more details. |
955 | +# |
956 | +# You should have received a copy of the GNU General Public License |
957 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
958 | +# |
959 | +############################################################################## |
960 | + |
961 | +import report |
962 | +import object |
963 | + |
964 | |
965 | === added file 'account_bank_deposit_slip/__terp__.py' |
966 | --- account_bank_deposit_slip/__terp__.py 1970-01-01 00:00:00 +0000 |
967 | +++ account_bank_deposit_slip/__terp__.py 2012-07-09 12:36:28 +0000 |
968 | @@ -0,0 +1,72 @@ |
969 | +# -*- coding: utf-8 -*- |
970 | + |
971 | +############################################################################## |
972 | +# |
973 | +# OpenERP, Open Source Management Solution |
974 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
975 | +# All Rights Reserved |
976 | +# $Id$ |
977 | +# |
978 | +# This program is free software: you can redistribute it and/or modify |
979 | +# it under the terms of the GNU General Public License as published by |
980 | +# the Free Software Foundation, either version 3 of the License, or |
981 | +# (at your option) any later version. |
982 | +# |
983 | +# This program is distributed in the hope that it will be useful, |
984 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
985 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
986 | +# GNU General Public License for more details. |
987 | +# |
988 | +# You should have received a copy of the GNU General Public License |
989 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
990 | +# |
991 | +############################################################################## |
992 | +# AUTHOR : Claude Brulé for SYLEAM |
993 | +############################################################################## |
994 | +# TODO : |
995 | +# Create report with number and content |
996 | +# translate ; create po file |
997 | +############################################################################## |
998 | + |
999 | +{ |
1000 | + "name" : "Bank deposit slips", |
1001 | + "version" : "0.1.0", |
1002 | + "author" : "Syleam", |
1003 | + "website" : "http://www.syleam.fr", |
1004 | + "category" : "Generic Modules/Accounting", |
1005 | + "description": """ |
1006 | +Manage account move from a (internal) journal of payments to a bank journal. |
1007 | +It alow user to select (source) moves and destintion journal. It give a number to the slip. |
1008 | + |
1009 | + |
1010 | + OpenERP version : 5.0 |
1011 | + Creation : 2009-07-27 |
1012 | + Last update : 2009-07-27 |
1013 | + |
1014 | +CAUTION : |
1015 | + THIS MODULE IS STILL UNDER DEVELOPMENT !! |
1016 | + |
1017 | +SEE ALSO : |
1018 | + List of modules witch should be used |
1019 | +""", |
1020 | + "depends" : [ "base", |
1021 | + "account", |
1022 | + "account_move", |
1023 | +### "account_payment", |
1024 | + ], |
1025 | + "init_xml" : [ |
1026 | + "view/bank_deposit_view.xml", |
1027 | + "data/sequence.xml", |
1028 | +# "report.xml", |
1029 | +# "wizard.xml", |
1030 | + "view/menu.xml", |
1031 | + ], |
1032 | + "update_xml" : [ |
1033 | + ], |
1034 | + "demo_xml" : [], |
1035 | + "active": False, |
1036 | + "installable": True, |
1037 | +# "certificate": False, |
1038 | +} |
1039 | + |
1040 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1041 | |
1042 | === added directory 'account_bank_deposit_slip/data' |
1043 | === added file 'account_bank_deposit_slip/data/sequence.xml' |
1044 | --- account_bank_deposit_slip/data/sequence.xml 1970-01-01 00:00:00 +0000 |
1045 | +++ account_bank_deposit_slip/data/sequence.xml 2012-07-09 12:36:28 +0000 |
1046 | @@ -0,0 +1,27 @@ |
1047 | +<?xml version="1.0" encoding="utf-8"?> |
1048 | +<openerp> |
1049 | + <data noupdate="1"> |
1050 | + |
1051 | +<!-- |
1052 | + Sequences types for statments |
1053 | +--> |
1054 | + <record id="seq_type_account_statement" model="ir.sequence.type"> |
1055 | + <field name="name">Accounting statement</field> |
1056 | + <field name="code">account.bank.slip</field> |
1057 | + </record> |
1058 | + |
1059 | +<!-- |
1060 | + Sequences for bank slip |
1061 | +--> |
1062 | + <record id="seq_account_bank_slip" model="ir.sequence"> |
1063 | + <field name="name">Bank deposit slip</field> |
1064 | + <field name="code">account.bank.slip</field> |
1065 | + <field name="prefix">%(year)s-%(month)s-</field> |
1066 | + <field name="number_next" eval="1"/> |
1067 | + <field name="number_increment" eval="1"/> |
1068 | + <field name="padding" eval="3"/> |
1069 | + <!-- field name="suffix"></field --> |
1070 | + </record> |
1071 | + |
1072 | + </data> |
1073 | +</openerp> |
1074 | |
1075 | === added directory 'account_bank_deposit_slip/object' |
1076 | === added file 'account_bank_deposit_slip/object/__init__.py' |
1077 | --- account_bank_deposit_slip/object/__init__.py 1970-01-01 00:00:00 +0000 |
1078 | +++ account_bank_deposit_slip/object/__init__.py 2012-07-09 12:36:28 +0000 |
1079 | @@ -0,0 +1,26 @@ |
1080 | +# -*- coding: utf-8 -*- |
1081 | + |
1082 | +############################################################################## |
1083 | +# |
1084 | +# OpenERP, Open Source Management Solution |
1085 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1086 | +# All Rights Reserved |
1087 | +# |
1088 | +# This program is free software: you can redistribute it and/or modify |
1089 | +# it under the terms of the GNU General Public License as published by |
1090 | +# the Free Software Foundation, either version 3 of the License, or |
1091 | +# (at your option) any later version. |
1092 | +# |
1093 | +# This program is distributed in the hope that it will be useful, |
1094 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1095 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1096 | +# GNU General Public License for more details. |
1097 | +# |
1098 | +# You should have received a copy of the GNU General Public License |
1099 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1100 | +# |
1101 | +############################################################################## |
1102 | + |
1103 | +import report |
1104 | +# python files |
1105 | +import account_bank_deposit_slip |
1106 | |
1107 | === added file 'account_bank_deposit_slip/object/account_bank_deposit_slip.py' |
1108 | --- account_bank_deposit_slip/object/account_bank_deposit_slip.py 1970-01-01 00:00:00 +0000 |
1109 | +++ account_bank_deposit_slip/object/account_bank_deposit_slip.py 2012-07-09 12:36:28 +0000 |
1110 | @@ -0,0 +1,195 @@ |
1111 | +# -*- coding: utf-8 -*- |
1112 | + |
1113 | +############################################################################## |
1114 | +# |
1115 | +# OpenERP, Open Source Management Solution |
1116 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1117 | +# All Rights Reserved |
1118 | +# |
1119 | +# This program is free software: you can redistribute it and/or modify |
1120 | +# it under the terms of the GNU General Public License as published by |
1121 | +# the Free Software Foundation, either version 3 of the License, or |
1122 | +# (at your option) any later version. |
1123 | +# |
1124 | +# This program is distributed in the hope that it will be useful, |
1125 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1126 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1127 | +# GNU General Public License for more details. |
1128 | +# |
1129 | +# You should have received a copy of the GNU General Public License |
1130 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1131 | +# |
1132 | +############################################################################## |
1133 | +# AIM : |
1134 | +# Bank deposit slips / Statement for cash and cheque depositing |
1135 | +# |
1136 | +############################################################################## |
1137 | +# Date Author Description |
1138 | +# 20090727 SYLEAM/CB bank deposit slip : transfert move lines |
1139 | +# |
1140 | +############################################################################## |
1141 | +# FUNCTIONAL DETAILS : |
1142 | +# One account journal per IBAN |
1143 | +# |
1144 | +############################################################################## |
1145 | +# TECHNICAL DETAILS : |
1146 | +# |
1147 | +############################################################################## |
1148 | +# RELATED FILES : |
1149 | +# Liste of file needed example : xml link to py |
1150 | +# |
1151 | +############################################################################## |
1152 | +# CONTENT : |
1153 | +# account.bank.deposit |
1154 | +############################################################################## |
1155 | + |
1156 | + |
1157 | +__author__ = "Claude Brulé (claude.brule@syleam.fr)" |
1158 | +__version__ = "$Revision: 0.2 $" |
1159 | +__date__ = "$Date: 2009/07/27 $" |
1160 | +__copyright__ = "Copyright (c) 2009 Syleam" |
1161 | +__license__ = "GPL v2" |
1162 | + |
1163 | + |
1164 | +from osv import fields, osv |
1165 | +from osv import orm |
1166 | +import time |
1167 | + |
1168 | + |
1169 | +class account_bank_deposit(osv.osv): |
1170 | + |
1171 | + _name = "account.bank.deposit" |
1172 | + _description = "Bank deposit slip" |
1173 | + |
1174 | + |
1175 | + _columns = { |
1176 | + 'name': fields.char('Name', size=64, required=True), |
1177 | + 'partner_id': fields.many2one('res.partner', 'Bank', required=True, readonly=True, states={'draft':[('readonly',False)]} ), #domain=[('supplier', '=', True)], cf XML |
1178 | + 'accounting_date': fields.date('Date', required=True, readonly=True, states={'draft':[('readonly',False)]}), |
1179 | + 'dest_journal_id': fields.many2one('account.journal', 'To journal', required=True, readonly=True, states={'draft':[('readonly',False)]}, domain=[('type', 'in', ('cash', 'payment'))] ), |
1180 | + 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)]}), |
1181 | + 'src_journal_id': fields.many2one('account.journal', 'From journal', required=True, readonly=True, states={'draft':[('readonly',False)]} ), #domain=[('type', 'in', ('cash', 'payment'))], |
1182 | + 'move_line_ids': fields.many2many('account.move.line', 'rel_bank_move', 'move_line_id', 'bank_deposit_id', 'Payments', domain=[('state','in',('draft','post'))], |
1183 | + required=True, readonly=True, states={'draft':[('readonly',False)]}), |
1184 | + 'move_id': fields.many2one('account.move', 'Move entry generated', readonly=True), |
1185 | + 'state': fields.selection([('draft', 'Draft'),('confirm', 'Confirm'),('cancel', 'Cancel')],'State', required=True, readonly=True ), |
1186 | + # Everything is required/mandatory, writable only in draft state |
1187 | + } |
1188 | + |
1189 | + |
1190 | + def _default_sequence(self, cr, uid, context={}): |
1191 | + defval = self.pool.get('ir.sequence').get(cr, uid, 'account.bank.slip') |
1192 | +# print "DEBUG: factor.statement::default_sequence = %r" % defval |
1193 | + return defval |
1194 | + |
1195 | + |
1196 | + def _default_journal_id(self, cr, uid, context={}): |
1197 | + return context.get('journal_id', False) |
1198 | + |
1199 | + |
1200 | + def _get_period(self, cr, uid, context={}): |
1201 | + periods = self.pool.get('account.period').find(cr, uid) |
1202 | + if periods: |
1203 | + return periods[0] |
1204 | + else: |
1205 | + return False |
1206 | + |
1207 | + def _get_company_currency(self, cr, uid, ids, field_name, arg, context={}): |
1208 | + result = {} |
1209 | + return result |
1210 | + |
1211 | + _defaults = { |
1212 | + 'name': _default_sequence, |
1213 | + 'accounting_date': lambda *a: time.strftime('%Y-%m-%d'), |
1214 | + 'period_id': _get_period, |
1215 | + 'state': lambda *a: 'draft', |
1216 | + } |
1217 | + |
1218 | + _order = 'id DESC' |
1219 | + |
1220 | + _sql_constraints = [ |
1221 | + ('name_uniq', 'unique (name)', 'The name of the factor statement must be unique !'), |
1222 | + ] |
1223 | + |
1224 | + |
1225 | + |
1226 | +# ######################################################### |
1227 | +# O V E R L O A D O S V |
1228 | +# ######################################################### |
1229 | + def unlink(self, cr, uid, ids, context=None): |
1230 | + """Unlink is possible ONLY in draft state otherwise we keep track of it |
1231 | + """ |
1232 | + actual_states = self.read(cr, uid, ids, ['state'], context=context) |
1233 | + for s in actual_states: |
1234 | + #print "DEBUG unlink:: S : %r" % s |
1235 | + if s['state'] != 'draft': |
1236 | + raise osv.except_osv(_('Error !'), _("You can not delete a %s entry !\nYou have to cancel it.") % ['state']) |
1237 | + osv_stuff = super(factor_statement, self).unlink(cr, uid, ids, context=context) |
1238 | + return osv_stuff |
1239 | + |
1240 | + |
1241 | +# def copy(self, cr, uid, id, default=None, context=None): |
1242 | +# raise osv.except_osv(_('Impossible !'), _("You can not copy a factor statement!\nYou have to create a new one.") ) |
1243 | + |
1244 | + |
1245 | +# ######################################################### |
1246 | +# A C T I O N S T U F F |
1247 | +# ######################################################### |
1248 | + def action_move_create(self, cr, uid, deposit_id, context={}): |
1249 | + """ Create account moves corresponding to selected lines. |
1250 | + This function do NOT reconcile move.line (nto supposed to happend on account having internal_type=Cash |
1251 | + @param fs_id: (id/int) ONE factor statement |
1252 | + """ |
1253 | +# if len(fs_id) > 1: |
1254 | +# return False |
1255 | + line_ids = [] |
1256 | + bank_deposit_obj = self.browse(cr, uid, deposit_id, context) |
1257 | + for ml in bank_deposit_obj.move_line_ids: |
1258 | + line_ids.append(ml.id) |
1259 | +# print "DEBUG: account_bank_deposit::action_move_create > %r" % line_ids |
1260 | + move = self.pool.get('account.move.line').transfert(cr, uid, line_ids, bank_deposit_obj.accounting_date, bank_deposit_obj.name, |
1261 | + bank_deposit_obj.dest_journal_id.id, bank_deposit_obj.period_id.id, |
1262 | + debit_account_id=bank_deposit_obj.dest_journal_id.default_debit_account_id.id, context=context) |
1263 | +### credit_account_id=bank_deposit_obj.dest_journal_id.default_credit_account_id.id, context=context) |
1264 | + return move |
1265 | + |
1266 | + |
1267 | +# ######################################################### |
1268 | +# W O R K F L O W S T U F F |
1269 | +# ######################################################### |
1270 | + def button_cancel(self, cr, uid, ids, context={}): |
1271 | + """Canceling statement, means unlink or revert account.move.lines (this can not be done easily) |
1272 | + 1st step : unreconcile entries |
1273 | + 2nd step : unlink IF alowed in journal configuration |
1274 | + """ |
1275 | + for fs in self.browse(cr, uid, ids, context): # Let try to delete the move |
1276 | + if fs.move_id: |
1277 | +# print "DEBUG ::button_cancel > %r" % fs.move_id.id |
1278 | + self.pool.get('account.move').unlink(cr, uid, [fs.move_id.id], context=context) |
1279 | + self.write(cr, uid, fs.id, {'state': 'cancel', 'move_id':False}, context) |
1280 | + return True |
1281 | + |
1282 | + |
1283 | + def button_reset_draft(self, cr, uid, ids, context={}): |
1284 | + for fs in self.browse(cr, uid, ids, context): |
1285 | + if fs.state == 'cancel': |
1286 | + self.write(cr, uid, ids, {'state': 'draft'}, context) |
1287 | + return True |
1288 | + |
1289 | + |
1290 | + def button_confirm(self, cr, uid, ids, context={}): |
1291 | + """Lock statement and write moves. |
1292 | + |
1293 | + @param ids: many statements |
1294 | + """ |
1295 | + for deposit_id in ids: |
1296 | + move_id = self.action_move_create(cr, uid, deposit_id, context) |
1297 | + self.write(cr, uid, deposit_id, {'state': 'confirm', 'move_id':move_id}, context) |
1298 | + #AT this point Entry is NOT posted |
1299 | + return True |
1300 | + |
1301 | +account_bank_deposit() |
1302 | + |
1303 | + |
1304 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1305 | + |
1306 | |
1307 | === added directory 'account_bank_deposit_slip/report' |
1308 | === added file 'account_bank_deposit_slip/report/__init__.py' |
1309 | --- account_bank_deposit_slip/report/__init__.py 1970-01-01 00:00:00 +0000 |
1310 | +++ account_bank_deposit_slip/report/__init__.py 2012-07-09 12:36:28 +0000 |
1311 | @@ -0,0 +1,23 @@ |
1312 | +# -*- coding: utf-8 -*- |
1313 | + |
1314 | +############################################################################## |
1315 | +# |
1316 | +# OpenERP, Open Source Management Solution |
1317 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1318 | +# All Rights Reserved |
1319 | +# |
1320 | +# This program is free software: you can redistribute it and/or modify |
1321 | +# it under the terms of the GNU General Public License as published by |
1322 | +# the Free Software Foundation, either version 3 of the License, or |
1323 | +# (at your option) any later version. |
1324 | +# |
1325 | +# This program is distributed in the hope that it will be useful, |
1326 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1327 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1328 | +# GNU General Public License for more details. |
1329 | +# |
1330 | +# You should have received a copy of the GNU General Public License |
1331 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1332 | +# |
1333 | +############################################################################## |
1334 | + |
1335 | |
1336 | === added directory 'account_bank_deposit_slip/view' |
1337 | === added file 'account_bank_deposit_slip/view/bank_deposit_view.xml' |
1338 | --- account_bank_deposit_slip/view/bank_deposit_view.xml 1970-01-01 00:00:00 +0000 |
1339 | +++ account_bank_deposit_slip/view/bank_deposit_view.xml 2012-07-09 12:36:28 +0000 |
1340 | @@ -0,0 +1,55 @@ |
1341 | +<?xml version="1.0" encoding="utf-8"?> |
1342 | +<openerp> |
1343 | + <data noupdate="0"> |
1344 | + |
1345 | +<!-- |
1346 | + Factoring statement (factor.statement) |
1347 | +--> |
1348 | + |
1349 | +<!-- List --> |
1350 | + <record model="ir.ui.view" id="view_account_bank_deposit_list"> |
1351 | + <field name="name">Bank deposit slip</field> |
1352 | + <field name="model">account.bank.deposit</field> |
1353 | + <field name="type">tree</field> |
1354 | + <field name="arch" type="xml"> |
1355 | + <tree colors="blue:state=='draft'; grey:state=='cancel'" string="Bank deposit slip"> |
1356 | + <field name="accounting_date"/> |
1357 | + <field name="name"/> |
1358 | + <field name="src_journal_id"/> |
1359 | + <field name="partner_id"/> |
1360 | + <field name="period_id"/> |
1361 | + <field name="dest_journal_id"/> |
1362 | + <field name="state"/> |
1363 | + </tree> |
1364 | + </field> |
1365 | + </record> |
1366 | + |
1367 | +<!-- Form --> |
1368 | + <record model="ir.ui.view" id="view_account_bank_deposit_form"> |
1369 | + <field name="name">Bank deposit slip</field> |
1370 | + <field name="model">account.bank.deposit</field> |
1371 | + <field name="type">form</field> |
1372 | + <field name="arch" type="xml"> |
1373 | + <form string="Factoring statement - Form"> |
1374 | + <group colspan="4" col="6"> |
1375 | + <field name="name"/> |
1376 | + <field name="partner_id" domain="[('supplier','=', 1)]"/> |
1377 | + <field name="dest_journal_id" domain="[('type','in', ['cash'])]"/> <!-- payment DOES NOT EXIST --> |
1378 | + <field name="accounting_date"/> |
1379 | + <field name="period_id"/> |
1380 | + <field name="src_journal_id" domain="[('type','in', ['cash'])]"/> <!-- Tuple doesn't work --> |
1381 | + </group> |
1382 | + <field name="move_line_ids" nolabel="1" colspan="4" domain="[('journal_id','=', src_journal_id),('account_id.type','in',('other', 'closed')),('move_id.state','=','posted')]"/> |
1383 | + <group colspan="4" col="6"> |
1384 | + <field name="move_id" nolabel="0"/> |
1385 | + <field name="state" readonly="1"/> |
1386 | + <button type="object" name="button_confirm" states="draft" string="Confirm"/> |
1387 | + <button type="object" name="button_cancel" states="confirm" string="Cancel"/> |
1388 | + <button type="object" name="button_reset_draft" states="cancel" string="Reset to draft"/> |
1389 | + </group> |
1390 | + </form> |
1391 | + </field> |
1392 | + </record> |
1393 | + |
1394 | + </data> |
1395 | +</openerp> |
1396 | |
1397 | === added file 'account_bank_deposit_slip/view/menu.xml' |
1398 | --- account_bank_deposit_slip/view/menu.xml 1970-01-01 00:00:00 +0000 |
1399 | +++ account_bank_deposit_slip/view/menu.xml 2012-07-09 12:36:28 +0000 |
1400 | @@ -0,0 +1,32 @@ |
1401 | +<?xml version="1.0" encoding="utf-8"?> |
1402 | +<openerp> |
1403 | + <data noupdate="0"> |
1404 | + |
1405 | +<!-- |
1406 | + Factoring statement (factor.statement) |
1407 | +--> |
1408 | + <menuitem id="menu_account_bank_deposit" parent="account.menu_finance" name="Bank deposit slip" sequence="50"/> |
1409 | + |
1410 | +<!-- New Factoring --> |
1411 | + <record model="ir.actions.act_window" id="act_account_bank_deposit_new"> |
1412 | + <field name="name">New Bank deposit slip</field> |
1413 | + <field name="res_model">account.bank.deposit</field> |
1414 | + <field name="view_type">form</field> |
1415 | + <field name="view_mode">form</field> |
1416 | + <field name="view_id" ref="view_account_bank_deposit_form"/> |
1417 | + <!-- field name="context" eval="{'default_journal_id':ref('factoring_journal')}"/ --> |
1418 | + </record> |
1419 | + <menuitem id="menu_account_bank_deposit_new" action="act_account_bank_deposit_new" parent="menu_account_bank_deposit" sequence="10"/> |
1420 | + |
1421 | +<!-- All Factoring statement --> |
1422 | + <record model="ir.actions.act_window" id="act_account_bank_deposit_all"> |
1423 | + <field name="name">All Bank deposit slip</field> |
1424 | + <field name="res_model">account.bank.deposit</field> |
1425 | + <field name="view_type">form</field> |
1426 | + <field name="view_mode">tree,form</field> |
1427 | + <field name="view_id" ref="view_account_bank_deposit_list"/> |
1428 | + </record> |
1429 | + <menuitem id="menu_account_bank_deposit_all" action="act_account_bank_deposit_all" parent="menu_account_bank_deposit" sequence="20"/> |
1430 | + |
1431 | + </data> |
1432 | +</openerp> |
1433 | |
1434 | === added directory 'account_invoice_merge' |
1435 | === added file 'account_invoice_merge/__init__.py' |
1436 | --- account_invoice_merge/__init__.py 1970-01-01 00:00:00 +0000 |
1437 | +++ account_invoice_merge/__init__.py 2012-07-09 12:36:28 +0000 |
1438 | @@ -0,0 +1,27 @@ |
1439 | +# -*- coding: utf-8 -*- |
1440 | + |
1441 | +############################################################################## |
1442 | +# |
1443 | +# OpenERP, Open Source Management Solution |
1444 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1445 | +# All Rights Reserved |
1446 | +# |
1447 | +# This program is free software: you can redistribute it and/or modify |
1448 | +# it under the terms of the GNU General Public License as published by |
1449 | +# the Free Software Foundation, either version 3 of the License, or |
1450 | +# (at your option) any later version. |
1451 | +# |
1452 | +# This program is distributed in the hope that it will be useful, |
1453 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1454 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1455 | +# GNU General Public License for more details. |
1456 | +# |
1457 | +# You should have received a copy of the GNU General Public License |
1458 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1459 | +# |
1460 | +############################################################################## |
1461 | + |
1462 | +import object |
1463 | +import wizard |
1464 | + |
1465 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1466 | |
1467 | === added file 'account_invoice_merge/__terp__.py' |
1468 | --- account_invoice_merge/__terp__.py 1970-01-01 00:00:00 +0000 |
1469 | +++ account_invoice_merge/__terp__.py 2012-07-09 12:36:28 +0000 |
1470 | @@ -0,0 +1,67 @@ |
1471 | +# -*- coding: utf-8 -*- |
1472 | + |
1473 | +############################################################################## |
1474 | +# |
1475 | +# OpenERP, Open Source Management Solution |
1476 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1477 | +# All Rights Reserved |
1478 | +# $Id$ |
1479 | +# |
1480 | +# This program is free software: you can redistribute it and/or modify |
1481 | +# it under the terms of the GNU General Public License as published by |
1482 | +# the Free Software Foundation, either version 3 of the License, or |
1483 | +# (at your option) any later version. |
1484 | +# |
1485 | +# This program is distributed in the hope that it will be useful, |
1486 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1487 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1488 | +# GNU General Public License for more details. |
1489 | +# |
1490 | +# You should have received a copy of the GNU General Public License |
1491 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1492 | +# |
1493 | +############################################################################## |
1494 | +# AUTHOR : Claude Brulé for SYLEAM |
1495 | +############################################################################## |
1496 | +# TODO : |
1497 | +# remove debug msg / validate what is done |
1498 | +# Option to not agregate lines of invoices |
1499 | +############################################################################## |
1500 | + |
1501 | +{ |
1502 | + "name" : "Account invoice merge", |
1503 | + "version" : "0.1.0", |
1504 | + "author" : "Syleam", |
1505 | + "website" : "http://www.syleam.fr", |
1506 | + "category" : "Generic Modules/Accounting", |
1507 | + "description": """ |
1508 | + >> THIS MODULE IS STILL UNDER DEVELOPMENT << |
1509 | + |
1510 | +Wizard to merge draft supplier invoices. |
1511 | + |
1512 | + |
1513 | + OpenERP version : 5.0 |
1514 | + Creation : 2009-09-30 |
1515 | + Last update : 2009-09-30 |
1516 | + |
1517 | +CAUTION : |
1518 | + THIS MODULE IS STILL UNDER DEVELOPMENT !! |
1519 | + |
1520 | +SEE ALSO : |
1521 | + List of modules witch should be used |
1522 | +""", |
1523 | + "depends" : [ "base", |
1524 | + "account", |
1525 | + ], |
1526 | + "init_xml" : [ |
1527 | + ], |
1528 | + "update_xml" : [ |
1529 | + "wizard/invoice_merge_view.xml", |
1530 | + ], |
1531 | + "demo_xml" : [], |
1532 | + "active": False, |
1533 | + "installable": True, |
1534 | +# "certificate": False, |
1535 | +} |
1536 | + |
1537 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1538 | |
1539 | === added directory 'account_invoice_merge/object' |
1540 | === added file 'account_invoice_merge/object/__init__.py' |
1541 | --- account_invoice_merge/object/__init__.py 1970-01-01 00:00:00 +0000 |
1542 | +++ account_invoice_merge/object/__init__.py 2012-07-09 12:36:28 +0000 |
1543 | @@ -0,0 +1,26 @@ |
1544 | +# -*- coding: utf-8 -*- |
1545 | + |
1546 | +############################################################################## |
1547 | +# |
1548 | +# OpenERP, Open Source Management Solution |
1549 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1550 | +# All Rights Reserved |
1551 | +# |
1552 | +# This program is free software: you can redistribute it and/or modify |
1553 | +# it under the terms of the GNU General Public License as published by |
1554 | +# the Free Software Foundation, either version 3 of the License, or |
1555 | +# (at your option) any later version. |
1556 | +# |
1557 | +# This program is distributed in the hope that it will be useful, |
1558 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1559 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1560 | +# GNU General Public License for more details. |
1561 | +# |
1562 | +# You should have received a copy of the GNU General Public License |
1563 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1564 | +# |
1565 | +############################################################################## |
1566 | + |
1567 | +import invoice |
1568 | + |
1569 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1570 | |
1571 | === added file 'account_invoice_merge/object/invoice.py' |
1572 | --- account_invoice_merge/object/invoice.py 1970-01-01 00:00:00 +0000 |
1573 | +++ account_invoice_merge/object/invoice.py 2012-07-09 12:36:28 +0000 |
1574 | @@ -0,0 +1,122 @@ |
1575 | +# -*- coding: utf-8 -*- |
1576 | + |
1577 | +############################################################################## |
1578 | +# |
1579 | +# OpenERP, Open Source Management Solution |
1580 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
1581 | +# $Id$ |
1582 | +# |
1583 | +# This program is free software: you can redistribute it and/or modify |
1584 | +# it under the terms of the GNU General Public License as published by |
1585 | +# the Free Software Foundation, either version 3 of the License, or |
1586 | +# (at your option) any later version. |
1587 | +# |
1588 | +# This program is distributed in the hope that it will be useful, |
1589 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1590 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1591 | +# GNU General Public License for more details. |
1592 | +# |
1593 | +# You should have received a copy of the GNU General Public License |
1594 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1595 | +# |
1596 | +############################################################################## |
1597 | + |
1598 | +from osv import fields, osv |
1599 | +#from tools.translate import _ |
1600 | + |
1601 | + |
1602 | +class account_invoice(osv.osv): |
1603 | + _inherit = "account.invoice" |
1604 | + |
1605 | +# _columns = { |
1606 | +# 'type': fields.selection([ |
1607 | +# ('out_invoice','Customer Invoice'), |
1608 | +# ('in_invoice','Supplier Invoice'), |
1609 | +# ('out_refund','Customer Refund'), |
1610 | +# ('in_refund','Supplier Refund'), |
1611 | +# ],'Type', readonly=True, select=True), |
1612 | +# 'state': fields.selection([ |
1613 | +# ('draft','Draft'), |
1614 | +# ('proforma','Pro-forma'), |
1615 | +# ('proforma2','Pro-forma'), |
1616 | +# ('open','Open'), |
1617 | +# ('paid','Done'), |
1618 | +# ('cancel','Cancelled') |
1619 | +# ],'State', select=True, readonly=True), |
1620 | +# } |
1621 | + |
1622 | + |
1623 | + def merge_invoice(self, cr, uid, ids, context=None): |
1624 | +# print "DEBUG: account_invoice_merge::merge_invoice() START" |
1625 | + """ Merge draft invoices. Work only with same partner |
1626 | + Moves all lines on the first invoice. |
1627 | + """ |
1628 | + if len(ids) <= 1: |
1629 | +# print "DEBUG: account_invoice_merge::merge_invoice() exit" |
1630 | + return False |
1631 | + # Check that all invoices are related/concerns only one partner |
1632 | + sql = "SELECT DISTINCT type, state, partner_id FROM account_invoice WHERE id IN (%s)" % ','.join(map(str, ids)) |
1633 | + cr.execute(sql) |
1634 | + if len(cr.fetchall()) != 1: |
1635 | + raise osv.except_osv(_('Invalid action !'), _('Can not merge invoice(s) on different partners or states !')) |
1636 | + # Merge invoices that are in draft state |
1637 | + merged_inv_id = 0 |
1638 | + inv_line_obj = self.pool.get('account.invoice.line') |
1639 | + |
1640 | + for inv in self.browse(cr, uid, ids, context): |
1641 | + if inv.state != 'draft': |
1642 | + raise osv.except_osv(_('Invalid action !'), _('Can not merge invoice(s) that are already opened or paid !')) |
1643 | + if merged_inv_id == 0: |
1644 | + merged_inv_id = inv.id |
1645 | +# print "DEBUG: account_invoice_merge::merge_invoice() > merged_inv_id = %r" % merged_inv_id |
1646 | + else: |
1647 | + # check if a line with the same product already exist. if so add quantity. else hang up invoice line to first invoice head. |
1648 | + line_ids = inv_line_obj.search(cr, uid, [('invoice_id','=',inv.id)]) |
1649 | +# print "DEBUG: account_invoice_merge::merge_invoice() > line_ids = %r" % line_ids |
1650 | + for inv_lin in inv_line_obj.browse(cr, uid, line_ids): |
1651 | + mrg_pdt_ids = inv_line_obj.search(cr, uid, [('invoice_id','=',merged_inv_id),('product_id','=',inv_lin.product_id.id)]) |
1652 | + if len(mrg_pdt_ids) == 1: # product found --> add quantity |
1653 | + qty = inv_line_obj._can_merge_quantity(cr, uid, mrg_pdt_ids[0], inv_lin.id) |
1654 | +# print "DEBUG: account_invoice_merge::merge_invoice() Write > qty = %r" % qty |
1655 | + if qty: |
1656 | + inv_line_obj.write(cr, uid, mrg_pdt_ids, {'quantity': qty}) |
1657 | + inv_line_obj.unlink(cr, uid, inv_lin.id) |
1658 | + else: |
1659 | + inv_line_obj.write(cr, uid, inv_lin.id, {'invoice_id': merged_inv_id}) |
1660 | + else: # transfert line to |
1661 | +# print "DEBUG: account_invoice_merge::merge_invoice() Transfert line" |
1662 | + inv_line_obj.write(cr, uid, inv_lin.id, {'invoice_id': merged_inv_id}) |
1663 | +# print "DEBUG: account_invoice_merge::merge_invoice() > DELETE invoice_id = %r" % inv.id |
1664 | + self.unlink(cr, uid, [inv.id]) |
1665 | + return merged_inv_id |
1666 | + |
1667 | +account_invoice() |
1668 | + |
1669 | + |
1670 | +class account_invoice_line(osv.osv): |
1671 | + _inherit = "account.invoice.line" |
1672 | + |
1673 | + def _can_merge_quantity(self, cr, uid, id1, id2, context=None): |
1674 | +# print "DEBUG: account_invoice_merge::can_merge_quantity() START" |
1675 | + qty = False |
1676 | + invl1 = self.browse(cr, uid, id1) |
1677 | +# print "DEBUG: account_invoice_merge::can_merge_quantity > invl_1 = %r" % invl1.invoice_line_tax_id |
1678 | +# print "DEBUG: account_invoice_merge::can_merge_quantity > invl_1 = %d, %f, %d, %d, %f, %f" % (invl1.product_id.id, invl1.price_unit, invl1.uos_id.id, invl1.account_id.id, invl1.discount, invl1.quantity) |
1679 | + invl2 = self.browse(cr, uid, id2) |
1680 | +# print "DEBUG: account_invoice_merge::can_merge_quantity > invl_2 = %r" % invl2.invoice_line_tax_id |
1681 | +# print "DEBUG: account_invoice_merge::can_merge_quantity > invl_2 = %d, %f, %d, %d, %f, %f" % (invl2.product_id.id, invl2.price_unit, invl2.uos_id.id, invl2.account_id.id, invl2.discount, invl2.quantity) |
1682 | + |
1683 | + if invl1.product_id.id == invl2.product_id.id \ |
1684 | + and invl1.price_unit == invl2.price_unit \ |
1685 | + and invl1.uos_id.id == invl2.uos_id.id \ |
1686 | + and invl1.account_id.id == invl2.account_id.id \ |
1687 | + and invl1.discount == invl2.discount: |
1688 | + qty = invl1.quantity + invl2.quantity |
1689 | +# print "DEBUG: account_invoice_merge::can_merge_quantity > MERGEABLE !" |
1690 | + return qty |
1691 | + |
1692 | +account_invoice_line() |
1693 | + |
1694 | + |
1695 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1696 | + |
1697 | |
1698 | === added directory 'account_invoice_merge/wizard' |
1699 | === added file 'account_invoice_merge/wizard/__init__.py' |
1700 | --- account_invoice_merge/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
1701 | +++ account_invoice_merge/wizard/__init__.py 2012-07-09 12:36:28 +0000 |
1702 | @@ -0,0 +1,26 @@ |
1703 | +# -*- coding: utf-8 -*- |
1704 | + |
1705 | +############################################################################## |
1706 | +# |
1707 | +# OpenERP, Open Source Management Solution |
1708 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1709 | +# All Rights Reserved |
1710 | +# |
1711 | +# This program is free software: you can redistribute it and/or modify |
1712 | +# it under the terms of the GNU General Public License as published by |
1713 | +# the Free Software Foundation, either version 3 of the License, or |
1714 | +# (at your option) any later version. |
1715 | +# |
1716 | +# This program is distributed in the hope that it will be useful, |
1717 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1718 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1719 | +# GNU General Public License for more details. |
1720 | +# |
1721 | +# You should have received a copy of the GNU General Public License |
1722 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1723 | +# |
1724 | +############################################################################## |
1725 | + |
1726 | +import merge_invoice |
1727 | + |
1728 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1729 | |
1730 | === added file 'account_invoice_merge/wizard/invoice_merge_view.xml' |
1731 | --- account_invoice_merge/wizard/invoice_merge_view.xml 1970-01-01 00:00:00 +0000 |
1732 | +++ account_invoice_merge/wizard/invoice_merge_view.xml 2012-07-09 12:36:28 +0000 |
1733 | @@ -0,0 +1,51 @@ |
1734 | +<?xml version="1.0" encoding="utf-8"?> |
1735 | +<openerp> |
1736 | + <data> |
1737 | + |
1738 | + <wizard |
1739 | + id="wizard_account_invoice_merge_invoice" |
1740 | + keyword="client_action_multi" |
1741 | + model="account.invoice" |
1742 | + name="account.invoice.merge_invoice" |
1743 | + multi="True" |
1744 | + string="Merge invoices"/> |
1745 | +<!-- |
1746 | + Wizard form |
1747 | +--> |
1748 | +<!-- |
1749 | + <record model="ir.ui.view" id="view_%(id)s_form"> |
1750 | + <field name="name">%(label)s</field> |
1751 | + <field name="model">%(name)s</field> |
1752 | + <field name="type">form</field> |
1753 | + <field name="arch" type="xml"> |
1754 | + <form string="%(label)s"> |
1755 | + <field name="name" colspan="4"/> |
1756 | + <button type="object" icon="gtk-cancel" name="action_cancel" string="Cancel"/> |
1757 | + <button type="object" icon="gtk-ok" name="action_start" string="%(label)s"/> |
1758 | + </form> |
1759 | + </field> |
1760 | + </record> |
1761 | +--> |
1762 | + |
1763 | +<!-- |
1764 | + Declaration |
1765 | +--> |
1766 | +<!-- |
1767 | + <record model="ir.actions.act_window" id="act_win_%(id)s"> |
1768 | + <field name="name">%(label)s</field> |
1769 | + <field name="res_model">%(name)s</field> |
1770 | + <field name="src_model">module.object</field> |
1771 | + <field name="type">ir.actions.act_window</field> |
1772 | + <field name="view_type">form</field> |
1773 | + <field name="view_mode">form</field> |
1774 | + <field name="target">new</field> |
1775 | + </record> |
1776 | +--> |
1777 | +<!-- |
1778 | + DO NOT USE : |
1779 | + <record model="ir.actions.wizard" id="OLD_MANER_DEPRECATED"> |
1780 | +--> |
1781 | + |
1782 | + |
1783 | + </data> |
1784 | +</openerp> |
1785 | |
1786 | === added file 'account_invoice_merge/wizard/merge_invoice.py' |
1787 | --- account_invoice_merge/wizard/merge_invoice.py 1970-01-01 00:00:00 +0000 |
1788 | +++ account_invoice_merge/wizard/merge_invoice.py 2012-07-09 12:36:28 +0000 |
1789 | @@ -0,0 +1,91 @@ |
1790 | +# -*- coding: utf-8 -*- |
1791 | + |
1792 | +############################################################################## |
1793 | +# |
1794 | +# OpenERP, Open Source Management Solution |
1795 | +# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
1796 | +# $Id$ |
1797 | +# |
1798 | +# This program is free software: you can redistribute it and/or modify |
1799 | +# it under the terms of the GNU General Public License as published by |
1800 | +# the Free Software Foundation, either version 3 of the License, or |
1801 | +# (at your option) any later version. |
1802 | +# |
1803 | +# This program is distributed in the hope that it will be useful, |
1804 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1805 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1806 | +# GNU General Public License for more details. |
1807 | +# |
1808 | +# You should have received a copy of the GNU General Public License |
1809 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1810 | +# |
1811 | +############################################################################## |
1812 | + |
1813 | +import wizard |
1814 | +import netsvc |
1815 | +import pooler |
1816 | + |
1817 | +invoice_form = """<?xml version="1.0"?> |
1818 | +<form string="Create invoices"> |
1819 | + <separator colspan="4" string="Do you really want to create the invoices ?" /> |
1820 | + <field name="grouped" /> |
1821 | +</form> |
1822 | +""" |
1823 | + |
1824 | +invoice_fields = { |
1825 | + 'grouped' : {'string':'Group the invoices', 'type':'boolean', 'default': lambda x,y,z: False} |
1826 | +} |
1827 | + |
1828 | +ack_form = """<?xml version="1.0"?> |
1829 | +<form string="Create invoices"> |
1830 | + <separator string="Invoices created" /> |
1831 | +</form>""" |
1832 | + |
1833 | +ack_fields = {} |
1834 | + |
1835 | + |
1836 | +class merge_invoice(wizard.interface): |
1837 | + |
1838 | + def _openForm(self, cr, uid, domain, context=None): |
1839 | + #return { |
1840 | + # 'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]", |
1841 | + # 'name': 'Invoices', |
1842 | + # 'view_type': 'form', |
1843 | + # 'view_mode': 'tree,form', |
1844 | + # 'res_model': 'account.invoice', |
1845 | + # 'view_id': False, |
1846 | + # 'context': "{'type':'out_refund'}", |
1847 | + # 'type': 'ir.actions.act_window' |
1848 | + # } |
1849 | + pool = pooler.get_pool(cr.dbname) |
1850 | + mod_obj = pool.get('ir.model.data') |
1851 | + act_obj = pool.get('ir.actions.act_window') |
1852 | + xml_id = 'action_invoice_tree' # Supplier invoire list |
1853 | + result = mod_obj._get_id(cr, uid, 'account', xml_id) |
1854 | + id = mod_obj.read(cr, uid, result, ['res_id'])['res_id'] |
1855 | + result = act_obj.read(cr, uid, id) |
1856 | + result['domain'] = domain |
1857 | + return result |
1858 | + #return {} |
1859 | + |
1860 | + |
1861 | + def _mergeInvoices(self, cr, uid, data, context): |
1862 | + inv_obj = pooler.get_pool(cr.dbname).get('account.invoice') |
1863 | +# print "DEBUG: account_invoice_merge / wizard::merge_invoice(%r)" % data |
1864 | + newinv = inv_obj.merge_invoice(cr, uid, data['ids'], context) |
1865 | + |
1866 | + return self._openForm(cr, uid, "[('id','in', [" + ','.join(map(str, [newinv])) + "])]") |
1867 | + |
1868 | + |
1869 | + states = { |
1870 | + 'init' : { |
1871 | + 'actions' : [], |
1872 | + 'result' : {'type' : 'action', |
1873 | + 'action' : _mergeInvoices, |
1874 | + 'state' : 'end'} |
1875 | + }, |
1876 | + } |
1877 | +merge_invoice("account.invoice.merge_invoice") |
1878 | + |
1879 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1880 | + |
1881 | |
1882 | === added directory 'account_journal_uniq_code' |
1883 | === added file 'account_journal_uniq_code/__init__.py' |
1884 | --- account_journal_uniq_code/__init__.py 1970-01-01 00:00:00 +0000 |
1885 | +++ account_journal_uniq_code/__init__.py 2012-07-09 12:36:28 +0000 |
1886 | @@ -0,0 +1,25 @@ |
1887 | +# -*- coding: utf-8 -*- |
1888 | +############################################################################## |
1889 | +# |
1890 | +# OpenERP, Open Source Management Solution |
1891 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1892 | +# All Rights Reserved |
1893 | +# |
1894 | +# This program is free software: you can redistribute it and/or modify |
1895 | +# it under the terms of the GNU General Public License as published by |
1896 | +# the Free Software Foundation, either version 3 of the License, or |
1897 | +# (at your option) any later version. |
1898 | +# |
1899 | +# This program is distributed in the hope that it will be useful, |
1900 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1901 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1902 | +# GNU General Public License for more details. |
1903 | +# |
1904 | +# You should have received a copy of the GNU General Public License |
1905 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1906 | +# |
1907 | +############################################################################## |
1908 | + |
1909 | +import object |
1910 | + |
1911 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1912 | |
1913 | === added file 'account_journal_uniq_code/__terp__.py' |
1914 | --- account_journal_uniq_code/__terp__.py 1970-01-01 00:00:00 +0000 |
1915 | +++ account_journal_uniq_code/__terp__.py 2012-07-09 12:36:28 +0000 |
1916 | @@ -0,0 +1,58 @@ |
1917 | +# -*- coding: utf-8 -*- |
1918 | +############################################################################## |
1919 | +# |
1920 | +# OpenERP, Open Source Management Solution |
1921 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1922 | +# All Rights Reserved |
1923 | +# $Id$ |
1924 | +# |
1925 | +# This program is free software: you can redistribute it and/or modify |
1926 | +# it under the terms of the GNU General Public License as published by |
1927 | +# the Free Software Foundation, either version 3 of the License, or |
1928 | +# (at your option) any later version. |
1929 | +# |
1930 | +# This program is distributed in the hope that it will be useful, |
1931 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1932 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1933 | +# GNU General Public License for more details. |
1934 | +# |
1935 | +# You should have received a copy of the GNU General Public License |
1936 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1937 | +# |
1938 | +############################################################################## |
1939 | +# AUTHOR : Claude Brulé for SYLEAM |
1940 | +############################################################################## |
1941 | + |
1942 | +{ |
1943 | + "name" : "Unique code on account journal", |
1944 | + "version" : "0.1.0", |
1945 | + "author" : "Syleam", |
1946 | + "website" : "http://www.syleam.fr", |
1947 | + "category" : "Generic Modules/Accounting", |
1948 | + "description": """ |
1949 | +This module oblige to have one unique code per journal. |
1950 | +(Dialow to have same code for 2 journals) |
1951 | + |
1952 | + |
1953 | + OpenERP version : 5.0 |
1954 | + Creation : 2009-07-09 |
1955 | + Last update : 2009-07-10 |
1956 | + |
1957 | +SEE ALSO : |
1958 | + account_move |
1959 | +""", |
1960 | + "depends" : [ |
1961 | + "base", |
1962 | + "account", |
1963 | + ], |
1964 | + "init_xml" : [ |
1965 | + ], |
1966 | + "update_xml" : [ |
1967 | + ], |
1968 | + "demo_xml" : [], |
1969 | + "active": False, |
1970 | + "installable": True, |
1971 | +# "certificate": False, |
1972 | +} |
1973 | + |
1974 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1975 | |
1976 | === added directory 'account_journal_uniq_code/object' |
1977 | === added file 'account_journal_uniq_code/object/__init__.py' |
1978 | --- account_journal_uniq_code/object/__init__.py 1970-01-01 00:00:00 +0000 |
1979 | +++ account_journal_uniq_code/object/__init__.py 2012-07-09 12:36:28 +0000 |
1980 | @@ -0,0 +1,25 @@ |
1981 | +# -*- coding: utf-8 -*- |
1982 | +############################################################################## |
1983 | +# |
1984 | +# OpenERP, Open Source Management Solution |
1985 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
1986 | +# All Rights Reserved |
1987 | +# |
1988 | +# This program is free software: you can redistribute it and/or modify |
1989 | +# it under the terms of the GNU General Public License as published by |
1990 | +# the Free Software Foundation, either version 3 of the License, or |
1991 | +# (at your option) any later version. |
1992 | +# |
1993 | +# This program is distributed in the hope that it will be useful, |
1994 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1995 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1996 | +# GNU General Public License for more details. |
1997 | +# |
1998 | +# You should have received a copy of the GNU General Public License |
1999 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2000 | +# |
2001 | +############################################################################## |
2002 | + |
2003 | +import account_journal |
2004 | + |
2005 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2006 | |
2007 | === added file 'account_journal_uniq_code/object/account_journal.py' |
2008 | --- account_journal_uniq_code/object/account_journal.py 1970-01-01 00:00:00 +0000 |
2009 | +++ account_journal_uniq_code/object/account_journal.py 2012-07-09 12:36:28 +0000 |
2010 | @@ -0,0 +1,87 @@ |
2011 | +# -*- coding: utf-8 -*- |
2012 | + |
2013 | +############################################################################## |
2014 | +# |
2015 | +# OpenERP, Open Source Management Solution |
2016 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
2017 | +# All Rights Reserved |
2018 | +# |
2019 | +# This program is free software: you can redistribute it and/or modify |
2020 | +# it under the terms of the GNU General Public License as published by |
2021 | +# the Free Software Foundation, either version 3 of the License, or |
2022 | +# (at your option) any later version. |
2023 | +# |
2024 | +# This program is distributed in the hope that it will be useful, |
2025 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2026 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2027 | +# GNU General Public License for more details. |
2028 | +# |
2029 | +# You should have received a copy of the GNU General Public License |
2030 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2031 | +# |
2032 | +############################################################################## |
2033 | +# AIM : |
2034 | +# account journal |
2035 | +# |
2036 | +############################################################################## |
2037 | +# Date Author Description |
2038 | +# 20090728 SYLEAM/CB constraint |
2039 | +# 20090820 SYLEAM/CB update copy to take care of new constraint |
2040 | +# |
2041 | +############################################################################## |
2042 | +# FUNCTIONAL DETAILS : |
2043 | +# unique code on account journal |
2044 | +# |
2045 | +############################################################################## |
2046 | +# TECHNICAL DETAILS : |
2047 | +# |
2048 | +############################################################################## |
2049 | +# RELATED FILES : |
2050 | +# |
2051 | +############################################################################## |
2052 | +# CONTENT : |
2053 | +# account.journal |
2054 | +############################################################################## |
2055 | + |
2056 | + |
2057 | +__author__ = "Claude Brulé (claude.brule@syleam.fr)" |
2058 | +__version__ = "$Revision: 0.2 $" |
2059 | +__date__ = "$Date: 2009/07/28 $" |
2060 | +__copyright__ = "Copyright (c) 2009 Syleam" |
2061 | +__license__ = "GPL v2" |
2062 | + |
2063 | + |
2064 | +from osv import fields, osv |
2065 | +#from osv import orm |
2066 | + |
2067 | + |
2068 | +class account_journal(osv.osv): |
2069 | + |
2070 | + _inherit = "account.journal" |
2071 | + |
2072 | +# _columns = { |
2073 | +# 'code': fields.char('Code', size=16), |
2074 | +# 'type': fields.selection([('sale', 'Sale'), ('purchase', 'Purchase'), ('cash', 'Cash'), ('general', 'General'), ('situation', 'Situation')], 'Type', size=32, required=True), |
2075 | +# 'refund_journal': fields.boolean('Refund Journal'), |
2076 | +# } |
2077 | + |
2078 | + _order = 'code' |
2079 | + |
2080 | + _sql_constraints = [ |
2081 | + ('code_uniq', 'unique (code)', 'The code of the journal must be unique !'), |
2082 | + ] |
2083 | + |
2084 | +# ######################################################### |
2085 | +# O V E R L O A D O S V |
2086 | +# ######################################################### |
2087 | + def copy(self, cr, uid, id, default={}, context=None): |
2088 | + vals = self.browse(cr, uid, id) |
2089 | + default['code'] = vals.code + '2' |
2090 | + new_id = super(account_journal, self).copy(cr, uid, id, default, context) |
2091 | + return new_id |
2092 | + |
2093 | +account_journal() |
2094 | + |
2095 | + |
2096 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2097 | + |
2098 | |
2099 | === added directory 'account_move' |
2100 | === added file 'account_move/__init__.py' |
2101 | --- account_move/__init__.py 1970-01-01 00:00:00 +0000 |
2102 | +++ account_move/__init__.py 2012-07-09 12:36:28 +0000 |
2103 | @@ -0,0 +1,28 @@ |
2104 | +# -*- coding: utf-8 -*- |
2105 | + |
2106 | +############################################################################## |
2107 | +# |
2108 | +# OpenERP, Open Source Management Solution |
2109 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
2110 | +# All Rights Reserved |
2111 | +# |
2112 | +# This program is free software: you can redistribute it and/or modify |
2113 | +# it under the terms of the GNU General Public License as published by |
2114 | +# the Free Software Foundation, either version 3 of the License, or |
2115 | +# (at your option) any later version. |
2116 | +# |
2117 | +# This program is distributed in the hope that it will be useful, |
2118 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2119 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2120 | +# GNU General Public License for more details. |
2121 | +# |
2122 | +# You should have received a copy of the GNU General Public License |
2123 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2124 | +# |
2125 | +############################################################################## |
2126 | +# AUTHOR : Claude Brulé for SYLEAM |
2127 | +############################################################################## |
2128 | + |
2129 | +import object |
2130 | + |
2131 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2132 | |
2133 | === added file 'account_move/__terp__.py' |
2134 | --- account_move/__terp__.py 1970-01-01 00:00:00 +0000 |
2135 | +++ account_move/__terp__.py 2012-07-09 12:36:28 +0000 |
2136 | @@ -0,0 +1,72 @@ |
2137 | +# -*- coding: utf-8 -*- |
2138 | + |
2139 | +############################################################################## |
2140 | +# |
2141 | +# OpenERP, Open Source Management Solution |
2142 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
2143 | +# All Rights Reserved |
2144 | +# $Id$ |
2145 | +# |
2146 | +# This program is free software: you can redistribute it and/or modify |
2147 | +# it under the terms of the GNU General Public License as published by |
2148 | +# the Free Software Foundation, either version 3 of the License, or |
2149 | +# (at your option) any later version. |
2150 | +# |
2151 | +# This program is distributed in the hope that it will be useful, |
2152 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2153 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2154 | +# GNU General Public License for more details. |
2155 | +# |
2156 | +# You should have received a copy of the GNU General Public License |
2157 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2158 | +# |
2159 | +############################################################################## |
2160 | +# AUTHOR : Claude Brulé for SYLEAM |
2161 | +############################################################################## |
2162 | +# TODO : |
2163 | +# implement grouped source lines AND ungrouped destionation lines |
2164 | +# translate and create po file |
2165 | +# remove debug messages & verif name on lines |
2166 | +############################################################################## |
2167 | + |
2168 | +{ |
2169 | + "name" : "Account moves functions", |
2170 | + "version" : "0.1", |
2171 | + "author" : "Syleam", |
2172 | + "website" : "http://www.syleam.fr", |
2173 | + "category" : "Generic Modules/Accounting", |
2174 | + "description": """ |
2175 | +Add technical functions to account.move : |
2176 | + + account.move.line::copy |
2177 | + + account.move.line::revert |
2178 | + + account.move.line::transfert |
2179 | + |
2180 | + |
2181 | + OpenERP version : 5.0 |
2182 | + Creation : 2009-07-06 |
2183 | + Last update : 2009-07-06 |
2184 | + |
2185 | +CAUTION : |
2186 | + THIS MODULE IS STILL UNDER DEVELOPMENT !! |
2187 | + |
2188 | +SEE ALSO : |
2189 | + List of modules witch should be used |
2190 | +""", |
2191 | + "depends" : [ "base", |
2192 | + "account", |
2193 | + ], |
2194 | + "init_xml" : [ |
2195 | +# "module_view.xml", |
2196 | +# "module_report.xml", |
2197 | +# "module_wizard.xml", |
2198 | +# "module_menu.xml", |
2199 | + ], |
2200 | + "update_xml" : [ |
2201 | + ], |
2202 | + "demo_xml" : [], |
2203 | + "active": False, |
2204 | + "installable": True, |
2205 | +# "certificate": False, |
2206 | +} |
2207 | + |
2208 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2209 | |
2210 | === added directory 'account_move/object' |
2211 | === added file 'account_move/object/__init__.py' |
2212 | --- account_move/object/__init__.py 1970-01-01 00:00:00 +0000 |
2213 | +++ account_move/object/__init__.py 2012-07-09 12:36:28 +0000 |
2214 | @@ -0,0 +1,27 @@ |
2215 | +# -*- coding: utf-8 -*- |
2216 | + |
2217 | +############################################################################## |
2218 | +# |
2219 | +# OpenERP, Open Source Management Solution |
2220 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
2221 | +# All Rights Reserved |
2222 | +# |
2223 | +# This program is free software: you can redistribute it and/or modify |
2224 | +# it under the terms of the GNU General Public License as published by |
2225 | +# the Free Software Foundation, either version 3 of the License, or |
2226 | +# (at your option) any later version. |
2227 | +# |
2228 | +# This program is distributed in the hope that it will be useful, |
2229 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2230 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2231 | +# GNU General Public License for more details. |
2232 | +# |
2233 | +# You should have received a copy of the GNU General Public License |
2234 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2235 | +# |
2236 | +############################################################################## |
2237 | + |
2238 | +# python files |
2239 | +import account_move |
2240 | +import account_move_line |
2241 | + |
2242 | |
2243 | === added file 'account_move/object/account_move.py' |
2244 | --- account_move/object/account_move.py 1970-01-01 00:00:00 +0000 |
2245 | +++ account_move/object/account_move.py 2012-07-09 12:36:28 +0000 |
2246 | @@ -0,0 +1,71 @@ |
2247 | +# -*- coding: utf-8 -*- |
2248 | + |
2249 | +############################################################################## |
2250 | +# |
2251 | +# OpenERP, Open Source Management Solution |
2252 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
2253 | +# All Rights Reserved |
2254 | +# |
2255 | +# This program is free software: you can redistribute it and/or modify |
2256 | +# it under the terms of the GNU General Public License as published by |
2257 | +# the Free Software Foundation, either version 3 of the License, or |
2258 | +# (at your option) any later version. |
2259 | +# |
2260 | +# This program is distributed in the hope that it will be useful, |
2261 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2262 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2263 | +# GNU General Public License for more details. |
2264 | +# |
2265 | +# You should have received a copy of the GNU General Public License |
2266 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2267 | +# |
2268 | +############################################################################## |
2269 | + |
2270 | +############################################################################## |
2271 | +# AIM : |
2272 | +# Common/base functions for accounting |
2273 | +# |
2274 | +############################################################################## |
2275 | +# Date Author Description |
2276 | +# 20090706 SYLEAM/CB def transfert |
2277 | +# |
2278 | +############################################################################## |
2279 | +# FUNCTIONAL DETAILS : |
2280 | +# Overload account.move to add more functionnalities |
2281 | +# |
2282 | +############################################################################## |
2283 | +# TECHNICAL DETAILS : |
2284 | +# |
2285 | +############################################################################## |
2286 | +# RELATED FILES : |
2287 | +# |
2288 | +############################################################################## |
2289 | +# CONTENT : |
2290 | +# account.move |
2291 | +############################################################################## |
2292 | +# TODO : |
2293 | +# implement counter-part ( revert an entier move) |
2294 | +############################################################################## |
2295 | + |
2296 | +__author__ = "Claude Brulé (claude.brule@syleam.fr)" |
2297 | +__version__ = "$Revision: 0.1 $" |
2298 | +__date__ = "$Date: 2009/07/06 $" |
2299 | +__copyright__ = "Copyright (c) 2009 Syleam" |
2300 | +__license__ = "GPL v2" |
2301 | + |
2302 | + |
2303 | +from osv import fields, osv |
2304 | +from osv import orm |
2305 | + |
2306 | +class account_move(osv.osv): |
2307 | +# _name = "account.move" |
2308 | + _inherit = "account.move" |
2309 | +# _description = "Account Entry" |
2310 | + |
2311 | + |
2312 | +# ######################################################### |
2313 | +# O B J E C T M E T H O D |
2314 | +# ######################################################### |
2315 | + |
2316 | +account_move() |
2317 | + |
2318 | |
2319 | === added file 'account_move/object/account_move_line.py' |
2320 | --- account_move/object/account_move_line.py 1970-01-01 00:00:00 +0000 |
2321 | +++ account_move/object/account_move_line.py 2012-07-09 12:36:28 +0000 |
2322 | @@ -0,0 +1,214 @@ |
2323 | +# -*- coding: utf-8 -*- |
2324 | + |
2325 | +############################################################################## |
2326 | +# |
2327 | +# OpenERP, Open Source Management Solution |
2328 | +# Copyright (C) 2008-2009 Syleam Info Services (<http://www.syleam.fr>). |
2329 | +# All Rights Reserved |
2330 | +# |
2331 | +# This program is free software: you can redistribute it and/or modify |
2332 | +# it under the terms of the GNU General Public License as published by |
2333 | +# the Free Software Foundation, either version 3 of the License, or |
2334 | +# (at your option) any later version. |
2335 | +# |
2336 | +# This program is distributed in the hope that it will be useful, |
2337 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2338 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2339 | +# GNU General Public License for more details. |
2340 | +# |
2341 | +# You should have received a copy of the GNU General Public License |
2342 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2343 | +# |
2344 | +############################################################################## |
2345 | + |
2346 | +############################################################################## |
2347 | +# AIM : |
2348 | +# Common/base functions for accounting |
2349 | +# |
2350 | +############################################################################## |
2351 | +# Date Author Description |
2352 | +# 20090706 SYLEAM/CB def transfert |
2353 | +# |
2354 | +############################################################################## |
2355 | +# FUNCTIONAL DETAILS : |
2356 | +# Overload account.move to add more functionnalities |
2357 | +# |
2358 | +############################################################################## |
2359 | +# TECHNICAL DETAILS : |
2360 | +# |
2361 | +############################################################################## |
2362 | +# RELATED FILES : |
2363 | +# |
2364 | +############################################################################## |
2365 | +# CONTENT : |
2366 | +# account.move.line |
2367 | +############################################################################## |
2368 | +# TODO : |
2369 | +# verify if name must be set or not (cf Zikzakmedia) |
2370 | +# check if entry name is label or number ? |
2371 | +############################################################################## |
2372 | + |
2373 | +__author__ = "Claude Brulé (claude.brule@syleam.fr)" |
2374 | +__version__ = "$Revision: 0.1 $" |
2375 | +__date__ = "$Date: 2009/07/06 $" |
2376 | +__copyright__ = "Copyright (c) 2009 Syleam" |
2377 | +__license__ = "GPL v2" |
2378 | + |
2379 | + |
2380 | +from osv import fields, osv |
2381 | +from osv import orm |
2382 | + |
2383 | + |
2384 | +class account_move_line(osv.osv): |
2385 | +# _name = "account.move.line" |
2386 | + _inherit = "account.move.line" |
2387 | +# _description = "Entry lines" |
2388 | + |
2389 | + |
2390 | +# ######################################################### |
2391 | +# O B J E C T M E T H O D |
2392 | +# ######################################################### |
2393 | + def copy(self, cr, uid, id, default={}, context={}): |
2394 | + """ Copy original line. Detache it form original move. Reset value to default |
2395 | + """ |
2396 | + default.update({'state':'draft', 'move_id':False, 'statement_id':False, 'reconcile_id':False, 'reconcile_partial_id': False, 'date_maturity': False}) |
2397 | + return super(account_move_line, self).copy(cr, uid, id, default, context) |
2398 | + |
2399 | + |
2400 | + def revert(self, cr, uid, ids, line_date, journal_id, period_id, context={}): |
2401 | +# print "DEBUG: account.move.line::revert(%r, %r, %r, %r, %r)" % (ids, line_date, journal_id, period_id, context) |
2402 | + """Create new account.move.line by copying referenced one AND exchange debit <--> credit |
2403 | + in order to have new one as opposite of originial, to cancel it. |
2404 | + Keep original name and reference |
2405 | + |
2406 | + @param ids : (id/int) (from) move lines source entries |
2407 | + @param line_date : (date) (to) date of new entry (should be the date of the day) |
2408 | + @param journal_id : (id/int) (to) target journal |
2409 | + @param period_id : (id/int) (to) target period for accounting (would be cooresponding to line_date) |
2410 | + |
2411 | + @return: (id/int) id of the new entry |
2412 | + """ |
2413 | + new_ids = [] |
2414 | + for line in self.browse(cr, uid, ids): |
2415 | + # Reset |
2416 | + init_vals = {'journal_id': journal_id, 'period_id': period_id, 'date': line_date} |
2417 | + # Invert amounts |
2418 | + init_vals['debit'] = line.credit or 0.0 |
2419 | + init_vals['credit'] = line.debit or 0.0 |
2420 | + init_vals['name'] = line.name # <== NON cf Zikzakmedia |
2421 | + init_vals['ref'] = line.ref |
2422 | +# print "DEBUG: account.move.line::revert > init_vals = %r" % init_vals |
2423 | + new_id = self.pool.get('account.move.line').copy(cr, uid, line.id, default=init_vals, context=context) |
2424 | + if line.tax_amount: |
2425 | + raise osv.except_osv(_('Error'), _('Not yet implemented.')) |
2426 | + if line.analytic_lines or line.analytic_account_id: |
2427 | + raise osv.except_osv(_('Error'), _('Not yet implemented.')) |
2428 | + new_ids.append(new_id) |
2429 | +# print "DEBUG: account.move.line::revert = %r" % new_ids |
2430 | + return new_ids |
2431 | + |
2432 | + |
2433 | + def transfert(self, cr, uid, ids, entry_date, entry_name, journal_id, period_id, debit_account_id=None, credit_account_id=None, |
2434 | + agregate_source=False, agregate_target=True, do_reconcile=False, context={}): |
2435 | +# print "DEBUG: account.move.line::transfert(%r, %r, %r, %r, %r, %r, %r, %r, %r, %r, %r)" % (ids, entry_date, entry_name, journal_id, period_id, debit_account_id, credit_account_id, agregate_source, agregate_target, do_reconcile, context) |
2436 | + """Create a new account.move based on many move.lines (form other moves) |
2437 | + |
2438 | + @param ids : (id/int) (from) move lines source entries |
2439 | + @param entry_date : (date) (to) date of new move entry (would always be the date of the day) |
2440 | +NON entry_name : (string) (to) name/label of new move entry <== A REVOIR |
2441 | + @param journal_id : (id/int) (to) target journal |
2442 | + @param period_id : (id/int) (to) target period for accounting |
2443 | + @param debit_account_id : (id/int) (to) target account number if sum of source move lines is negative (new imputation) |
2444 | + @param credit_account_id : (id/int) (to) target account number if sum of source move lines is positive (new imputation) |
2445 | + @param agregate_source : (boolean) will counter-parts of orginal lines be sum ? |
2446 | + @param agregate_target : (boolean) centralise counter-part of the new generated entry (or leave all details) |
2447 | + @param reconcile : (boolean) reconcile source move lines (line by line OR account number by account number) |
2448 | + |
2449 | + @return: (id/int) id of the new entry |
2450 | + """ |
2451 | + # I) Create Header |
2452 | + move_head = { #common data on all move (header & lines) |
2453 | + 'date': entry_date, |
2454 | + #'name': None, #Let OpenERP give a number (do not use entry_name nor False) |
2455 | + 'ref': False, #TODO If len(ids) == 1 Then keep ref of this move ? |
2456 | + 'journal_id': journal_id, |
2457 | + 'period_id': period_id, |
2458 | + } |
2459 | + new_id = self.pool.get('account.move').create(cr, uid, move_head.copy(), context=context) |
2460 | + # II) Create First side lines |
2461 | + total_amount = 0 |
2462 | +## new_ml_ids = [] |
2463 | + if not agregate_source: |
2464 | + ml_ids = self.pool.get('account.move.line').revert(cr, uid, ids, entry_date, journal_id, period_id, context=context) |
2465 | + self.pool.get('account.move.line').write(cr, uid, ml_ids, {'move_id':new_id}, context=context) |
2466 | +## new_ml_ids.append(ml_ids) |
2467 | + else: #Agergate (given) entry lines |
2468 | + raise osv.except_osv(_('Error'), _('Not yet implemented.')) |
2469 | + # III) Create Second side lines |
2470 | + # III.1 determining the way of counter part |
2471 | +## for id in new_ml_ids: |
2472 | +## ml_obj = self.pool.get('account.move.line').browse(cr, uid, id, context=context)[0] |
2473 | + for id in ids: |
2474 | + ml_obj = self.pool.get('account.move.line').browse(cr, uid, id, context=context) |
2475 | +# print "DEBUG: account.move.line::transfert > ml_obj = %r" % ml_obj |
2476 | + total_amount += ml_obj.credit - ml_obj.debit |
2477 | + # III.2 create counter part (one summed line OR all details) |
2478 | + if agregate_target: |
2479 | + if total_amount > 0: |
2480 | + if not credit_account_id: |
2481 | + raise osv.except_osv(_('Error'), _('Credit account must be set.')) |
2482 | + ml_sum = { |
2483 | + 'account_id': credit_account_id, |
2484 | + 'credit': total_amount, |
2485 | + } |
2486 | + else: |
2487 | + if not debit_account_id: |
2488 | + raise osv.except_osv(_('Error'), _('Debit account must be set.')) |
2489 | + ml_sum = { |
2490 | + 'account_id': debit_account_id, |
2491 | + 'debit': - total_amount, |
2492 | + } |
2493 | + ml_sum.update(move_head) |
2494 | + ml_sum['move_id'] = new_id |
2495 | +#### ml_sum['name'] = entry_name |
2496 | +# print "DEBUG: account.move.line::transfert > counter part = %r" % ml_sum |
2497 | + cp_id = self.pool.get('account.move.line').create(cr, uid, ml_sum, context=context) |
2498 | +# print "DEBUG: account.move.line::transfert > counter-part ID = %r" % cp_id |
2499 | + else: #Do not agergate calculated lines |
2500 | + raise osv.except_osv(_('Error'), _('Not yet implemented.')) |
2501 | + # IV) Validate/Post entries |
2502 | + journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context) |
2503 | + if journal.entry_posted: |
2504 | + m = self.pool.get('account.move').browse(cr, uid, new_id, context=context) |
2505 | +# print "DEBUG: account.move M = %r" % m.date |
2506 | +# print "DEBUG: account.move M = %r" % m.journal_id.name |
2507 | +# print "DEBUG: account.move M = %r" % m.name |
2508 | +# for l in m.line_id: |
2509 | +# print "DEBUG: account.move L = %r" % l.ref |
2510 | +# print "DEBUG: account.move L = %r" % l.name |
2511 | + m.post(cr, uid, [new_id], context=context) |
2512 | + # V) Reconcile source lines |
2513 | + if do_reconcile: |
2514 | + all_lines_rec = ml_ids + ids |
2515 | +# print "DEBUG: account.move.line::transfert > all_lines_rec = %r" % all_lines_rec |
2516 | + self.pool.get('account.move.line').reconcile(cr, uid, all_lines_rec, type='manual', context=context) |
2517 | + return new_id |
2518 | + |
2519 | + |
2520 | + def re_imputation(self, cr, uid, ids, new_account_id, note='', context={}): |
2521 | + """Change line attribution to an other account number. |
2522 | + |
2523 | + @param ids : (id/int) move lines of entries to change imputation |
2524 | + @param new_account_id: (id/int) account number to change for |
2525 | + @param note: (string) raison of changing / why wasn't it good first. |
2526 | + |
2527 | + @return: Nothing |
2528 | + """ |
2529 | + raise osv.except_osv(_('Error'), _('Not yet implemented.')) |
2530 | + |
2531 | + return True |
2532 | + |
2533 | +account_move_line() |
2534 | + |
2535 | + |
2536 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
what the heck is this merge proposal? probably only a wrong maneuver. If it was not, a description explaining what 2536 lines of diff are doing would have been a plus for beeing accepted ;-)
Anyway, for your information the process of adding new features/modules into the main addons core is a decision reserved to the R&D department. So even if you can suggest it, you must be aware that we currently don't plan to du such a thing.
For those 2 reasons i'm rejecting this merge proposal.
Thanks for your understanding,
Quentin