-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodificar_0001.py
38 lines (29 loc) · 986 Bytes
/
modificar_0001.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import csv
import xmlrpclib
import re
HOST='190.14.253.255'
PORT=8069
DB='db'
USER='[email protected]'
PASS='1234120'
url ='http://%s:%d/xmlrpc/' % (HOST,PORT)
common_proxy = xmlrpclib.ServerProxy(url+'common')
object_proxy = xmlrpclib.ServerProxy(url+'object')
uid = common_proxy.login(DB,USER,PASS)
def _update_mass(estado):
if estado is True:
cont = 1
product = object_proxy.execute(DB,uid,PASS,'product.template','search',[('active','=',True)])
for id in product:
do_write = object_proxy.execute(DB,uid,PASS,'product.template', 'write',id, {'default_code':cont})
do_write2 = object_proxy.execute(DB,uid,PASS,'product.template', 'write',id, {'warranty':10})
if do_write:
print "OK:",cont
cont = cont + 1
print "Contador:",cont
def __main__():
print 'Ha comenzado el proceso'
_update_mass(True)
print 'Ha finalizado la carga tabla'
__main__()