I’m working on a contribution and looking for the multicurrency controller(s) but they seem to be baked into taxes_and_totals.py
and the “items” table schema that occurs in a bunch of doctypes. Is there another place I should be looking? I guess more specifically, I’m looking for a method that fetches the conversion rate and rounding equation, I’d like those pieces to be consistent across ERPNext.
“Is there another place I should be looking?”
imo no you are on target taxes_and_totals.py - and also too transaction.js that extends it - together implement multi-currency
Many thanks for shilgod’s insight Quotation Item triggers
That ahha moment how https://api.jquery.com/jquery.extend/ aparently interfaces and extends a python object with a js object with this statement really escapes me:
erpnext.TransactionController = erpnext.taxes_and_totals.extend({
jquery.extend - An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.
@clarkej, sorry, I need to put one correction here!
It’s not jquery.extend
This feature rely on: http://ejohn.org/blog/simple-javascript-inheritance/
It’s an old intent to implement inheritance, using classes into JavaScript, instead of the prototyping method.
good catch thanks very much you both for your help - so then you are saying
erpnext.TransactionController = erpnext.taxes_and_totals.extend({
in fact extends this
and not the (controller template) py - I surely overlooked that.
edit:
So how ERPNext uses the model view controller MVC triad, the js implements the client-side form ‘view’
https://github.com/frappe/erpnext/tree/develop/erpnext/public/js/controllers
So that when a user makes a request from a form web page, a controller is responsible for returning the response to that request:
https://github.com/frappe/erpnext/tree/develop/erpnext/controllers
And that interaction involves consulting the ‘model’ for (master or transaction) state data.