1
# -*- coding: utf-8 -*-
2
# -*- encoding: utf-8 -*-
3
##############################################################################
5
# OpenERP - Account renumber wizard
6
# Copyright (C) 2009 Pexego Sistemas Informáticos. All Rights Reserved
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation, either version 3 of the License, or
12
# (at your option) any later version.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
##############################################################################
25
Script that creates large amounts of account moves on different days,
26
that can be used later for testing the renumber wizard.
28
__author__ = "Borja López Soilán (Pexego)"
35
logger = netsvc.Logger()
37
def create_lots_of_account_moves(dbname, user, passwd, howmany):
39
Small OpenERP function that will create lots of account moves
40
on the selected database, that can later be used for
41
testing the renumber wizard.
42
Note: The database must have demo data, and a fiscal year 2009 created.
44
url_template = "http://%s:%s/xmlrpc/%s"
49
login_facade = xmlrpclib.ServerProxy(url_template % (server, port, 'common'))
50
user_id = login_facade.login(dbname, user, passwd)
51
object_facade = xmlrpclib.ServerProxy(url_template % (server, port, 'object'))
54
for i in range(1, howmany):
56
# Create one account move
58
move_id = object_facade.execute(dbname, user_id, passwd,
59
'account.move', 'create', {
61
'type': 'journal_voucher',
65
'analytic_account_id': False,
72
'date_maturity': False,
74
'amount_currency': False,
79
'analytic_account_id': False,
86
'date_maturity': False,
88
'amount_currency': False,
93
'date': '2009-01-%s' % ((i % 31) or 1),
100
object_facade.execute(dbname, user_id, passwd,
101
u'account.move', 'button_validate', [move_id], {})
103
# ------------------------------------------------------------------------
104
# ------------------------------------------------------------------------
105
# ------------------------------------------------------------------------
107
if __name__ == "__main__":
108
if len(sys.argv) < 5:
109
logger.notifyChannel(u"Usage: %s <dbname> <user> <password> <howmany>" % sys.argv[0])
111
create_lots_of_account_moves(sys.argv[1], sys.argv[2], sys.argv[3], int(sys.argv[4]))