XML RPC add a date
<p>im trying to import salesorder from excel then insert them in sales order odoo</p>

<p>for now im trying to add the sales order then later i will add the order lines</p>

<pre><code>import psycopg2
import psycopg2.extras
import pyexcel_xls
import pyexcel as pe
from pyexcel_xls import get_data
from datetime import datetime
import xmlrpclib
import json

url = 'http://localhost:8070'
db = 'Docker'
username = 'admin'
password = 'odoo'
#data = get_data("salesorder.xls")
#print(json.dumps(data))
records = pe.get_records(file_name="salesorder.xls")
for record in records:
    print record['name']
    names = record['name']
    print record['location']
    print record['zip']
    print record['republic']
    dates = record['date']
    print dates
    print datetime.strptime(dates,'%d/%M/%Y')
    lastdat=datetime.strptime(dates,'%d/%M/%Y')


    common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url))
    output = common.version()
    uid = common.authenticate(db, username, password, {})
    print output
    models = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(url))
    models.execute_kw(db, uid, password,
        'res.partner', 'search',
        [[['is_company', '=', True], ['customer', '=', True]]])

    id = models.execute_kw(db, uid, password, 'sales.order', 'create',             [{
        'name': "names",
        'validity_date':lastdat
        #'payment_term_id':"15"

    }])
    print id
</code></pre>

<p>the error im getting is on the 40th line the one with validity_date</p>

<p>You have to use Odoo's date format for using dates. It's the ISO 8601 international date format:  <code>YYYY-MM-DD</code>.</p>

python web-services openerp xml-rpc odoo-9