OpenERP : Saving field value (amount) into an account
-
25-06-2021 - |
Domanda
I'm new to OpenERP and python and I need some help saving an amount into a particular account. I have created a field in the invoice form that calculates a specific amount based on some code and displays that amount in the field. What I want to do is to associate an account with this field, so when the invoice is validated and/or payed, this amount is saved into an account and later on I can see it in the journal entries and/or chart of account. Any idea how to do that ?
Soluzione
You can override "pay_and_reconcile" function to write in account field, this function is called at time of Pay.
action_date_assign()
action_move_create()
action_number()
this 3 function are called at time of validating invoice. You can override any one from this or you can add your own function . in workflow for the "open" activity.
Altri suggerimenti
You should override the write method of the invoice. Have a look at other addons on how to do that (you can find a lot of example using
grep -r "def write" *
inside the addons' folder.