Skip to Content
Menu
This question has been flagged
1 Reply
4160 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]

Avatar
Discard
Best Answer

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.

Avatar
Discard