Odoo Help

Welcome!

This community 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.

0

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

By
Ernesto Fabian Rodriguez Coimbra
on 7/21/16, 7:02 PM 315 views

Hello,

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]

0
fisher
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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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