How to do it ?:
def check_code(self):
print '== Check postcode =================================================================='
code_check = self.env['post.coder'].search([('postcode','=',self.buyer_postcode)])# reading code, if code exist
it show me the code correctly, If code doesn't exist False is printed on screen. So now i would like to update record and add street name where the code is or if code not exist in database add new record.
if code_check is False:
# this condition apparently doesn't work
print 'Post code:', code_check.postcode
else:
#execute(""" UPDATE post_coder SET street = %s WHERE postcode = %s""" %(self.buyer_address_1,self.buyer_postcode))
print ' Post code updated'
How using non python query add or update record in table ?