how can I stop a button from calling the write function?

Viewed 597

I create a button on a form and a function, my problem the button calls the write function thing that i don't want because all what i want is that it changes the value of another field

    @api.multi
    def write_paid(self):
        self.state_money = "paid" 

EDIT:

my write method:

   @api.multi
    def write(self, vals):
        Initial=self.Amount
        New=vals['Amount_entered']
        res=super(Myclass, self).write(vals)
        if vals['Amount_entered'] > 0:
            vals['Amount_date'] = fields.Datetime.now()
            vals['Amount']= Initial + vals['Amount_entered']
            res=super(MedicalLab, self).write(vals)
            record=self.browse(self.ids[0])
            self.env['journal'].create({

1 Answers
Related