diff --git a/sale_purchase_mixed_report/README.rst b/sale_purchase_mixed_report/README.rst index 76b894e97..60e2c006c 100644 --- a/sale_purchase_mixed_report/README.rst +++ b/sale_purchase_mixed_report/README.rst @@ -1,7 +1,6 @@ .. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 - Sale Purchase mixed Report V15 ============================== Provides mixed reports related to Sales and Purchase in both Sales and Purchase. diff --git a/sale_purchase_mixed_report/__manifest__.py b/sale_purchase_mixed_report/__manifest__.py index b29428f9b..6d580358a 100644 --- a/sale_purchase_mixed_report/__manifest__.py +++ b/sale_purchase_mixed_report/__manifest__.py @@ -21,9 +21,9 @@ ################################################################################ { 'name': "Sale Purchase mixed Report", - 'summary': """Mixed reports of Sale and Purchase data""", - 'description': """Mixed reports of Sale and Purchase data""", - 'category': 'Technical', + 'summary': """Mixed Reports of Sale and Purchase Data""", + 'description': """Mixed Reports of Sale and Purchase Data""", + 'category': 'Sale', 'version': '15.0.1.0.0', 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', @@ -33,6 +33,7 @@ 'depends': ['base', 'sale', 'purchase', 'stock'], 'data': [ 'security/ir.model.access.csv', + 'security/security.xml', 'reports/sale_purchase_report_views.xml', 'reports/sale_purchase_pdf_template.xml', 'wizards/wizard_views.xml', diff --git a/sale_purchase_mixed_report/controllers/__init__.py b/sale_purchase_mixed_report/controllers/__init__.py index 763deba03..200518405 100644 --- a/sale_purchase_mixed_report/controllers/__init__.py +++ b/sale_purchase_mixed_report/controllers/__init__.py @@ -19,5 +19,4 @@ # If not, see . # ################################################################################ - from . import main diff --git a/sale_purchase_mixed_report/controllers/main.py b/sale_purchase_mixed_report/controllers/main.py index b5af27968..d29641dd7 100644 --- a/sale_purchase_mixed_report/controllers/main.py +++ b/sale_purchase_mixed_report/controllers/main.py @@ -19,7 +19,7 @@ # If not, see . # ################################################################################ - +"""Controller for Xlsx report""" import json from odoo import http from odoo.http import content_disposition, request diff --git a/sale_purchase_mixed_report/doc/RELEASE_NOTES.md b/sale_purchase_mixed_report/doc/RELEASE_NOTES.md index c649cd557..f21b36b50 100644 --- a/sale_purchase_mixed_report/doc/RELEASE_NOTES.md +++ b/sale_purchase_mixed_report/doc/RELEASE_NOTES.md @@ -1,6 +1,6 @@ ## Module -#### 14.05.2022 +#### __.05.2022 #### Version 15.0.1.0.0 ##### ADD -- Initial commit for Sale Purchase mixed Report +* Initial commit for Sale Purchase mixed Report diff --git a/sale_purchase_mixed_report/models/purchase.py b/sale_purchase_mixed_report/models/purchase.py index b0dd08b33..ea36519bf 100644 --- a/sale_purchase_mixed_report/models/purchase.py +++ b/sale_purchase_mixed_report/models/purchase.py @@ -19,7 +19,7 @@ # If not, see . # ################################################################################ - +"""Sale Order""" from odoo import fields, models diff --git a/sale_purchase_mixed_report/models/sale.py b/sale_purchase_mixed_report/models/sale.py index 44b90dd17..e967bca17 100644 --- a/sale_purchase_mixed_report/models/sale.py +++ b/sale_purchase_mixed_report/models/sale.py @@ -19,7 +19,7 @@ # If not, see . # ################################################################################ - +"""Purchase Order""" from odoo import fields, models diff --git a/sale_purchase_mixed_report/reports/sale_purchase_pdf_report.py b/sale_purchase_mixed_report/reports/sale_purchase_pdf_report.py index a08320bb2..30349ec00 100644 --- a/sale_purchase_mixed_report/reports/sale_purchase_pdf_report.py +++ b/sale_purchase_mixed_report/reports/sale_purchase_pdf_report.py @@ -19,7 +19,7 @@ # If not, see . # ################################################################################ - +"""Sale Purchase Report PDF""" from odoo import fields, models, api diff --git a/sale_purchase_mixed_report/reports/sale_purchase_report.py b/sale_purchase_mixed_report/reports/sale_purchase_report.py index 82086388f..deb88f7de 100644 --- a/sale_purchase_mixed_report/reports/sale_purchase_report.py +++ b/sale_purchase_mixed_report/reports/sale_purchase_report.py @@ -19,7 +19,7 @@ # If not, see . # ################################################################################ - +"""Sale Purchase Report""" from odoo import fields, models, tools diff --git a/sale_purchase_mixed_report/reports/sale_purchase_report_views.xml b/sale_purchase_mixed_report/reports/sale_purchase_report_views.xml index ccf056fba..92e9a2cc8 100644 --- a/sale_purchase_mixed_report/reports/sale_purchase_report_views.xml +++ b/sale_purchase_mixed_report/reports/sale_purchase_report_views.xml @@ -35,7 +35,8 @@ - + @@ -72,14 +73,20 @@ graph,pivot current - - + - - + \ No newline at end of file diff --git a/sale_purchase_mixed_report/security/security.xml b/sale_purchase_mixed_report/security/security.xml new file mode 100644 index 000000000..6f698ac40 --- /dev/null +++ b/sale_purchase_mixed_report/security/security.xml @@ -0,0 +1,10 @@ + + + + + Sale Purchase Report multi-company + + ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] + + + \ No newline at end of file diff --git a/sale_purchase_mixed_report/wizards/__init__.py b/sale_purchase_mixed_report/wizards/__init__.py index 0e74e7b36..02baef47b 100644 --- a/sale_purchase_mixed_report/wizards/__init__.py +++ b/sale_purchase_mixed_report/wizards/__init__.py @@ -1,23 +1,2 @@ # -*- coding: utf-8 -*- -################################################################################ -# -# Cybrosys Technologies Pvt. Ltd. -# -# Copyright (C) 2022-TODAY Cybrosys Technologies(). -# Author: Mohammed Ajmal P (odoo@cybrosys.com) -# -# You can modify it under the terms of the GNU AFFERO -# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. -# -# This program is distributes 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. -# -# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE -# (AGPL v3) along this program. -# If not, see . -# -################################################################################ - from . import wizard diff --git a/sale_purchase_mixed_report/wizards/wizard.py b/sale_purchase_mixed_report/wizards/wizard.py index 4f1b815ee..9cc37cd32 100644 --- a/sale_purchase_mixed_report/wizards/wizard.py +++ b/sale_purchase_mixed_report/wizards/wizard.py @@ -19,6 +19,7 @@ # If not, see . # ################################################################################ +"""Sale Purchase Report Wizard for PDF and XLSX Report""" import io import json @@ -70,9 +71,11 @@ class SalePurchasePrintReport(models.TransientModel): """Button function to print Xlsx Report""" if self.date_from and self.date_to and self.date_from > self.date_to: raise ValidationError('From Date must be less than of To Date!!!') + company_id = self.env.company data = { 'model': self._name, 'form': self.read()[0], + 'company_id': company_id.id, } return { 'type': 'ir.actions.report', @@ -87,7 +90,7 @@ class SalePurchasePrintReport(models.TransientModel): def get_xlsx_report(self, data, response): """Create and add data to the excel sheet""" - company_id = self.env.company + company_id = self.env['res.company'].browse(data['company_id']) output = io.BytesIO() workbook = xlsxwriter.Workbook(output, {'in_memory': True}) sheet = workbook.add_worksheet() @@ -114,10 +117,8 @@ class SalePurchasePrintReport(models.TransientModel): sheet.write(0, 12, 'Total Price', head_format) sheet.write(0, 13, 'Currency', head_format) sheet.write(0, 14, 'Order State', head_format) - where_sale = """so.company_id = %s""" % ( - company_id.id) - where_purchase = """po.company_id = %s""" % ( - company_id.id) + where_sale = """so.company_id = %s""" % company_id.id + where_purchase = """po.company_id = %s""" % company_id.id if data['form']['date_from']: where_sale += """AND so.date_order >= '%s'""" % ( data['form']['date_from']) @@ -153,6 +154,8 @@ class SalePurchasePrintReport(models.TransientModel): else: where_purchase += """AND po.id in %s""" % ( str(tuple(data['form']['purchase_order_ids']))) + print('where', where_sale) + print('whre pur', where_purchase) self.env.cr.execute(""" select macro.id as id, macro.order_type as order_type,