Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2845 มุมมอง
def action_new_quotation(self):
action = super(CrmLead, self).action_new_quotation()
vals = [fields.Command.clear()]
for order in self.order_line_ids:
order.ensure_one()
vals.append(fields.Command.create({
'product_id': order.product_id.id,
'name': order.name,
'product_uom_qty': order.product_uom_qty,
'price_unit': order.price_unit,
'price_subtotal': order.price_subtotal,
}))
if action and 'context' in action:
action['context'].update({
'default_order_line': vals,
})
return action

Although values are successfully passed, the sale.order.line fails to capture the details. Interestingly, when the same values are passed to another custom One2many field in sale.order, the data is captured. Any insights or suggestions on this matter?

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

This issue is because there is a base function within the sale.order responsible for transmitting values to the order_line.


To transmit default values to the sale.order.line, it's necessary to override the underlying function in the base code. This function, by default, clears existing entries in the order_line when loaded or inherits values from the quotation template.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thank you it works.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to generate line numbers on quotes แก้ไขแล้ว
1
ม.ค. 25
3563
2
ส.ค. 24
5907
6
ธ.ค. 22
8903
1
ต.ค. 15
5249
1
พ.ค. 25
6256