nota_credito_bioelectric.py 1.0 KB

123456789101112131415161718192021222324252627282930
  1. from openerp import api, models
  2. import datetime
  3. from num2words import num2words
  4. class report_notacredito_2ca(models.AbstractModel):
  5. _name = 'report.factura_venta_2ca.report_notacredito_2ca'
  6. @api.multi
  7. def render_html(self, data=None):
  8. report_obj = self.env['report']
  9. report = report_obj._get_report_from_name('factura_venta_2ca.report_notacredito_2ca')
  10. docargs = {
  11. 'doc_ids': self._ids,
  12. 'doc_model': report.model,
  13. 'docs': self.env[report.model].browse(self._ids),
  14. 'convertir':self.convertir,
  15. 'calcular_precio':self.calcular_precio,
  16. }
  17. return report_obj.render('factura_venta_2ca.report_notacredito_2ca', docargs)
  18. def convertir(self,nro,moneda):
  19. letra = num2words(nro,lang="es")
  20. letra = letra.capitalize()
  21. if not moneda:
  22. moneda=''
  23. letra = letra +' '+moneda
  24. return letra
  25. def calcular_precio(self,precio):
  26. return (precio*1.1)