Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1561 มุมมอง
def process_invoice(self):
self = self.with_user(SUPERUSER_ID)
order_ids = self.order_ids.filtered(lambda order: order.state == 'draft')
for order in order_ids:
order.action_confirm()
moves = order._create_invoices(final=False)
for move in moves:
new_quantity = 1
new_price_unit = 200
for line in move.invoice_line_ids:
line.update(line._get_price_total_and_subtotal(quantity=new_quantity,price_unit=new_price_unit))
price_subtotal = line._get_price_total_and_subtotal(quantity=new_quantity,price_unit= new_price_unit).get('price_subtotal')
line.update(line._get_fields_onchange_balance(quantity=new_quantity, price_subtotal=price_subtotal, force_computation=True))

How to use 

_get_price_total_and_subtotal

and

_get_fields_onchange_balance

to write 'quantity' or 'price_unit'?

Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi , in your previous question i have updated the answer and i encountered the same error as you and work, please check

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,
Pass check_move_validity as True in the context and see if it makes any difference.

Sample:

move.with_context(check_move_validity=False)._onchange_currency()


Also you can trigger the function _recompute_dynamic_lines
Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
เม.ย. 23
2400
1
ต.ค. 22
3870
1
ม.ค. 25
1452
2
ม.ค. 24
1638
4
ม.ค. 24
3474