I have a function which selects a query from database and returns a result, I want to use this function in my openoffice report, please help on how to call that function in the report.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilità
- Magazzino
- PoS
- Project
- MRP
La domanda è stata contrassegnata
You should add methods you want to use in the report in the python file inside report folder of your module. For example:
class picking(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
self.localcontext.update({
'time': time,
'your_method_name_from_rml':self._your_method,
})
def _your_method(self,value):
result = []
object = self.pool.get('object.name')
# DB query
return result
In self.localcontext.update, you have to add the new methods added, so that they are "visible" from the RML file, together with the method they are related to.
You should call your new method from the RML file using the following code:
[[ your_method_name_from_rml(o.value) ]]
Hope you find this useful
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
1
mag 15
|
5894 | ||
|
1
dic 22
|
44241 | ||
|
1
set 18
|
4206 | ||
|
0
mar 15
|
11179 | ||
|
1
mar 15
|
9349 |