Search code examples
odoo-8odoo

Remove order line button


I try to remove line with name "Services" with this method, but no luck.

    @api.multi
    def remove_line(self):
         for line in self.order_line:
            if line.name == 'Services':
                self.order_line.write({
                       'line': [(3, self.product_id.id)]
                    })

Solution

  • Try this

    @api.multi
    def remove_line(self):
        for rec in self:
            for line in rec.order_line:
                if line.name == 'Services':
                    line.unlink()