Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ

I currently have an automated rule that cancels all pickings created from the Point of Sale. However, now I want to extend this functionality to delete the picking orders once they are canceled.

I created a new automation rule and added the following server action:


However, I’m encountering an issue when trying to delete the picking records, as it sometimes shows errors like The record does not exist or has already been deleted. I suspect it’s due to dependencies or processes tied to the picking orders.

Could anyone advise how to safely delete canceled picking orders, or how to troubleshoot this issue? Is there a better approach to achieve this in Odoo?

Thank you for your help!

# Iterate over the records that trigger the rule
for record in records:
    # Check if the record exists
    if record.exists():
        _logger.info(f"Processing record: {record.name} with status {record.state}")
        # If the record is in 'cancel' state, delete it
        if record.state == 'cancel':
            record.unlink()
            _logger.info(f"Record {record.name} has been automatically deleted.")
        else:
            _logger.info(f"Record {record.name} is in status '{record.state}', no action taken.")
    else:
        _logger.warning("The record does not exist or has already been deleted.")
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ธ.ค. 24
1043
Odoo 17 - Show new field in POS receipt แก้ไขแล้ว
1
ส.ค. 24
2880
0
พ.ย. 16
3541
0
ก.ค. 24
1016
2
ส.ค. 25
111