It works!
some quick explanations on this fo futur users:
1) Added in parse function:
from numToWord import toWord
context['toWord'] = toWord
2) in my invoice.odt i am calling my fuction this way:
Arrêtée la présente facture a la somme de <toWord
(invoice.total_amount, 'fr-BE')> euro
3) wich output the right thing:
Arrêtée la présente facture a la somme de cent vingt euro
thank's for help Ian
On 16 jan, 22:00, Ian Wilson <[email protected]> wrote:
> Tryton using relatorio so that's hard to say but I think it should be
> approached from within tryton. To make the function available you
> need to extend the report by overloading the parse method and putting
> your function into the context variable.
>
> Here I set a variable called store which is accessible in the report:
>
> class InvoiceReport(CompanyReport):
> _name = 'account.invoice'
>
> def parse(self, cursor, user_id, report, objects, datas, context):
> employee_obj = self.pool.get('company.employee')
> employee = employee_obj.browse(cursor, user_id,
> context['employee'], context=context)
> context['store'] = employee and employee.store or False
> return super(InvoiceReport, self).parse(cursor, user_id,
> report, objects, datas, context)
>
> InvoiceReport()
>
> Do you also need to extend the actual invoice.odt itself?
>
> There are some examples
> here:http://doc.tryton.org/1.4/trytond/doc/reports.html#replacing-existing...
>
> On Sat, Jan 16, 2010 at 1:36 PM, Mourad <[email protected]> wrote:
> > Hi all,
> > i have a function num_to_word() that convert a monetary to it's
> > literal string, i want to push this function into the context sent to
> > genshi template so it become callable inside an invoice, i need some
> > hints
> > is this relatorio stuff or trytond stuff?
>
> > Thanks
>
> > --
> > [email protected] mailing list
--
[email protected] mailing list