Income account disappears

please can someone help me?
I created a custom script that sets the value of the “income_account” field of the “items” child table of “Invoice Item doctype” when selecting an “item_code”. the script worked, so the ‘income_account’ appeared with the value I set, but after a while its value was replaced with that of the company’s ‘default income account’. Thank you in advance for your answers


Could you please share your script?

Try to change item_code to be before_save

I used item_code as a trigger because I want when adding or modifying an item, we no longer need to select the income account. ** before_save** does not work.
thank you for trying to help me.

already solved