Merge lp:~pedro.baeza/account-financial-tools/7.0-account-renumber-menu-fix into lp:~account-core-editors/account-financial-tools/7.0

Proposed by Pedro Manuel Baeza
Status: Merged
Merged at revision: 187
Proposed branch: lp:~pedro.baeza/account-financial-tools/7.0-account-renumber-menu-fix
Merge into: lp:~account-core-editors/account-financial-tools/7.0
Diff against target: 885 lines (+278/-427)
5 files modified
account_renumber/i18n/account_renumber.pot (+82/-76)
account_renumber/i18n/es.po (+94/-89)
account_renumber/i18n/es_ES.po (+0/-135)
account_renumber/wizard/wizard_renumber.py (+54/-82)
account_renumber/wizard/wizard_renumber_view.xml (+48/-45)
To merge this branch: bzr merge lp:~pedro.baeza/account-financial-tools/7.0-account-renumber-menu-fix
Reviewer Review Type Date Requested Status
Omar (Pexego) Approve
Yannick Vaucher @ Camptocamp Approve
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Stefan Rijnhart (Opener) Needs Information
Review via email: mp+214832@code.launchpad.net

Commit message

[IMP] account_renumber: Spaces instead tabs on XML.
[IMP] account_renumber: PEP8
[IMP] account_renumber: Restrict to account managers.
[FIX] account_renumber: Fix translations.

Description of the change

Group restriction changed to account managers. Restriction to "Configuration" users doesn't make sense, because an accountant can renumber journal entries without belonging to this group. Code changed accordingly to allow this operation.

I have already rename some variables to follow conventions, PEP8 and re-export translation with some changes of translation strings themselves.

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks! Looks good, in general.

Do you mean to say that members of the accountant group should be able to perform a renumbering? I'd say this should be restricted to accounting managers at least. Don't you think so?

And pleasee take the opportunity to change the 'o' in line 79 to 'or'.

review: Needs Information
173. By Pedro Manuel Baeza

[IMP] account_renumber: PEP8
[IMP] account_renumber: Restrict to account managers.
[IMP] account_renumber: Fix translations.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Stefan, I have restricted the menu to account managers, and change code to write new sequence number as admin. That's the original reason why account renumber was restricted to configuration users.

I have taken also all the code and refactorise to PEP8, community conventions and so on. I hope diff is not too large.

Regards.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Hello Pedro,

There are conflicts in translations

ll.223-231
ll.244-257
ll.265-273
ll.298-305
ll.381-392

Can you resolve them ?

review: Needs Fixing
174. By Pedro Manuel Baeza

Merge last changes and resolve conflict

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I have merge last changes of the repository to solve conflicts.

Regards.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

There are some indentation to fix in account_renumber/wizard/wizard_renumber.py to be PEP8 compliant.

review: Needs Fixing
175. By Pedro Manuel Baeza

[IMP] account_renumber: Full PEP8 in wizard_renumber.py

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Yannick,

I have done the requested changes.

Regards.

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi Perdo,

Thanks for the contribution, it LGTM.

Regards,

review: Approve (code review, no tests)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Thanks for the changes Pedro

LGTM

