Hi,
I extended for a customer the product_template. Now I want to save all
changes made by the user. Here is my setup:
SaleLine extension:
customs_tariff_number = fields.Char('Customs Tariff No.',
states={
'invisible': Eval('type') != 'line'},
on_change=['customs_tariff_number',
'product'],
depends=['type']
)
def on_change_customs_tariff_number(self, vals):
product_obj = Pool().get('product.product')
product_id = vals.get('product')
if product_id:
product = product_obj.browse(product_id)
p_template = product.template
p_template.write(p_template.id, {
'customs_tariff_number': vals.get('customs_tariff_number')
})
return vals
and the product template:
customs_tariff_number = fields.Char('Customs Tariff No.')
All I get is:
sql:Wrong SQL: UPDATE "product_template" SET "customs_tariff_number" =
'986543',write_uid = 1,write_date = '2013-03-28T12:02:54.181374'::timestamp
WHERE ((id IN (1)))
The error occurs in trytond/backend/postgresql/database.py for:
res = self.cursor.execute(sql, params)
with:
(Pdb) sql
'UPDATE "product_template" SET "customs_tariff_number" = %s,write_uid =
%s,write_date = %s WHERE ((id IN (%s)))'
(Pdb) params
[u'986543', 1, datetime.datetime(2013, 3, 28, 12, 2, 54, 181374), 1]
Funny thing is, if I try the sql statement in pgAdmin3 everything works
like expected.
Where is my mistake? What should I check?
I hope someone can help me,
Matthias Kracke