In below example, I have written Python script to amount interest provision in accounting. Use below python code in your .py file : 
  if demand.amount_interest:
                cfpline_obj.create(cr, uid, {
                    'origin': demand._name + ',' + str(demand.id),
                    'description': (demand.description and (demand.description + ' - ') or '') + _('Interest Amount'),
                    'state': 'confirm',
                    'journal_id': demand.journal_id.id,
                    'val_date': demand.interest_payment == 'pre' and demand.date_start or demand.date_stop,  
                    'amount': demand.type == 'loan' and -demand.amount_interest or demand.amount_interest,
                    'cashflow_code_id': demand.cfc_id_interest.id,
                    }, context=context)
                       
                    
0 Comment(s)