review: Approve
Revision history for this message
Omar (Pexego) (omar7r) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_renumber/i18n/account_renumber.pot'
2--- account_renumber/i18n/account_renumber.pot 2013-09-26 16:50:10 +0000
3+++ account_renumber/i18n/account_renumber.pot 2014-05-05 16:20:48 +0000
4@@ -4,10 +4,10 @@
5 #
6 msgid ""
7 msgstr ""
8-"Project-Id-Version: OpenERP Server 7.0-20130902-231053\n"
9+"Project-Id-Version: OpenERP Server 7.0\n"
10 "Report-Msgid-Bugs-To: \n"
11-"POT-Creation-Date: 2013-09-26 16:17+0000\n"
12-"PO-Revision-Date: 2013-09-26 16:17+0000\n"
13+"POT-Creation-Date: 2014-04-14 12:33+0000\n"
14+"PO-Revision-Date: 2014-04-14 12:33+0000\n"
15 "Last-Translator: <>\n"
16 "Language-Team: \n"
17 "MIME-Version: 1.0\n"
18@@ -16,8 +16,19 @@
19 "Plural-Forms: \n"
20
21 #. module: account_renumber
22-#: selection:wizard.renumber,state:0
23-msgid "Renumbering"
24+#: code:_description:0
25+#, python-format
26+msgid "Account renumber wizard"
27+msgstr ""
28+
29+#. module: account_renumber
30+#: view:wizard.renumber:0
31+msgid "Cancel"
32+msgstr ""
33+
34+#. module: account_renumber
35+#: field:wizard.renumber,number_next:0
36+msgid "First Number"
37 msgstr ""
38
39 #. module: account_renumber
40@@ -26,24 +37,18 @@
41 msgstr ""
42
43 #. module: account_renumber
44-#: model:ir.actions.act_window,name:account_renumber.action_account_renumber
45-#: model:ir.ui.menu,name:account_renumber.menu_account_renumber
46-msgid "Renumber journal entries"
47-msgstr ""
48-
49-#. module: account_renumber
50-#: field:wizard.renumber,number_next:0
51-msgid "First Number"
52-msgstr ""
53-
54-#. module: account_renumber
55-#: field:wizard.renumber,state:0
56-msgid "unknown"
57-msgstr ""
58-
59-#. module: account_renumber
60 #: view:wizard.renumber:0
61-msgid "Renumber"
62+msgid "General Data"
63+msgstr ""
64+
65+#. module: account_renumber
66+#: selection:wizard.renumber,state:0
67+msgid "Initial"
68+msgstr ""
69+
70+#. module: account_renumber
71+#: help:wizard.renumber,number_next:0
72+msgid "Journal sequences will start counting on this number"
73 msgstr ""
74
75 #. module: account_renumber
76@@ -58,76 +63,77 @@
77 msgstr ""
78
79 #. module: account_renumber
80-#: selection:wizard.renumber,state:0
81-msgid "Initial"
82-msgstr ""
83-
84-#. module: account_renumber
85 #: help:wizard.renumber,journal_ids:0
86 msgid "Journals to renumber"
87 msgstr ""
88
89 #. module: account_renumber
90+#: code:addons/account_renumber/wizard/wizard_renumber.py:86
91+#, python-format
92+msgid "No Data Available"
93+msgstr ""
94+
95+#. module: account_renumber
96+#: code:addons/account_renumber/wizard/wizard_renumber.py:87
97+#, python-format
98+msgid "No records found for your selection!"
99+msgstr ""
100+
101+#. module: account_renumber
102+#: view:wizard.renumber:0
103+#: field:wizard.renumber,period_ids:0
104+msgid "Periods"
105+msgstr ""
106+
107+#. module: account_renumber
108+#: view:wizard.renumber:0
109+msgid "Posted moves from those journals will be sorted by date and then assigned sequential numbers using their journal sequence."
110+msgstr ""
111+
112+#. module: account_renumber
113+#: view:wizard.renumber:0
114+msgid "Renumber"
115+msgstr ""
116+
117+#. module: account_renumber
118 #: view:wizard.renumber:0
119 msgid "Renumber Account Moves"
120 msgstr ""
121
122 #. module: account_renumber
123-#: code:addons/account_renumber/wizard/wizard_renumber.py:197
124+#: model:ir.actions.act_window,name:account_renumber.action_account_renumber
125+#: model:ir.ui.menu,name:account_renumber.menu_account_renumber
126+msgid "Renumber journal entries"
127+msgstr ""
128+
129+#. module: account_renumber
130+#: code:addons/account_renumber/wizard/wizard_renumber.py:130
131 #, python-format
132 msgid "Renumbered account moves"
133 msgstr ""
134
135 #. module: account_renumber
136+#: selection:wizard.renumber,state:0
137+msgid "Renumbering"
138+msgstr ""
139+
140+#. module: account_renumber
141+#: view:wizard.renumber:0
142+msgid "This wizard will help you renumber entries in one or more journals."
143+msgstr ""
144+
145+#. module: account_renumber
146+#: view:wizard.renumber:0
147+msgid "or"
148+msgstr ""
149+
150+#. module: account_renumber
151+#: field:wizard.renumber,state:0
152+msgid "unknown"
153+msgstr ""
154+
155+#. module: account_renumber
156 #: model:ir.model,name:account_renumber.model_wizard_renumber
157 msgid "wizard.renumber"
158 msgstr ""
159
160-#. module: account_renumber
161-#: code:addons/account_renumber/wizard/wizard_renumber.py:139
162-#, python-format
163-msgid "No Data Available"
164-msgstr ""
165-
166-#. module: account_renumber
167-#: view:wizard.renumber:0
168-msgid "General Data"
169-msgstr ""
170-
171-#. module: account_renumber
172-#: view:wizard.renumber:0
173-msgid "This wizard will help you renumber entries in one or more journals."
174-msgstr ""
175-
176-#. module: account_renumber
177-#: view:wizard.renumber:0
178-msgid "sequential numbers using their journal sequence."
179-msgstr ""
180-
181-#. module: account_renumber
182-#: code:addons/account_renumber/wizard/wizard_renumber.py:140
183-#, python-format
184-msgid "No records found for your selection!"
185-msgstr ""
186-
187-#. module: account_renumber
188-#: view:wizard.renumber:0
189-msgid "Posted moves from those journals will be sorted by date and then assigned"
190-msgstr ""
191-
192-#. module: account_renumber
193-#: view:wizard.renumber:0
194-#: field:wizard.renumber,period_ids:0
195-msgid "Periods"
196-msgstr ""
197-
198-#. module: account_renumber
199-#: view:wizard.renumber:0
200-msgid "Cancel"
201-msgstr ""
202-
203-#. module: account_renumber
204-#: help:wizard.renumber,number_next:0
205-msgid "Journal sequences will start counting on this number"
206-msgstr ""
207-
208
209=== modified file 'account_renumber/i18n/es.po'
210--- account_renumber/i18n/es.po 2014-05-03 06:44:24 +0000
211+++ account_renumber/i18n/es.po 2014-05-05 16:20:48 +0000
212@@ -4,34 +4,28 @@
213 #
214 msgid ""
215 msgstr ""
216-"Project-Id-Version: OpenERP Server 5.0.6\n"
217+"Project-Id-Version: OpenERP Server 7.0\n"
218 "Report-Msgid-Bugs-To: \n"
219-"POT-Creation-Date: 2013-09-26 16:17+0000\n"
220-"PO-Revision-Date: 2014-04-08 19:42+0000\n"
221-"Last-Translator: Juan A. Pérez Ruiz (Otherway) <juanalfonso@otherway.es>\n"
222+"POT-Creation-Date: 2014-04-14 12:12+0000\n"
223+"PO-Revision-Date: 2014-05-05 11:47+0100\n"
224+"Last-Translator: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>\n"
225 "Language-Team: \n"
226 "MIME-Version: 1.0\n"
227 "Content-Type: text/plain; charset=UTF-8\n"
228 "Content-Transfer-Encoding: 8bit\n"
229-"X-Launchpad-Export-Date: 2014-05-03 06:44+0000\n"
230-"X-Generator: Launchpad (build 16985)\n"
231-"Language: \n"
232-
233-#. module: account_renumber
234-#: selection:wizard.renumber,state:0
235-msgid "Renumbering"
236-msgstr "Renumerando"
237-
238-#. module: account_renumber
239-#: help:wizard.renumber,period_ids:0
240-msgid "Fiscal periods to renumber"
241-msgstr "Periodos fiscales a renumerar"
242-
243-#. module: account_renumber
244-#: model:ir.actions.act_window,name:account_renumber.action_account_renumber
245-#: model:ir.ui.menu,name:account_renumber.menu_account_renumber
246-msgid "Renumber journal entries"
247-msgstr "Renumerar asientos"
248+"Plural-Forms: \n"
249+"X-Generator: Poedit 1.5.4\n"
250+
251+#. module: account_renumber
252+#: code:_description:0
253+#, python-format
254+msgid "Account renumber wizard"
255+msgstr "Asistente de renumeración contable"
256+
257+#. module: account_renumber
258+#: view:wizard.renumber:0
259+msgid "Cancel"
260+msgstr "Cancelar"
261
262 #. module: account_renumber
263 #: field:wizard.renumber,number_next:0
264@@ -39,18 +33,22 @@
265 msgstr "Primer número"
266
267 #. module: account_renumber
268-#: field:wizard.renumber,state:0
269-msgid "unknown"
270-msgstr "desconocido"
271-
272-#. module: account_renumber
273-#: view:wizard.renumber:0
274-msgid "Renumber"
275-msgstr "Renumerar"
276-
277-#. module: account_renumber
278-#: view:wizard.renumber:0
279-#: field:wizard.renumber,journal_ids:0
280+#: help:wizard.renumber,period_ids:0
281+msgid "Fiscal periods to renumber"
282+msgstr "Periodos a renumerar"
283+
284+#. module: account_renumber
285+#: view:wizard.renumber:0
286+msgid "General Data"
287+msgstr "Datos generales"
288+
289+#. module: account_renumber
290+#: selection:wizard.renumber,state:0
291+msgid "Initial"
292+msgstr "Inicial"
293+
294+#. module: account_renumber
295+#: view:wizard.renumber:0 field:wizard.renumber,journal_ids:0
296 msgid "Journals"
297 msgstr "Diarios"
298
299@@ -60,77 +58,84 @@
300 msgstr "Diarios y periodos a considerar"
301
302 #. module: account_renumber
303-#: selection:wizard.renumber,state:0
304-msgid "Initial"
305-msgstr "Inicial"
306-
307-#. module: account_renumber
308 #: help:wizard.renumber,journal_ids:0
309 msgid "Journals to renumber"
310 msgstr "Diarios a renumerar"
311
312 #. module: account_renumber
313+#: code:addons/account_renumber/wizard/wizard_renumber.py:96
314+#, python-format
315+msgid "No Data Available"
316+msgstr "No hay datos disponibles"
317+
318+#. module: account_renumber
319+#: code:addons/account_renumber/wizard/wizard_renumber.py:97
320+#, python-format
321+msgid "No records found for your selection!"
322+msgstr "No se han encontrado registros para la selección"
323+
324+#. module: account_renumber
325+#: view:wizard.renumber:0 field:wizard.renumber,period_ids:0
326+msgid "Periods"
327+msgstr "Periodos"
328+
329+#. module: account_renumber
330+#: view:wizard.renumber:0
331+msgid ""
332+"Posted moves from those journals will be sorted by date and then assigned "
333+"sequential numbers using their journal sequence."
334+msgstr ""
335+"Los asientos asentados de estos diarios se ordenarán por fecha y entonces se "
336+"les asignará un número de secuencia usando su secuencia de diario."
337+
338+#. module: account_renumber
339+#: view:wizard.renumber:0
340+msgid "Renumber"
341+msgstr "Renumerar"
342+
343+#. module: account_renumber
344 #: view:wizard.renumber:0
345 msgid "Renumber Account Moves"
346 msgstr "Renumerar asientos contables"
347
348 #. module: account_renumber
349-#: code:addons/account_renumber/wizard/wizard_renumber.py:197
350+#: model:ir.actions.act_window,name:account_renumber.action_account_renumber
351+#: model:ir.ui.menu,name:account_renumber.menu_account_renumber
352+msgid "Renumber journal entries"
353+msgstr "Renumerar asientos contables"
354+
355+#. module: account_renumber
356+#: code:addons/account_renumber/wizard/wizard_renumber.py:159
357 #, python-format
358 msgid "Renumbered account moves"
359 msgstr "Asientos contables renumerados"
360
361 #. module: account_renumber
362+#: selection:wizard.renumber,state:0
363+msgid "Renumbering"
364+msgstr "Renumerando"
365+
366+#. module: account_renumber
367+#: view:wizard.renumber:0
368+msgid "This wizard will help you renumber entries in one or more journals."
369+msgstr "Este asistente le permite renumerar los asientos de uno o más diarios."
370+
371+#. module: account_renumber
372+#: view:wizard.renumber:0
373+msgid "or"
374+msgstr "o"
375+
376+#. module: account_renumber
377+#: field:wizard.renumber,state:0
378+msgid "unknown"
379+msgstr "desconocido"
380+
381+#. module: account_renumber
382+#: code:_description:0
383 #: model:ir.model,name:account_renumber.model_wizard_renumber
384+#, python-format
385 msgid "wizard.renumber"
386-msgstr "wizard.renumber"
387-
388-#. module: account_renumber
389-#: code:addons/account_renumber/wizard/wizard_renumber.py:139
390-#, python-format
391-msgid "No Data Available"
392-msgstr "No hay datos disponibles"
393-
394-#. module: account_renumber
395-#: view:wizard.renumber:0
396-msgid "General Data"
397-msgstr "Datos Generales"
398-
399-#. module: account_renumber
400-#: view:wizard.renumber:0
401-msgid "This wizard will help you renumber entries in one or more journals."
402-msgstr ""
403-"Este asistente le ayudará a renumerar los asientos en uno o más diarios."
404-
405-#. module: account_renumber
406-#: view:wizard.renumber:0
407-msgid "sequential numbers using their journal sequence."
408-msgstr "números secuenciales usando su secuencia de diario."
409-
410-#. module: account_renumber
411-#: code:addons/account_renumber/wizard/wizard_renumber.py:140
412-#, python-format
413-msgid "No records found for your selection!"
414-msgstr "No se han encontrado registros en su selección"
415-
416-#. module: account_renumber
417-#: view:wizard.renumber:0
418-msgid ""
419-"Posted moves from those journals will be sorted by date and then assigned"
420-msgstr ""
421-"Los elementos asentados de esos diarios serán ordenados por fecha y "
422-"asignados a"
423-
424-#. module: account_renumber
425-#: view:wizard.renumber:0
426-#: field:wizard.renumber,period_ids:0
427-msgid "Periods"
428-msgstr "Periodos"
429-
430-#. module: account_renumber
431-#: view:wizard.renumber:0
432-msgid "Cancel"
433-msgstr "Cancelar"
434+msgstr "Asistente de renumeración de asientos"
435
436 #. module: account_renumber
437 #: help:wizard.renumber,number_next:0
438
439=== removed file 'account_renumber/i18n/es_ES.po'
440--- account_renumber/i18n/es_ES.po 2014-05-03 06:44:24 +0000
441+++ account_renumber/i18n/es_ES.po 1970-01-01 00:00:00 +0000
442@@ -1,135 +0,0 @@
443-# Translation of OpenERP Server.
444-# This file contains the translation of the following modules:
445-# * account_renumber
446-#
447-msgid ""
448-msgstr ""
449-"Project-Id-Version: OpenERP Server 5.0.6\n"
450-"Report-Msgid-Bugs-To: \n"
451-"POT-Creation-Date: 2013-09-26 16:17+0000\n"
452-"PO-Revision-Date: 2013-10-18 17:39+0000\n"
453-"Last-Translator: Joaquin Gutierrez <Unknown>\n"
454-"Language-Team: \n"
455-"MIME-Version: 1.0\n"
456-"Content-Type: text/plain; charset=UTF-8\n"
457-"Content-Transfer-Encoding: 8bit\n"
458-"X-Launchpad-Export-Date: 2014-05-03 06:44+0000\n"
459-"X-Generator: Launchpad (build 16985)\n"
460-"Language: \n"
461-
462-#. module: account_renumber
463-#: selection:wizard.renumber,state:0
464-msgid "Renumbering"
465-msgstr ""
466-
467-#. module: account_renumber
468-#: help:wizard.renumber,period_ids:0
469-msgid "Fiscal periods to renumber"
470-msgstr "Periodos fiscales a renumerar"
471-
472-#. module: account_renumber
473-#: model:ir.actions.act_window,name:account_renumber.action_account_renumber
474-#: model:ir.ui.menu,name:account_renumber.menu_account_renumber
475-msgid "Renumber journal entries"
476-msgstr ""
477-
478-#. module: account_renumber
479-#: field:wizard.renumber,number_next:0
480-msgid "First Number"
481-msgstr "Primer número"
482-
483-#. module: account_renumber
484-#: field:wizard.renumber,state:0
485-msgid "unknown"
486-msgstr "unknown"
487-
488-#. module: account_renumber
489-#: view:wizard.renumber:0
490-msgid "Renumber"
491-msgstr "Renumerar"
492-
493-#. module: account_renumber
494-#: view:wizard.renumber:0
495-#: field:wizard.renumber,journal_ids:0
496-msgid "Journals"
497-msgstr "Diarios"
498-
499-#. module: account_renumber
500-#: view:wizard.renumber:0
501-msgid "Journals and periods to consider"
502-msgstr "Diarios y periodos a considerar"
503-
504-#. module: account_renumber
505-#: selection:wizard.renumber,state:0
506-msgid "Initial"
507-msgstr "Initial"
508-
509-#. module: account_renumber
510-#: help:wizard.renumber,journal_ids:0
511-msgid "Journals to renumber"
512-msgstr "Diarios a renumerar"
513-
514-#. module: account_renumber
515-#: view:wizard.renumber:0
516-msgid "Renumber Account Moves"
517-msgstr "Renumerar asientos contables"
518-
519-#. module: account_renumber
520-#: code:addons/account_renumber/wizard/wizard_renumber.py:197
521-#, python-format
522-msgid "Renumbered account moves"
523-msgstr "Asientos contables renumerados"
524-
525-#. module: account_renumber
526-#: model:ir.model,name:account_renumber.model_wizard_renumber
527-msgid "wizard.renumber"
528-msgstr ""
529-
530-#. module: account_renumber
531-#: code:addons/account_renumber/wizard/wizard_renumber.py:139
532-#, python-format
533-msgid "No Data Available"
534-msgstr "No Data Available"
535-
536-#. module: account_renumber
537-#: view:wizard.renumber:0
538-msgid "General Data"
539-msgstr "Datos Generales"
540-
541-#. module: account_renumber
542-#: view:wizard.renumber:0
543-msgid "This wizard will help you renumber entries in one or more journals."
544-msgstr ""
545-
546-#. module: account_renumber
547-#: view:wizard.renumber:0
548-msgid "sequential numbers using their journal sequence."
549-msgstr ""
550-
551-#. module: account_renumber
552-#: code:addons/account_renumber/wizard/wizard_renumber.py:140
553-#, python-format
554-msgid "No records found for your selection!"
555-msgstr "No records found for your selection!"
556-
557-#. module: account_renumber
558-#: view:wizard.renumber:0
559-msgid ""
560-"Posted moves from those journals will be sorted by date and then assigned"
561-msgstr ""
562-
563-#. module: account_renumber
564-#: view:wizard.renumber:0
565-#: field:wizard.renumber,period_ids:0
566-msgid "Periods"
567-msgstr "Periodos"
568-
569-#. module: account_renumber
570-#: view:wizard.renumber:0
571-msgid "Cancel"
572-msgstr "Cancelar"
573-
574-#. module: account_renumber
575-#: help:wizard.renumber,number_next:0
576-msgid "Journal sequences will start counting on this number"
577-msgstr "Las secuencias de los diarios empezarán a contar en este número"
578
579=== modified file 'account_renumber/wizard/wizard_renumber.py'
580--- account_renumber/wizard/wizard_renumber.py 2013-09-28 16:58:23 +0000
581+++ account_renumber/wizard/wizard_renumber.py 2014-05-05 16:20:48 +0000
582@@ -19,37 +19,32 @@
583 # along with this program. If not, see <http://www.gnu.org/licenses/>.
584 #
585 ##############################################################################
586-
587-"""
588-Account renumber wizard
589-"""
590-
591-from openerp.osv import fields
592-from openerp.osv import orm
593+from openerp.osv import fields, orm
594 from openerp.tools.translate import _
595+from openerp import SUPERUSER_ID
596 import logging
597
598-
599 class wizard_renumber(orm.TransientModel):
600 _name = "wizard.renumber"
601+ _description = "Account renumber wizard"
602 _columns = {
603- 'journal_ids': fields.many2many('account.journal', 'account_journal_wzd_renumber_rel',
604+ 'journal_ids': fields.many2many('account.journal',
605+ 'account_journal_wzd_renumber_rel',
606 'wizard_id', 'journal_id',
607 required=True,
608 help="Journals to renumber",
609 string="Journals"),
610- 'period_ids': fields.many2many('account.period', 'account_period_wzd_renumber_rel',
611- 'wizard_id', 'period_id',
612- required=True,
613- help='Fiscal periods to renumber',
614- string="Periods", ondelete='null'),
615- 'number_next': fields.integer('First Number', required=True,
616- help="Journal sequences will start counting on this number"),
617- 'state': fields.selection([
618- ('init', 'Initial'),
619- ('renumber', 'Renumbering')
620- ], readonly=True)
621- }
622+ 'period_ids': fields.many2many('account.period',
623+ 'account_period_wzd_renumber_rel',
624+ 'wizard_id', 'period_id',
625+ required=True,
626+ help='Fiscal periods to renumber',
627+ string="Periods", ondelete='null'),
628+ 'number_next': fields.integer('First Number', required=True,
629+ help="Journal sequences will start counting on this number"),
630+ 'state': fields.selection([('init', 'Initial'),
631+ ('renumber', 'Renumbering')], readonly=True)
632+ }
633
634 _defaults = {
635 'number_next': 1,
636@@ -60,17 +55,15 @@
637 # Helper methods
638 ###############################
639
640- def get_sequence_id_for_fiscalyear_id(self, cr, uid, sequence_id, fiscalyear_id, context=None):
641+ def get_sequence_id_for_fiscalyear_id(self, cr, uid, sequence_id,
642+ fiscalyear_id, context=None):
643 """
644 Based on ir_sequence.get_id from the account module.
645 Allows us to get the real sequence for the given fiscal year.
646 """
647- sequences = self.pool.get('ir.sequence').browse(
648- cr,
649- uid,
650- sequence_id,
651- context=context)
652- for line in sequences.fiscal_ids:
653+ sequence = self.pool['ir.sequence'].browse(cr, uid, sequence_id,
654+ context=context)
655+ for line in sequence.fiscal_ids:
656 if line.fiscalyear_id.id == fiscalyear_id:
657 return line.sequence_id.id
658 return sequence_id
659@@ -79,92 +72,71 @@
660 # Renumber form/action
661 ##########################################################################
662
663- def renumber(self, cr, uid, ids, context):
664+ def renumber(self, cr, uid, ids, context=None):
665 """
666 Action that renumbers all the posted moves on the given
667 journal and periods, and returns their ids.
668 """
669 logger = logging.getLogger("account_renumber")
670- obj = self.browse(cr, uid, ids[0])
671-
672- period_ids = [x.id for x in obj.period_ids]
673- journal_ids = [x.id for x in obj.journal_ids]
674- number_next = obj.number_next or 1
675-
676+ form = self.browse(cr, uid, ids[0], context=context)
677+ period_ids = [x.id for x in form.period_ids]
678+ journal_ids = [x.id for x in form.journal_ids]
679+ number_next = form.number_next or 1
680 if not (period_ids and journal_ids):
681- raise orm.except_orm(
682- _('No Data Available'),
683+ raise orm.except_orm(_('No Data Available'),
684 _('No records found for your selection!'))
685-
686 logger.debug("Searching for account moves to renumber.")
687- move_facade = self.pool.get('account.move')
688- obj_sequence = self.pool.get('ir.sequence')
689+ move_obj = self.pool['account.move']
690+ sequence_obj = self.pool['ir.sequence']
691 sequences_seen = []
692 for period in period_ids:
693- move_ids = move_facade.search(
694- cr,
695- uid,
696- [
697- ('journal_id', 'in', journal_ids),
698- ('period_id', '=', period),
699- ('state', '=', 'posted')],
700- limit=0, order='date,id',
701- context=context)
702- if len(move_ids) == 0:
703+ move_ids = move_obj.search(cr, uid,
704+ [('journal_id', 'in', journal_ids),
705+ ('period_id', '=', period),
706+ ('state', '=', 'posted')],
707+ limit=0, order='date,id',
708+ context=context)
709+ if not move_ids:
710 continue
711-
712- for move in move_facade.browse(cr, uid, move_ids):
713-
714+ logger.debug("Renumbering %d account moves." % len(move_ids))
715+ for move in move_obj.browse(cr, uid, move_ids, context=context):
716 sequence_id = self.get_sequence_id_for_fiscalyear_id(
717- cr,
718- uid,
719+ cr, uid,
720 sequence_id=move.journal_id.sequence_id.id,
721 fiscalyear_id=move.period_id.fiscalyear_id.id)
722 if not sequence_id in sequences_seen:
723- self.pool.get('ir.sequence').write(
724- cr,
725- uid,
726- [sequence_id],
727- {'number_next': number_next})
728+ sequence_obj.write(cr, SUPERUSER_ID, [sequence_id],
729+ {'number_next': number_next})
730 sequences_seen.append(sequence_id)
731- #
732 # Generate (using our own get_id) and write the new move number
733- #
734 c = {'fiscalyear_id': move.period_id.fiscalyear_id.id}
735- new_name = obj_sequence.next_by_id(
736- cr,
737- uid,
738- move.journal_id.sequence_id.id,
739- c)
740+ new_name = sequence_obj.next_by_id(cr,uid,
741+ move.journal_id.sequence_id.id, context=c)
742 # Note: We can't just do a
743- # "move_facade.write(cr, uid, [move.id], {'name': new_name})"
744+ # "move_obj.write(cr, uid, [move.id], {'name': new_name})"
745 # cause it might raise a
746 #"You can't do this modification on a confirmed entry"
747 # exception.
748 cr.execute('UPDATE account_move SET name=%s WHERE id=%s',
749- (new_name, move.id))
750- logger.debug("%d account moves renumbered." % len(move_ids))
751- logger.debug("Renumbering %d account moves." % len(move_ids))
752+ (new_name, move.id))
753+ logger.debug("%d account moves renumbered." % len(move_ids))
754 sequences_seen = []
755- obj.write({'state': 'renumber'})
756-
757- view_ref = self.pool.get('ir.model.data').get_object_reference(
758- cr,
759- uid,
760- 'account',
761- 'view_move_tree')
762+ form.write({'state': 'renumber'})
763+ data_obj = self.pool['ir.model.data']
764+ view_ref = data_obj.get_object_reference(cr, uid, 'account',
765+ 'view_move_tree')
766 view_id = view_ref and view_ref[1] or False,
767 res = {
768 'type': 'ir.actions.act_window',
769 'name': _("Renumbered account moves"),
770 'res_model': 'account.move',
771- 'domain': "[('journal_id','in',%s), ('period_id','in',%s), ('state','=','posted')]" % (repr(journal_ids), repr(period_ids)),
772+ 'domain': ("[('journal_id','in',%s), ('period_id','in',%s), "
773+ "('state','=','posted')]"
774+ % (journal_ids, period_ids)),
775 'view_type': 'form',
776 'view_mode': 'tree',
777 'view_id': view_id,
778 'context': context,
779 'target': 'current',
780- }
781+ }
782 return res
783-
784-wizard_renumber()
785
786=== modified file 'account_renumber/wizard/wizard_renumber_view.xml'
787--- account_renumber/wizard/wizard_renumber_view.xml 2013-09-28 15:40:31 +0000
788+++ account_renumber/wizard/wizard_renumber_view.xml 2014-05-05 16:20:48 +0000
789@@ -1,48 +1,51 @@
790 <?xml version="1.0" encoding="utf-8"?>
791 <openerp>
792- <data>
793-
794- <record id="view_account_renumber_form" model="ir.ui.view">
795- <field name="name">account_renumber.form</field>
796- <field name="model">wizard.renumber</field>
797- <field name="arch" type="xml">
798- <form string="Renumber Account Moves" version="7.0">
799- <field name="state" invisible="1" />
800- <p>This wizard will help you renumber entries in one or more journals.</p>
801- <p>Posted moves from those journals will be sorted by date and then assigned</p>
802- <p>sequential numbers using their journal sequence.</p>
803- <group string="General Data">
804- <field name="number_next"/>
805- </group>
806- <group string="Journals and periods to consider">
807- <notebook colspan="4">
808- <page string="Journals">
809- <field name="journal_ids" editable="top"/>
810- </page>
811- <page string="Periods">
812- <field name="period_ids" editable="top"/>
813- </page>
814- </notebook>
815- </group>
816- <footer>
817- <div states="init">
818- <button name="renumber" string="Renumber" type="object" class="oe_highlight"/>o
819- <button special="cancel" string="Cancel" class="oe_link"/>
820- </div>
821- </footer>
822- </form>
823- </field>
824- </record>
825- <record id="action_account_renumber" model="ir.actions.act_window">
826- <field name="name">Renumber journal entries</field>
827- <field name="res_model">wizard.renumber</field>
828- <field name="view_type">form</field>
829- <field name="view_mode">form</field>
830- <field name="view_id" ref="view_account_renumber_form" />
831- <field name="target">new</field>
832- </record>
833- <menuitem id="menu_account_renumber" parent="account.menu_account_end_year_treatments"
834- action="action_account_renumber" groups="base.group_system" sequence="-1" />
835-
836- </data>
837+ <data>
838+
839+ <record id="view_account_renumber_form" model="ir.ui.view">
840+ <field name="name">account_renumber.form</field>
841+ <field name="model">wizard.renumber</field>
842+ <field name="arch" type="xml">
843+ <form string="Renumber Account Moves" version="7.0">
844+ <field name="state" invisible="1" />
845+ <p>This wizard will help you renumber entries in one or more journals.</p>
846+ <p>Posted moves from those journals will be sorted by date and then assigned sequential numbers using their journal sequence.</p>
847+ <group string="General Data">
848+ <field name="number_next"/>
849+ </group>
850+ <group string="Journals and periods to consider">
851+ <notebook colspan="4">
852+ <page string="Journals">
853+ <field name="journal_ids" editable="top"/>
854+ </page>
855+ <page string="Periods">
856+ <field name="period_ids" editable="top"/>
857+ </page>
858+ </notebook>
859+ </group>
860+ <footer>
861+ <div states="init">
862+ <button name="renumber" string="Renumber" type="object" class="oe_highlight"/>
863+ or
864+ <button special="cancel" string="Cancel" class="oe_link"/>
865+ </div>
866+ </footer>
867+ </form>
868+ </field>
869+ </record>
870+ <record id="action_account_renumber" model="ir.actions.act_window">
871+ <field name="name">Renumber journal entries</field>
872+ <field name="res_model">wizard.renumber</field>
873+ <field name="view_type">form</field>
874+ <field name="view_mode">form</field>
875+ <field name="view_id" ref="view_account_renumber_form" />
876+ <field name="target">new</field>
877+ </record>
878+ <menuitem id="menu_account_renumber"
879+ parent="account.menu_account_end_year_treatments"
880+ action="action_account_renumber"
881+ sequence="-1"
882+ groups="account.group_account_manager"/>
883+
884+ </data>
885 </openerp>

Subscribers

People subscribed via source and target branches