Hello, I'm trying to raise a warning in a module I'm developing, but when it raises the warning, I got this traceback:
Traceback (most recent call last): File "/trytond/protocols/jsonrpc.py", line 123, in _marshaled_dispatch response['result'] = dispatch_method(method, params) File "/trytond/protocols/jsonrpc.py", line 156, in _dispatch res = dispatch(*args) File "/trytond/protocols/dispatcher.py", line 171, in dispatch result = rpc.result(meth(inst, *c_args, **c_kwargs)) File "/trytond/modules/carrier_zip/sale.py", line 47, in on_change_carrier 'zip_unavailable', (shipment_zip, carrier.party.rec_name)) File "/trytond/error.py", line 97, in raise_user_warning if Warning_.check(warning_name): File "/trytond/res/user.py", line 582, in check cls.delete([x for x in warnings if not x.always]) File "/trytond/model/modelsql.py", line 849, in delete cursor.execute(*table.delete(where=red_sql)) File "/trytond/backend/postgresql/database.py", line 307, in execute return self.cursor.execute(sql, params) InternalError: cannot execute DELETE in a read-only transaction I've read the documentation [1], but I can't figure out what I'm doing wrong. Here is my code: def on_change_carrier(self): res = super(Sale, self).on_change_carrier() shipment_zip = self.shipment_address and self.shipment_address.zip carrier = self.carrier if (carrier and shipment_zip): for price in carrier.zip_price_lists: if (int(price.start_zip_code) <= int(shipment_zip) <= int(price.end_zip_code)): break else: self.raise_user_warning('%s.on_change_carrier' % self, 'zip_unavailable', (shipment_zip, carrier.party.rec_name)) return res Can someone help me please? [1] http://doc.tryton.org/2.8/trytond/doc/ref/models/models.html?highlight=raise_user_warning#trytond.model.Model.raise_user_warning