diff --git a/customer_due_day/README.md b/customer_due_days/README.md similarity index 100% rename from customer_due_day/README.md rename to customer_due_days/README.md diff --git a/customer_due_day/__init__.py b/customer_due_days/__init__.py similarity index 68% rename from customer_due_day/__init__.py rename to customer_due_days/__init__.py index 8323e7412..acc7f6ee3 100644 --- a/customer_due_day/__init__.py +++ b/customer_due_days/__init__.py @@ -1,2 +1,3 @@ # -*- coding: utf-8 -*- +from . import wizard from . import report diff --git a/customer_due_day/__manifest__.py b/customer_due_days/__manifest__.py similarity index 91% rename from customer_due_day/__manifest__.py rename to customer_due_days/__manifest__.py index 0cba6eadd..fce2ceff0 100644 --- a/customer_due_day/__manifest__.py +++ b/customer_due_days/__manifest__.py @@ -26,14 +26,16 @@ 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', - 'depends': ['base', 'base_report_xlsx', 'account'], + 'depends': ['base', 'report_xlsx', 'account'], 'website': 'https://www.cybrosys.com', + 'images': ['static/description/banner.jpg'], 'data': [ 'security/ir.model.access.csv', - 'report/due_days.xml', + 'wizard/due_days.xml', + 'report/due_report.xml', ], - 'images': ['static/description/banner.jpg'], + 'qweb': [], 'installable': True, 'auto_install': False, 'application': False, -} \ No newline at end of file +} diff --git a/customer_due_days/report/__init__.py b/customer_due_days/report/__init__.py new file mode 100644 index 000000000..eb320f1d3 --- /dev/null +++ b/customer_due_days/report/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +from . import due_report + diff --git a/customer_due_day/report/due_days.py b/customer_due_days/report/due_report.py similarity index 84% rename from customer_due_day/report/due_days.py rename to customer_due_days/report/due_report.py index e9ddf8d79..fd15bd5c3 100644 --- a/customer_due_day/report/due_days.py +++ b/customer_due_days/report/due_report.py @@ -1,36 +1,14 @@ # -*- coding: utf-8 -*- -import json -import io from datetime import datetime -from odoo.tools import date_utils -from odoo import models, fields, api, _ -try: - from odoo.tools.misc import xlsxwriter -except ImportError: - import xlsxwriter +from odoo import api, models,fields, _ -class CreditDueExceedReportWizard(models.TransientModel): - _name = 'customer.due.report' +class CustomerDueReportXLSX(models.AbstractModel): + _name = 'report.customer_due_days.report_customer_due_xlsx' + _inherit = 'report.report_xlsx.abstract' - @api.model - def xlsx_credit_due_report(self,data): - data = {} - data['form'] = self.read([]) - return { - 'type': 'ir_actions_xlsx_download', - 'data': {'model': 'customer.due.report', - 'options': json.dumps(data['form'], - default=date_utils.json_default), - 'output_format': 'xlsx', - 'report_name': 'customer_due_report', - } - } - - def get_xlsx_report(self, options, response): - output = io.BytesIO() - workbook = xlsxwriter.Workbook(output, {'in_memory': True}) - sheet = workbook.add_worksheet('Product Ageing Report') + def generate_xlsx_report(self, workbook, data, vals): + sheet = workbook.add_worksheet('Customer Due Report') format1 = workbook.add_format({'font_size': 15, 'align': 'center', 'bg_color': '#8a98a8', 'bold': True}) format2 = workbook.add_format( {'align': 'center', 'font_size': 10, 'bg_color': '#8a98a8', 'bottom': 1, 'bold': True}) @@ -118,7 +96,4 @@ class CreditDueExceedReportWizard(models.TransientModel): sheet.write(row_num, col_num + 6, aml['amount_residual'], format4) sheet.write(row_num, col_num + 7, total_overdue, format5) row_num += 1 - workbook.close() - output.seek(0) - response.stream.write(output.read()) - output.close() + diff --git a/customer_due_days/report/due_report.xml b/customer_due_days/report/due_report.xml new file mode 100644 index 000000000..da983b2ab --- /dev/null +++ b/customer_due_days/report/due_report.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/customer_due_day/security/ir.model.access.csv b/customer_due_days/security/ir.model.access.csv similarity index 100% rename from customer_due_day/security/ir.model.access.csv rename to customer_due_days/security/ir.model.access.csv diff --git a/customer_due_day/static/description/banner.jpg b/customer_due_days/static/description/banner.jpg similarity index 100% rename from customer_due_day/static/description/banner.jpg rename to customer_due_days/static/description/banner.jpg diff --git a/customer_due_day/static/description/cybro_logo.png b/customer_due_days/static/description/cybro_logo.png similarity index 100% rename from customer_due_day/static/description/cybro_logo.png rename to customer_due_days/static/description/cybro_logo.png diff --git a/customer_due_day/static/description/due_report.png b/customer_due_days/static/description/due_report.png similarity index 100% rename from customer_due_day/static/description/due_report.png rename to customer_due_days/static/description/due_report.png diff --git a/customer_due_day/static/description/due_wizard.png b/customer_due_days/static/description/due_wizard.png similarity index 100% rename from customer_due_day/static/description/due_wizard.png rename to customer_due_days/static/description/due_wizard.png diff --git a/customer_due_day/static/description/icon.png b/customer_due_days/static/description/icon.png similarity index 100% rename from customer_due_day/static/description/icon.png rename to customer_due_days/static/description/icon.png diff --git a/customer_due_day/static/description/index.html b/customer_due_days/static/description/index.html similarity index 100% rename from customer_due_day/static/description/index.html rename to customer_due_days/static/description/index.html diff --git a/customer_due_day/report/__init__.py b/customer_due_days/wizard/__init__.py similarity index 100% rename from customer_due_day/report/__init__.py rename to customer_due_days/wizard/__init__.py diff --git a/customer_due_days/wizard/due_days.py b/customer_due_days/wizard/due_days.py new file mode 100644 index 000000000..e7965d094 --- /dev/null +++ b/customer_due_days/wizard/due_days.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api, _ + + +class CreditDueExceedReportWizard(models.TransientModel): + _name = 'customer.due.report' + + @api.model + def xlsx_credit_due_report(self,data): + data = {} + return self.env.ref('customer_due_days.report_customer_due_xlsx').report_action(self, data=data) + diff --git a/customer_due_day/report/due_days.xml b/customer_due_days/wizard/due_days.xml similarity index 99% rename from customer_due_day/report/due_days.xml rename to customer_due_days/wizard/due_days.xml index 5f4601744..8738e90e0 100644 --- a/customer_due_day/report/due_days.xml +++ b/customer_due_days/wizard/due_days.xml @@ -1,6 +1,7 @@ + Customer Due Analysis customer.due.report