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

I'm creating payment for invoice and facing this error for all invoices:

The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it- creation/update: a mandatory field is not correctly set

[object with reference: account_id - account.id]


can someone guide me to solve this issue?

อวตาร
ละทิ้ง

This error sometime come because you create relational field with same name and different relation model

Post your Code and we will be able to help you

คำตอบที่ดีที่สุด

This means you did not correctly set or did not set a value to account_id while creating payment.

Check create method in account.payment for more details

อวตาร
ละทิ้ง

If you need more help. Please post your code

คำตอบที่ดีที่สุด

I think the problem with journal, please check any account added to journal default accounts or not.

Here journal means payment method

อวตาร
ละทิ้ง

I'd not set "Default Debit and Credit Accounts" in Invoicing>Configuration>Accounting>Journals>Select appropriate Journal>Edit

คำตอบที่ดีที่สุด


Hi Mohammed, I have the same error and I checked the account.payment table and odoo created a record with the payment    but still have this error. what else could be the error?

Thanks in advanced!


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

Hi, 

If you are creating invoice, you should take note that the account.invoice has a compulsory field of account_id and the account.invoice.line has a compulsory field of account_id, but of them must have a value when trying to create.

The payment module, just has journal, so you might not really have to worry about account_id, so your account_id issue is coming from account.invoice and account.invoice.line

This might help:

account_inv = self.env['account.invoice'].create({
'partner_id': partner_id.id,
'journal_id': journal_id.id,
'origin': sale_order.name,
'account_id': your_account_id.id,
'invoice_line_ids': [(0, 0, {'product_id': product_id, 'name': name,
'product_uom_qty': product_uom_qty,
'price_unit': price,
'account_id':account_id.id,

}
)],

})


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

Hi Mohammed, I have the same error and I checked the account.payment table and odoo created a record with the payment    but still have this error. what else could be the error?

Thanks in advanced!

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 17
3406
0
มี.ค. 15
4303
User Error when Confirming Invoice แก้ไขแล้ว
2
มี.ค. 23
4239
0
ส.ค. 20
2675
1
มิ.ย. 19
2654