Hello,

I am using Tryton 3.4 and i try to add a product supplier for a product via 
proteus.

Everything is going smooth and i take no errors. But for the currency (even 
if my app's log tells i have pass the correct one) in Tryton i get the 
default currency of my company...

For example I create a product supplier which I want him to use USD, in my 
Tryton it passes like EUR. As my default companies currency.

This is my code:

def add_supplier(c_dict):
    product_id = c_dict['product']
    print 'add_supplier:', c_dict
    print 'product_id:', product_id

    obj = Model.get('product.template')
    pprint(obj)
    rv = obj.find([('id', '=', product_id)])
    pprint(rv)
    product = rv[0]

    pprice = Model.get('purchase.product_supplier')
    pp = pprice()
    pp.delivery_time = c_dict['delivery_time']
    pp.product = product
    pp.currency = c_dict['currency']
    pp.party = c_dict['party']
    pp.name = c_dict['name']
    pp.code = c_dict['code']
    res = pp.save()
    return res

And this is the printed output:

add_supplier: {'delivery_time': 1, 'product': 1632, 'code': u'PL-08', 
'name': u'PL-08', 'currency': proteus.Model.get('currency.currency')(152), 
'party': proteus.Model.get('party.party')(4182)}
product_id: 1632

Reply via email to