Hello, I have a function that works well but I want to call this function in another function which is defined in controllers. Am trying to create a record from a mobile app thus the create function in the controller needs to trigger another function in my custom module. How can I achieve this??.
Thank you in Advance
Please share your code you are working with so that we can help you further.
class LoanPaymentInherit(http.Controller):
@http.route('/create_payments',auth='user',type='json',csrf=False,method=['POST'])
def create_payment(self, **kw):
# move_id=pragtech_loan.post()
# _logger.error('testing')
# _logger.error(move_id)
data = json.loads(request.httprequest.data)
new_payment_request = http.request.env['account.loan.repayment'].sudo().create(data)
print(new_payment_request,"DDDDDDDDDDDDDDDDDDDDAAAAAAAAAAAAAAAAAAAAAAAAATTTTTTTTTTTTTTTTAAAAAAAAAAAAAAA")
args = {'success': True, 'message': 'Success', 'id': data}
args2 = {'unsuccess': False, 'message': 'UnSuccess', 'id': data}
if new_payment_request:
return args
else:
return args2
This controller function above is dependant on another function that is in the the same custom module inside the models folder.The function is called post()....I want to call the post function before this method is called