0

我创建了一个向导,可以更改每种产品的价格和数量,但 amount_untaxed、tax_amount 和总金额不变,并且日记帐分录不平衡。如何解决?

4

2 回答 2

0

您应该调用_onchange_price_subtotal()每个更改的发票行(模型account.move.line)来触发重新计算。仅针对视图中的更改实施重新计算,这就是使用向导时不会触发它的原因。但是该实现也可以在向导中使用,没有任何问题。

于 2020-02-06T13:32:40.057 回答
0

强文本_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 仍保持不变?

于 2020-02-09T06:54:30.887 回答