Odoo Help


Registering a payment "trying to delete or mandatory field not set - account_id" error

Ernesto Fabian Rodriguez Coimbra
on 7/21/16, 7:02 PM 1,076 views


I've updated my chart of account an now I get this error when trying to register a payment:

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]

On 10/9/16, 3:31 AM

The same error still in odoo 10 community and enterprise when register a customer payment, while no problem when registering vendor payment.

the workaround is as following

  1. click radio button "send money"  as new payment type

  2. select a valid vendor from the parnter dropdown list

  3. click radio button "receive money" - restore the oginal option

  4. select a valid customer fromthe partner dropdown list

  5. fill in other mandatory fields, then you can Validate the payment without any error

this bug is caused by 2 duplicate partner_id field used in the form view definion,

<field name="partner_id" nolabel="1" attrs="{'required': [('partner_type', '=', 'customer')], 
'invisible': [('partner_type', '!=', 'customer')],
'readonly': [('state', '!=', 'draft')]}"
context="{'default_is_company': True, 'default_customer': True}"
domain = "[('customer', '=', True)]"/>
<field name="partner_id" nolabel="1" attrs="{'required': [('partner_type', '=', 'supplier')],
'invisible': [('partner_type', '!=', 'supplier')],
'readonly': [('state', '!=', 'draft')]}"
context="{'default_is_company': True, 'default_supplier': True}"
domain = "[('supplier', '=', True)]"/>

the first partner_id field in the form did not trigger onchange event as expected, which resulted in the missing of required field destination_account_id ( the accounts receivable from product form )  in generated account move line object, this account_id should be derived via compute method "_compute_destination_account_id" based on partner_id, payment type and partner type.

seems that the current web client can not properly handle the case of same field defined more than 1 time in the same form view, there is no easier way to find the final solution.

my suggested solution is to split the two register payment forms, one for vendor payment, and the other for customer payment, in each form only one partner_id to be used.

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/21/16, 7:02 PM
Seen: 1076 times
Last updated: 10/9/16, 1:34 PM