Try ERPNext Buy Support Partners Foundation

Override not working in production environment

Hi everyone,
Am using a production environment, we override a function from core, then we pull and update in production at the very first record in any override doctype, core code works. To bypass this temporarily we reload and save at that time override works. Can you help me why it happens and how to get a permanent solution ?. Because this is the major drawback in our production environment.

Thanks.

1 Like

If you share your code someone may be able to spot the problem?

Yes, until version 10, whenever we override a method in dev environment, we used to reload few times for the overridden method to get invoked instead of core. But when the code is updated in prodn environment, it used to get overridden soon after bench restart itself.

But now, in version 12, though the dev behaves the same, the production environment calls the core only, after every code change (through git or otherwise). We need to reload several times to actually get the overridden method to run. This is dangerous, as we can’t have every user to reload until the override happens.

Is anyone else facing this?

Krithi

An ‘override method’ search gets this that describes similar behaviour?

Thanks.

The discussion is moved to discuss.frappe, in turn moved to stackoverflow. Couldn’t trace. Any leads?

No, nonetheless constructive options to consider and contribute:

Post your code to demo and point to the problem, or find or develop a basic example, in a test case or instructive tutorial form?

Sharing customized override method below:

Hooks.py:
“Production Plan”:{
“onload”: “formulation.overrides.override_pptool.override_PPTool”,
},

Py file invoked from hooks:
def override_PPTool(doc=None,method=None):
ProductionPlan.make_work_order = make_work_order

Trying to override make_work_order method from core, so customized and added my changes in override_PPTool method . This method is invoked while clicking “Work Order” from Create button refer attachment.

After updating the production environment before clicking the Work Order button we are reloading twice(manually) to override the method. if we go without reloading core method invoked.
What we understood is override happens inconsistenly!
Why is it happening like that? It makes us so hard!!!
Preferred suggestions are welcomed.
Thanks.

Are you and @perkapz two sides on the same coin lol Override Problem

On refresh remove the existing button and add a button that points to your code.

@clarkej Maybe :sweat_smile:

This community is a resource of goodwill, to abuse that you only fool yourself :wink:

@perkapz is my best colleague, we didn’t receive any response regarding this particular issue. so we repeatedly posted from each of our login, i dont think it has an abusement from ourside lol. :sunglasses:

@clarkej we all facing this issue regularly thats y we raised it and our goal is to get a solution not to abuse :upside_down_face:

Thanks.
@tmatteson It can be done but there are other few methods which should be invoked on_submit, so we are searching for permanent solution.