跳至内容
菜单
此问题已终结
2 回复
1242 查看

if i can change value of tax_id in order line than its value i want it will be also change in all order line 

please help me to out of ths

形象
丢弃
最佳答案

try this way it definitely worked :

classSaleOrderLine(models.Model): 

_inherit = 'sale.order.line'

@api.onchange('tax_id')
def _onchange_tax_id(self):
if self.order_id.order_line:
for line in self.order_id.order_line:
origin_line = line._origin
origin_line.tax_id = [(6, 0, self.tax_id.ids)]

形象
丢弃
最佳答案

Hi, 
You can use the on-change functionality. 

For example:


class SaleOrder(models.Model):
    _inherit = 'sale.order'

    @api.onchange('tax_id')
    def _onchange_tax_id(self):
        for line in self.order_line:
            line.tax_id = self.tax_id

Hope it helps

形象
丢弃