mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Cash Daily Report
This commit is contained in:
13
cash_daily_report/README.rst
Normal file
13
cash_daily_report/README.rst
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
CASH DAILY REPORT
|
||||||
|
=============
|
||||||
|
|
||||||
|
Export payments report in xls format
|
||||||
|
|
||||||
|
|
||||||
|
Credits
|
||||||
|
=======
|
||||||
|
|
||||||
|
Creator
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Alexandre Díaz <dev@redneboa.es>
|
||||||
21
cash_daily_report/__init__.py
Normal file
21
cash_daily_report/__init__.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# OpenERP, Open Source Management Solution
|
||||||
|
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from . import wizard
|
||||||
50
cash_daily_report/__manifest__.py
Normal file
50
cash_daily_report/__manifest__.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# OpenERP, Open Source Management Solution
|
||||||
|
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Cash Daily Report',
|
||||||
|
'version': '1.0',
|
||||||
|
'author': "Alexandre Díaz <dev@redneboa.es>",
|
||||||
|
'website': 'https://www.eiqui.com',
|
||||||
|
'category': 'reports',
|
||||||
|
'summary': "Export payments report in xls format",
|
||||||
|
'description': "Cash Daily Report",
|
||||||
|
'depends': [
|
||||||
|
'account',
|
||||||
|
'account_payment_return',
|
||||||
|
'hotel',
|
||||||
|
],
|
||||||
|
'external_dependencies': {
|
||||||
|
'python': ['xlsxwriter']
|
||||||
|
},
|
||||||
|
'data': [
|
||||||
|
'wizard/cash_daily_report.xml',
|
||||||
|
'data/menus.xml',
|
||||||
|
],
|
||||||
|
'qweb': [],
|
||||||
|
'test': [
|
||||||
|
],
|
||||||
|
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': False,
|
||||||
|
'application': False,
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
}
|
||||||
10
cash_daily_report/data/menus.xml
Normal file
10
cash_daily_report/data/menus.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<menuitem id="cash_daily_report_wizard" name="Cash Daily Report Wizard"
|
||||||
|
parent="hotel.hotel_reports_menu"
|
||||||
|
groups="account.group_account_user"
|
||||||
|
action="action_open_cash_daily_report_wizard" sequence="45" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
171
cash_daily_report/i18n/es.po
Normal file
171
cash_daily_report/i18n/es.po
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * cash_daily_report
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 10.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2018-05-20 07:33+0000\n"
|
||||||
|
"PO-Revision-Date: 2018-05-20 09:34+0200\n"
|
||||||
|
"Last-Translator: <>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: \n"
|
||||||
|
"Language: es\n"
|
||||||
|
"X-Generator: Poedit 1.8.7.1\n"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:85
|
||||||
|
#, python-format
|
||||||
|
msgid "Amount"
|
||||||
|
msgstr "Importe"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:78
|
||||||
|
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
|
||||||
|
#, python-format
|
||||||
|
msgid "Cash Daily Report"
|
||||||
|
msgstr "Informe de caja"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.actions.act_window,name:cash_daily_report.action_open_cash_daily_report_wizard
|
||||||
|
#: model:ir.ui.menu,name:cash_daily_report.cash_daily_report_wizard
|
||||||
|
msgid "Cash Daily Report Wizard"
|
||||||
|
msgstr "Informe de caja diaria"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:82
|
||||||
|
#, python-format
|
||||||
|
msgid "Client"
|
||||||
|
msgstr "Cliente"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
|
||||||
|
msgid "Close"
|
||||||
|
msgstr "Cerrar"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_uid
|
||||||
|
msgid "Created by"
|
||||||
|
msgstr "Creado por"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_create_date
|
||||||
|
msgid "Created on"
|
||||||
|
msgstr "Creado en"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:83
|
||||||
|
#, python-format
|
||||||
|
msgid "Date"
|
||||||
|
msgstr "Fecha"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_display_name
|
||||||
|
msgid "Display Name"
|
||||||
|
msgstr "Mostrar Nombre"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_end
|
||||||
|
msgid "End Date"
|
||||||
|
msgstr "Fecha finalización"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
|
||||||
|
msgid "Generate XLS"
|
||||||
|
msgstr "Generar XLS"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_id
|
||||||
|
msgid "ID"
|
||||||
|
msgstr "ID"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:84
|
||||||
|
#, python-format
|
||||||
|
msgid "Journal"
|
||||||
|
msgstr "Diario"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard___last_update
|
||||||
|
msgid "Last Modified on"
|
||||||
|
msgstr "Última modificación en"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_uid
|
||||||
|
msgid "Last Updated by"
|
||||||
|
msgstr "Última actualización por"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_write_date
|
||||||
|
msgid "Last Updated on"
|
||||||
|
msgstr "Última actualización en"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:80
|
||||||
|
#, python-format
|
||||||
|
msgid "Name"
|
||||||
|
msgstr "Nombre"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:128
|
||||||
|
#, python-format
|
||||||
|
msgid "Not Any Payments"
|
||||||
|
msgstr "No hay movimientos"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:81
|
||||||
|
#, python-format
|
||||||
|
msgid "Reference"
|
||||||
|
msgstr "Referencia"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_date_start
|
||||||
|
msgid "Start Date"
|
||||||
|
msgstr "Fecha de inicio"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:143
|
||||||
|
#, python-format
|
||||||
|
msgid "TOTAL"
|
||||||
|
msgstr "TOTAL"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:139
|
||||||
|
#, python-format
|
||||||
|
msgid "TOTAL PAYMENT RETURNS"
|
||||||
|
msgstr "TOTAL DEVOLUCIONES"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: code:addons/cash_daily_report/wizard/cash_daily_report.py:134
|
||||||
|
#, python-format
|
||||||
|
msgid "TOTAL PAYMENTS"
|
||||||
|
msgstr "TOTAL PAGOS"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.ui.menu,name:cash_daily_report.menu_account_finance_xls_reports
|
||||||
|
msgid "XLS Reports"
|
||||||
|
msgstr "XLS Reports"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_binary
|
||||||
|
msgid "Xls binary"
|
||||||
|
msgstr "Xls archivo"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model.fields,field_description:cash_daily_report.field_cash_daily_report_wizard_xls_filename
|
||||||
|
msgid "Xls filename"
|
||||||
|
msgstr "Xls nombre de archivo"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.model,name:cash_daily_report.model_cash_daily_report_wizard
|
||||||
|
msgid "cash.daily.report.wizard"
|
||||||
|
msgstr "cash.daily.report.wizard"
|
||||||
|
|
||||||
|
#. module: cash_daily_report
|
||||||
|
#: model:ir.ui.view,arch_db:cash_daily_report.view_cash_daily_report_wizard
|
||||||
|
msgid "or"
|
||||||
|
msgstr "o"
|
||||||
21
cash_daily_report/wizard/__init__.py
Normal file
21
cash_daily_report/wizard/__init__.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# OpenERP, Open Source Management Solution
|
||||||
|
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from . import cash_daily_report
|
||||||
163
cash_daily_report/wizard/cash_daily_report.py
Normal file
163
cash_daily_report/wizard/cash_daily_report.py
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# OpenERP, Open Source Management Solution
|
||||||
|
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from io import BytesIO
|
||||||
|
import datetime
|
||||||
|
from datetime import datetime, date, time
|
||||||
|
import xlsxwriter
|
||||||
|
import base64
|
||||||
|
from odoo import api, fields, models, _
|
||||||
|
from openerp.exceptions import except_orm, UserError, ValidationError
|
||||||
|
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||||
|
|
||||||
|
|
||||||
|
class CashDailyReportWizard(models.TransientModel):
|
||||||
|
FILENAME = 'cash_daily_report.xls'
|
||||||
|
_name = 'cash.daily.report.wizard'
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _get_default_date_start(self):
|
||||||
|
return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _get_default_date_end(self):
|
||||||
|
return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||||
|
|
||||||
|
date_start = fields.Date("Start Date", default=_get_default_date_start)
|
||||||
|
date_end = fields.Date("End Date", default=_get_default_date_end)
|
||||||
|
xls_filename = fields.Char()
|
||||||
|
xls_binary = fields.Binary()
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _export(self):
|
||||||
|
file_data = BytesIO()
|
||||||
|
workbook = xlsxwriter.Workbook(file_data, {
|
||||||
|
'strings_to_numbers': True,
|
||||||
|
'default_date_format': 'dd/mm/yyyy'
|
||||||
|
})
|
||||||
|
|
||||||
|
company_id = self.env.user.company_id
|
||||||
|
workbook.set_properties({
|
||||||
|
'title': 'Exported data from ' + company_id.name,
|
||||||
|
'subject': 'Payments Data from Odoo of ' + company_id.name,
|
||||||
|
'author': 'Odoo',
|
||||||
|
'manager': u'Alexandre Díaz Cuadrado',
|
||||||
|
'company': company_id.name,
|
||||||
|
'category': 'Hoja de Calculo',
|
||||||
|
'keywords': 'payments, odoo, data, ' + company_id.name,
|
||||||
|
'comments': 'Created with Python in Odoo and XlsxWriter'})
|
||||||
|
workbook.use_zip64()
|
||||||
|
|
||||||
|
xls_cell_format_date = workbook.add_format({
|
||||||
|
'num_format': 'dd/mm/yyyy'
|
||||||
|
})
|
||||||
|
xls_cell_format_money = workbook.add_format({
|
||||||
|
'num_format': '#,##0.00'
|
||||||
|
})
|
||||||
|
xls_cell_format_header = workbook.add_format({
|
||||||
|
'bg_color': '#CCCCCC'
|
||||||
|
})
|
||||||
|
|
||||||
|
worksheet = workbook.add_worksheet(_('Cash Daily Report'))
|
||||||
|
|
||||||
|
worksheet.write('A1', _('Name'), xls_cell_format_header)
|
||||||
|
worksheet.write('B1', _('Reference'), xls_cell_format_header)
|
||||||
|
worksheet.write('C1', _('Client'), xls_cell_format_header)
|
||||||
|
worksheet.write('D1', _('Date'), xls_cell_format_header)
|
||||||
|
worksheet.write('E1', _('Journal'), xls_cell_format_header)
|
||||||
|
worksheet.write('F1', _('Amount'), xls_cell_format_header)
|
||||||
|
|
||||||
|
worksheet.set_column('C:C', 50)
|
||||||
|
worksheet.set_column('D:D', 11)
|
||||||
|
|
||||||
|
account_payments_obj = self.env['account.payment']
|
||||||
|
account_payments = account_payments_obj.search([
|
||||||
|
('payment_date', '>=', self.date_start),
|
||||||
|
('payment_date', '<=', self.date_end),
|
||||||
|
])
|
||||||
|
offset = 1
|
||||||
|
total_account_payment_amount = 0.0
|
||||||
|
for k_payment, v_payment in enumerate(account_payments):
|
||||||
|
worksheet.write(k_payment+offset, 0, v_payment.name)
|
||||||
|
worksheet.write(k_payment+offset, 1, v_payment.communication)
|
||||||
|
worksheet.write(k_payment+offset, 2, v_payment.partner_id.name)
|
||||||
|
worksheet.write(k_payment+offset, 3, v_payment.payment_date,
|
||||||
|
xls_cell_format_date)
|
||||||
|
worksheet.write(k_payment+offset, 4, v_payment.journal_id.name)
|
||||||
|
worksheet.write(k_payment+offset, 5, v_payment.amount,
|
||||||
|
xls_cell_format_money)
|
||||||
|
total_account_payment_amount += v_payment.amount
|
||||||
|
|
||||||
|
payment_returns_obj = self.env['payment.return']
|
||||||
|
payment_returns = payment_returns_obj.search([
|
||||||
|
('date', '>=', self.date_start),
|
||||||
|
('date', '<=', self.date_end),
|
||||||
|
])
|
||||||
|
offset += len(account_payments)
|
||||||
|
total_payment_returns_amount = k_line = 0.0
|
||||||
|
for k_payment, v_payment in enumerate(payment_returns):
|
||||||
|
for k_line, v_line in enumerate(v_payment.line_ids):
|
||||||
|
worksheet.write(k_line+offset, 0, v_payment.name)
|
||||||
|
worksheet.write(k_line+offset, 1, v_line.reference)
|
||||||
|
worksheet.write(k_line+offset, 2, v_line.partner_id.name)
|
||||||
|
worksheet.write(k_line+offset, 3, v_payment.date,
|
||||||
|
xls_cell_format_date)
|
||||||
|
worksheet.write(k_line+offset, 4, v_payment.journal_id.name)
|
||||||
|
worksheet.write(k_line+offset, 5, -v_line.amount,
|
||||||
|
xls_cell_format_money)
|
||||||
|
total_payment_returns_amount += v_line.amount
|
||||||
|
offset += len(v_payment.line_ids)
|
||||||
|
if total_account_payment_amount == 0 and total_payment_returns_amount == 0:
|
||||||
|
raise UserError(_('Not Any Payments'))
|
||||||
|
line = offset
|
||||||
|
if k_line:
|
||||||
|
line = k_line + offset
|
||||||
|
if total_account_payment_amount > 0:
|
||||||
|
line += 1
|
||||||
|
worksheet.write(line, 4, _('TOTAL PAYMENTS'))
|
||||||
|
worksheet.write(line, 5, total_account_payment_amount,
|
||||||
|
xls_cell_format_money)
|
||||||
|
if total_payment_returns_amount > 0:
|
||||||
|
line += 1
|
||||||
|
worksheet.write(line, 4, _('TOTAL PAYMENT RETURNS'))
|
||||||
|
worksheet.write(line, 5, -total_payment_returns_amount,
|
||||||
|
xls_cell_format_money)
|
||||||
|
line += 1
|
||||||
|
worksheet.write(line, 4, _('TOTAL'))
|
||||||
|
worksheet.write(
|
||||||
|
line,
|
||||||
|
5,
|
||||||
|
total_account_payment_amount - total_payment_returns_amount,
|
||||||
|
xls_cell_format_money)
|
||||||
|
|
||||||
|
workbook.close()
|
||||||
|
file_data.seek(0)
|
||||||
|
tnow = fields.Datetime.now().replace(' ', '_')
|
||||||
|
return {
|
||||||
|
'xls_filename': 'cash_daily_report_%s.xlsx' % tnow,
|
||||||
|
'xls_binary': base64.encodestring(file_data.read()),
|
||||||
|
}
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def export(self):
|
||||||
|
self.write(self._export())
|
||||||
|
return {
|
||||||
|
"type": "ir.actions.do_nothing",
|
||||||
|
}
|
||||||
42
cash_daily_report/wizard/cash_daily_report.xml
Normal file
42
cash_daily_report/wizard/cash_daily_report.xml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_cash_daily_report_wizard">
|
||||||
|
<field name="name">cash.daily.report.wizard</field>
|
||||||
|
<field name="model">cash.daily.report.wizard</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Cash Daily Report" >
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="date_start" required="1" />
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="date_end" required="1" />
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="xls_filename" invisible="1"/>
|
||||||
|
<field name="xls_binary" filename="xls_filename" readonly="1" />
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<footer>
|
||||||
|
<button name="export" string="Generate XLS" type="object" class="oe_highlight" />
|
||||||
|
or
|
||||||
|
<button string="Close" class="oe_link" special="cancel" />
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_open_cash_daily_report_wizard" model="ir.actions.act_window">
|
||||||
|
<field name="name">Cash Daily Report Wizard</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">cash.daily.report.wizard</field>
|
||||||
|
<field name="view_id" ref="view_cash_daily_report_wizard"/>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user