pos_daily_report.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # Cybrosys Technologies Pvt. Ltd.
  5. # Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
  6. # Author: Sreejith P(<http://www.cybrosys.com>)
  7. # you can modify it under the terms of the GNU LESSER
  8. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
  13. #
  14. # You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
  15. # GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
  16. # If not, see <http://www.gnu.org/licenses/>.
  17. #
  18. ##############################################################################
  19. from openerp import models, fields
  20. class POSReport(models.TransientModel):
  21. _name = 'pos.report'
  22. date = fields.Datetime(string="Desde Fecha", required=True)
  23. date_to = fields.Datetime(string="Hasta", required=True)
  24. select_company = fields.Many2one('res.company', string='Compañia', default=lambda self: self.env.user.company_id)
  25. point_of_sale = fields.Many2one('pos.config', string='Punto de venta')
  26. sales_person = fields.Many2one('res.users', string='Vendedor')
  27. def print_sales_report(self, cr, uid, ids, context=None):
  28. if context is None:
  29. context = {}
  30. data = self.read(cr, uid, ids)[0]
  31. datas = {
  32. 'ids': context.get('active_ids'),
  33. 'model': 'pos.report',
  34. 'form': data,
  35. 'name': 'POS Report'
  36. }
  37. datas['form']['active_ids'] = context.get('active_ids', False)
  38. return self.pool['report'].get_action(cr, uid, [], 'pos_sale_reports.report_daily_pos_sales', data=datas,
  39. context=context)