我创建了一个向导,该向导会更改每种产品的价格和数量,但不收税的金额,税额和总金额不变,日记帐分录不平衡。如何解决?
您应该在每个更改的发票行(型号_onchange_price_subtotal()
)上调用account.move.line
以触发重新计算。重新计算仅针对视图中的更改实施,因此使用向导时不会触发重新计算。但是该实现也可以在向导中使用,没有任何问题。
strong text _ onchange_price_subtotal无效。但是
current_invoice_lines = rec.order_id.line_ids.filtered(lambda line: not line.exclude_from_invoice_tab)
others_lines = rec.order_id.line_ids - current_invoice_lines
if others_lines and current_invoice_lines - rec.order_id.invoice_line_ids:
others_lines[0].recompute_tax_line = True
rec.order_id.line_ids = others_lines + rec.order_id.invoice_line_ids
rec.order_id._onchange_recompute_dynamic_lines()
在account.move上添加以上代码后...日记帐分录是平衡的,但是tax_amount仍保持不变?