Browse Source

[ADD] Initial Commit 'sale_purchase_mixed_report'

pull/207/head
AjmalCybro 3 years ago
parent
commit
dcb756c52a
  1. 1
      sale_purchase_mixed_report/README.rst
  2. 7
      sale_purchase_mixed_report/__manifest__.py
  3. 1
      sale_purchase_mixed_report/controllers/__init__.py
  4. 2
      sale_purchase_mixed_report/controllers/main.py
  5. 4
      sale_purchase_mixed_report/doc/RELEASE_NOTES.md
  6. 2
      sale_purchase_mixed_report/models/purchase.py
  7. 2
      sale_purchase_mixed_report/models/sale.py
  8. 2
      sale_purchase_mixed_report/reports/sale_purchase_pdf_report.py
  9. 2
      sale_purchase_mixed_report/reports/sale_purchase_report.py
  10. 21
      sale_purchase_mixed_report/reports/sale_purchase_report_views.xml
  11. 10
      sale_purchase_mixed_report/security/security.xml
  12. 21
      sale_purchase_mixed_report/wizards/__init__.py
  13. 13
      sale_purchase_mixed_report/wizards/wizard.py

1
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.

7
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',

1
sale_purchase_mixed_report/controllers/__init__.py

@ -19,5 +19,4 @@
# If not, see <http://www.gnu.org/license/>.
#
################################################################################
from . import main

2
sale_purchase_mixed_report/controllers/main.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/license/>.
#
################################################################################
"""Controller for Xlsx report"""
import json
from odoo import http
from odoo.http import content_disposition, request

4
sale_purchase_mixed_report/doc/RELEASE_NOTES.md

@ -1,6 +1,6 @@
## Module <sale_purchase_mixed_report>
#### 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

2
sale_purchase_mixed_report/models/purchase.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/license/>.
#
################################################################################
"""Sale Order"""
from odoo import fields, models

2
sale_purchase_mixed_report/models/sale.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/license/>.
#
################################################################################
"""Purchase Order"""
from odoo import fields, models

2
sale_purchase_mixed_report/reports/sale_purchase_pdf_report.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/license/>.
#
################################################################################
"""Sale Purchase Report PDF"""
from odoo import fields, models, api

2
sale_purchase_mixed_report/reports/sale_purchase_report.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/license/>.
#
################################################################################
"""Sale Purchase Report"""
from odoo import fields, models, tools

21
sale_purchase_mixed_report/reports/sale_purchase_report_views.xml

@ -35,7 +35,8 @@
<filter string="Purchase Orders" name="Purchase Orders"
domain="[('order_state', 'not in', ('draft_sale', 'draft_rfq', 'sent_sale', 'rfq_sent', 'to_approve', 'sale', 'cancel'))]"/>
<separator/>
<filter name="filter_date" date="order_date" default_period="this_month"/>
<filter name="filter_date" date="order_date"
default_period="this_month"/>
<separator/>
<field name="user_id"/>
<field name="product_id"/>
@ -72,14 +73,20 @@
<field name="view_mode">graph,pivot</field>
<field name="target">current</field>
</record>
<menuitem name="Sale Purchase Report" id="menu_sale_purchase_report_root_sale"
parent="sale.menu_sale_report" sequence="100" groups="sales_team.group_sale_manager">
<menuitem name="Sale Purchase Report" id="menu_sale_purchase_report_sale"
<menuitem name="Sale Purchase Report"
id="menu_sale_purchase_report_root_sale"
parent="sale.menu_sale_report" sequence="100"
groups="sales_team.group_sale_manager">
<menuitem name="Sale Purchase Report"
id="menu_sale_purchase_report_sale"
sequence="1" action="action_sale_purchase_report"/>
</menuitem>
<menuitem name="Sale Purchase Report" id="menu_sale_purchase_report_root_purchase"
parent="purchase.purchase_report_main" sequence="100" groups="purchase.group_purchase_manager">
<menuitem name="Sale Purchase Report" id="menu_sale_purchase_report_purchase"
<menuitem name="Sale Purchase Report"
id="menu_sale_purchase_report_root_purchase"
parent="purchase.purchase_report_main" sequence="100"
groups="purchase.group_purchase_manager">
<menuitem name="Sale Purchase Report"
id="menu_sale_purchase_report_purchase"
sequence="1" action="action_sale_purchase_report"/>
</menuitem>
</odoo>

10
sale_purchase_mixed_report/security/security.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data noupdate="1">
<record id="sale_purchase_report_comp_rule" model="ir.rule">
<field name="name">Sale Purchase Report multi-company</field>
<field name="model_id" ref="model_sale_purchase_report"/>
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field>
</record>
</data>
</odoo>

21
sale_purchase_mixed_report/wizards/__init__.py

@ -1,23 +1,2 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# 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 <http://www.gnu.org/license/>.
#
################################################################################
from . import wizard

13
sale_purchase_mixed_report/wizards/wizard.py

@ -19,6 +19,7 @@
# If not, see <http://www.gnu.org/license/>.
#
################################################################################
"""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,

Loading…
Cancel
Save