Odoo 8 删除订单行按钮
我尝试用这个方法删除名为“Services”的行,但没有成功Odoo 8 删除订单行按钮,odoo-8,odoo,Odoo 8,Odoo,我尝试用这个方法删除名为“Services”的行,但没有成功 @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)]
@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)]
})
试试这个
@api.multi
def remove_line(self):
for rec in self:
for line in rec.order_line:
if line.name == 'Services':
line.unlink()
试试这个
@api.multi
def remove_line(self):
for rec in self:
for line in rec.order_line:
if line.name == 'Services':
line.unlink()
如果您想使用cammand进行此操作,请执行以下操作:
# update the record it self
self.write({
# update the one2many field and remove the current line in for loop
'order_line': [(3, line.id)]
})
只有一个2多个或多个2多个接受cammand line如果您想使用cammand执行此操作,请按以下方式执行:
# update the record it self
self.write({
# update the one2many field and remove the current line in for loop
'order_line': [(3, line.id)]
})
只有一个或多个接受cammand行表单视图中的its in sale.order。表单视图中的its in sale.order。