I have installed the module mis_builder, from the Odoo Community Association repository named mis-builder.
In that module, there is a pure Python class defined, out of Odoo standards:
class AccountingExpressionProcessor(object):
...
def get_aml_domain_for_expr(self, expr, date_from, date_to, target_move, account_id=None):
...
The problem is that I need to create a customized module to overwrite the method get_aml_domain_for_expr
, defined inside the class AccountingExpressionProcessor
.
So in my module, I want to import the AccountingExpressionProcessor
class. My question is:
Which is the best way to import that class in my Python file?
I did this:
import imp
aep = imp.load_source(
'mis_builder.AccountingExpressionProcessor',
'/my/absolute/path/to/mis-builder/mis_builder/models/aep.py'
)
And then tried to inherit from the imported class this way:
class AccountingExpressionProcessor(aep.AccountingExpressionProcessor):
This solution is not working. In addition to this, I do not want to specify the absolute path, since each Odoo instance has its own path.
I tried a lot of things with no result. I am using Python 2.7 since it is Odoo 10. Does anyone know a good solution for this?
I'm not sure if it'll works for you or not but I've an example where ODOO implemented the same.
from odoo.addons.account_taxcloud.models.taxcloud_request import TaxCloudRequest
here code inherits the account_taxcloud(module) + taxcloud_request(py file) and then use the method:
class TaxCloudRequest(TaxCloudRequest):
def set_order_items_detail(self, order):
Kindly check if it works for you. Also please update if you find any solution.