[Vtigercrm-developers] The Right Way to Modify Inventory And Survive Upgrade

mhadid mustapha.hadeed at gmail.com
Fri Aug 24 21:45:40 GMT 2018


My company has a couple of requirements that could not be implemented without
modifying Inventory files, for example, one of the requirements concerning
items table of Invoice and SalesOrder modules:
1. The "Quantity" of service line should be auto-filled from "Number of
Units" of the selected service.
2. The "Selling Price" should be computed considering a couple of factors
including service start/end date.  

I'm not happy with the way I implemented there particular requirements. I've
modified the Inventory/Edit.js file directly, to affect both Invoice and
SalesOrder modules. 

My approach can't survive system upgrade, and even worse, exporting these
modifications to the production server involves a lot of copy/paste.

--------------------------------
Vtiger_Edit_Js("Inventory_Edit_Js", {}, {
	registerBasicEvents: function (container) {
	.. 
	*# registering my functions *
	this.registerExtensionListeners();
	}
});

*# extension functions*  
Inventory_Edit_Js.prototype.someFunction = function() { }
Inventory_Edit_Js.prototype.someOtherFunction = function() { }
Inventory_Edit_Js.prototype.registerExtensionListeners = function() { }
--------------------------------

I would not have any issue if I can export "Inventory" as a module. But
"Inventory" isn't a module, and can't be exported.

Can I make an extension module to implement this? Any idea of a better
approach?



--
Sent from: http://vtiger-crm.2324883.n4.nabble.com/vtigercrm-developers-f4.html


More information about the vtigercrm-developers mailing list