Browse Source

[ADD] Initial Commit

pull/116/head
Ajmalcybrosys 6 years ago
parent
commit
63930a1a35
  1. 40
      product_profit_report/README.rst
  2. 3
      product_profit_report/__init__.py
  3. 48
      product_profit_report/__manifest__.py
  4. 6
      product_profit_report/doc/RELEASE_NOTES.md
  5. 2
      product_profit_report/models/__init__.py
  6. 71
      product_profit_report/models/product_profit_report_render_file.py
  7. 3
      product_profit_report/security/ir.model.access.csv
  8. BIN
      product_profit_report/static/description/banner.png
  9. BIN
      product_profit_report/static/description/cybro_logo.png
  10. BIN
      product_profit_report/static/description/icon.png
  11. 324
      product_profit_report/static/description/index.html
  12. BIN
      product_profit_report/static/description/pdf_report.png
  13. BIN
      product_profit_report/static/description/wizard.png
  14. 100
      product_profit_report/views/product_profit_report_pdf_report.xml
  15. 12
      product_profit_report/views/product_profit_report_report.xml
  16. 2
      product_profit_report/wizard/__init__.py
  17. 37
      product_profit_report/wizard/product_profit_report_wizard.py
  18. 43
      product_profit_report/wizard/product_profit_report_wizard_view.xml

40
product_profit_report/README.rst

@ -0,0 +1,40 @@
Product Profit Report v11
=========================
Product wise profit report.
Depends
=======
[sale_management, account_invoicing] addon Odoo
Tech
====
* [Python] - Models
* [XML] - Odoo views
Installation
============
- www.odoo.com/documentation/11.0/setup/install.html
- Install our custom addon
Bug Tracker
===========
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
Credits
=======
* Cybrosys Techno Solutions <https://www.cybrosys.com>
Author
------
Developer: Faslu Rahman @ cybrosys, odoo@cybrosys.com
Akhilesh N S @ cybrosys, odoo@cybrosys.com
Maintainer
----------
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com.

3
product_profit_report/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import wizard
from . import models

48
product_profit_report/__manifest__.py

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Akhilesh N S & Faslu Rahman
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Product Profit Report',
'version': '11.0.1.0.0',
'summary': 'Product wise profit reposrt',
'category': 'Accounting',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
'depends': [
'sale_management', 'account_invoicing',
],
'data': [
'wizard/product_profit_report_wizard_view.xml',
'views/product_profit_report_pdf_report.xml',
'views/product_profit_report_report.xml',
'security/ir.model.access.csv',
],
'license': 'AGPL-3',
'images': ['static/description/banner.png'],
'installable': True,
'auto_install': False,
'application': False,
}

6
product_profit_report/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <product_profit_report>
#### 09.04.2019
#### Version 11.0.1.0.0
##### ADD
- Initial commit for Product Profit Report.

2
product_profit_report/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import product_profit_report_render_file

71
product_profit_report/models/product_profit_report_render_file.py

@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
import datetime
import logging
from odoo import api, models, _
_logger = logging.getLogger(__name__)
class ReportRender(models.AbstractModel):
_name = 'report.product_profit_report.report_product_profit_report'
_description = 'Product profit Report Render'
@api.multi
def get_report_values(self, docid, data):
# only for pdf report
model_data = data['form']
return self.generate_report_values(model_data)
@api.model
def generate_report_values(self, data):
from_date = data['from_date']
to_date = data['to_date']
company = data['company']
categ_id = data['categ_id']
product_id = data['product_id']
domain = [('invoice_id.date_invoice', '>=', from_date),
('invoice_id.date_invoice', '<=', to_date),
('invoice_id.state', 'in', ['open', 'paid']),
('company_id', '=', company[0]),
('invoice_id.type', 'in', ['out_invoice', 'out_refund'])]
if categ_id:
domain += [('product_id.categ_id.id', '=', categ_id[0])]
if product_id:
domain += [('product_id.id', '=', product_id[0])]
orders = self.env['account.invoice.line'].search(domain, order='name')
groups = {}
for order in orders:
dic_name = str(order.product_id.id)
quantity = order.quantity
price = quantity * (order.price_unit - order.discount)
expense = order.product_id.get_history_price(order.company_id.id, date=order.invoice_id.date_invoice) * quantity
if expense == 0.0:
expense = order.product_id.standard_price * quantity
if order.invoice_id.type == 'out_refund':
quantity = -quantity
price = -price
expense = -expense
profit = price - expense
if not groups.get(dic_name):
groups[dic_name] = {}
groups[dic_name].update({
'qty': quantity,
'unit': order.product_id.uom_id.name,
'sales': price,
'expense': expense,
'profit': profit,
'name': order.product_id.name
})
else:
groups[dic_name].update({
'qty': groups[dic_name].get('qty') + quantity,
'sales': groups[dic_name].get('sales') + price,
'expense': groups[dic_name].get('expense') + expense,
'profit': groups[dic_name].get('profit') + profit
})
return {
'data': data,
'groups': groups,
'report_date': datetime.datetime.now().strftime("%Y-%m-%d"),
}

3
product_profit_report/security/ir.model.access.csv

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_profit_report_manager,product.profit.report,model_product_profit_report_report,account.group_account_manager,1,1,1,1
access_product_profit_report_user,product.profit.report,model_product_profit_report_report,account.group_account_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_product_profit_report_manager product.profit.report model_product_profit_report_report account.group_account_manager 1 1 1 1
3 access_product_profit_report_user product.profit.report model_product_profit_report_report account.group_account_user 1 0 0 0

BIN
product_profit_report/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
product_profit_report/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
product_profit_report/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

324
product_profit_report/static/description/index.html

@ -0,0 +1,324 @@
<section class="oe_container" style="background-image:url(https://www.cybrosys.com/images/odoo-index-header-banner.png);background-repeat:no-repeat;background-size:100%;padding: 4% 0% 2% 15%;background-position-y: -107px;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="font-size: 35px;color: #fff;font-weight: 900;text-transform: uppercase;text-align: left;margin: 0;margin-bottom: 16px;">
Product Profit Report
</h2>
<h3 class="oe_slogan" style="font-size: 25px;color: #fff;font-weight: 600;text-align: left;opacity: 1;margin: 0 !important;">
Generate Product wise profit report
</h3>
<h5 class="oe_slogan" style="text-align: left;background: #fff;width: 293px;padding: 10px;color: #080808 !important;opacity: 1 !important;font-weight: 600;font-size: 20px;">
<a style="color: #080808 !important;" href="https://www.cybrosys.com" target="_blank">Cybrosys Technologies</a>
</h5>
<a style="color: #080808 !important;" href="https://www.cybrosys.com" target="_blank">
<div style="width: 215px;margin-left: 57%;text-align: center;background: #ffffff;height: 215px;border-radius: 100%;display: flex;justify-content: center;align-items: center;box-shadow: 0 0 12px 4px #00000059;">
<img src="https://www.cybrosys.com/images/cybro-logo-oca.png" alt="cybrosys technologies" style="width: 180px;"/>
</div>
</a>
</div>
</section>
<section class="oe_container" style="padding: 3% 0% 3% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Overview
</h2>
<h3 class="oe_slogan" style="text-align: left;font-size: 16px;width: 90%;margin: 0;margin-top: 14px;color: #000 !important;opacity: 1 !important;line-height: 24px;">
With this module you can generate product wise profit report. It give a clear view of which products and product mixes are cost effective. In addition to managing current results the analysis can refine product pricing strategies
</h3>
</div>
</div>
</section>
<section class="oe_container" style="padding: 3% 0% 0% 15%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Screenshots
</h2>
<div class="oe_row oe_spaced">
<img src="wizard.png" alt="" style="width: 95%;"/>
</div>
<div class="oe_row oe_spaced">
<img src="pdf_report.png" alt="" style="width: 95%;"/>
</div>
</div>
</section>
<section class="oe_container" style="padding: 7px 0% 0% 3%;">
<div class="oe_row oe_spaced">
<a style="color: #080808 !important;" href="https://apps.odoo.com/apps/modules/browse?search=cybrosys" target="_blank"><img src="https://www.cybrosys.com/images/view-more-apps.jpg" alt="cybrosys technologies" style="width: 100%;margin-bottom: 50px;"/></a>
</div>
</section>
<section class="oe_container" style="padding: 1% 0% 0% 3%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Our Services
</h2>
<div style="display:flex;padding-top: 20px;justify-content: space-between;">
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-customization-and-installation/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-customization.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-customization-and-installation/" target="_blank">
Odoo Customization
</a>
</h3>
</div>
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-implementation/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-erp-implementation.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-implementation/" target="_blank">
Odoo Implementation </a>
</h3>
</div>
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-integration/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-erp-integration.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-integration/" target="_blank">
Odoo Integration
</a>
</h3>
</div>
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/odoo-erp-support/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-erp-support.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/odoo-erp-support/" target="_blank">
Odoo Support</a>
</h3>
</div>
<div style="flex-basis: 18%;">
<div style="width:75px;height:75px;background:#fff; border-radius:100%;margin: auto;">
<a href="https://www.cybrosys.com/hire-odoo-developer/" target="_blank">
<img src="https://www.cybrosys.com/images/hire-odoo-developer.png" style="width: 100%;border-radius: 100%;"/>
</a>
</div>
<h3 class="oe_slogan" style="font-weight: 800;text-align: center;font-size: 14px;width: 100%;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;">
<a href="https://www.cybrosys.com/hire-odoo-developer/" target="_blank">
Hire Odoo Developers</a>
</h3>
</a>
</div>
</div>
</div>
</section>
<section class="oe_container" style="padding: 1% 0% 0% 3%;">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="text-align: left;font-size: 28px;font-weight: 600;margin: 0px !important;">
Our Industries
</h2>
<div style="display:flex;justify-content: space-between;flex-wrap:wrap;">
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/best-trading-erp/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-1.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/best-trading-erp/" target="_blank">
Trading
</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Easily procure and sell your products.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/manufacturing-erp-software/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-2.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/manufacturing-erp-software/" target="_blank">
Manufacturing</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Plan, track and schedule your operations.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/restaurant-management/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-3.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/restaurant-management/" target="_blank">
Restaurant</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Run your bar or restaurant methodical.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/pos/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-4.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/pos/" target="_blank">
POS</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Easy configuring and convivial selling.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/ecommerce-website/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-5.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 0px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/ecommerce-website/" target="_blank">
E-commerce & Website</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Mobile friendly, awe-inspiring product pages.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/hotel-management-erp/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-6.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/hotel-management-erp/" target="_blank">
Hotel Management</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
An all-inclusive hotel management application.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/education-erp-software/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-7.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/education-erp-software/" target="_blank">
Education</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
A Collaborative platform for educational management.
</h3>
</div>
</div>
<div style="flex-basis: 32%;padding-top: 20px;">
<div style="width:30%; float:left;">
<div style="width:75px;height:75px;background:#CE2D48; border-radius:100%;float: left;text-align: left;">
<a href="https://www.cybrosys.com/odoo/industries/service-management/" target="_blank">
<img src="https://www.cybrosys.com/images/odoo-index-industry-8.png" alt="Odoo Industry" style=" border-radius: 100%;width:100%;"/>
</a>
</div>
</div>
<div style="width:70%;float:left;">
<h3 class="oe_slogan" style=" text-align: left;font-size: 14px;font-weight:800;width: auto;margin: 0;margin-top: 14px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 4px;margin-left: 16px;">
<a href="https://www.cybrosys.com/odoo/industries/service-management/" target="_blank">
Service Management</a>
</h3>
<h3 class="oe_slogan" style=" text-align: left;font-size: 13px;width: auto;margin: 0;margin-top:5px;color: #000 !important;margin-top: 5px;opacity: 1 !important;line-height: 17px;float: left;margin-top: 5px;margin-left: 16px;">
Keep track of services and invoice accordingly.
</h3>
</div>
</div>
</div>
</div>
</section>
<section class="oe_container" style="background-image:url(https://www.cybrosys.com/images/odoo-index-footer-bg.png); background-repeat:no-repeat; background-size:100%;padding: 13% 0% 6% 0%;">
<div class="oe_slogan" style="margin-top:10px !important;margin-bottom: 0px;">
<div>
<a style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 12px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" href="mailto:odoo@cybrosys.com"><i class="fa fa-envelope"></i> Email us </a>
<a style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 12px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com/contact/"><i class="fa fa-phone"></i> Contact Us </a>
<a style="color: #5c5c5c !important;border-radius: 0;background: none;border: none;background: #fff;box-shadow: 0 10px 40px 0 rgba(62,57,107,0.07), 0 2px 9px 0 rgba(62, 57, 107, 0.05);border-radius: 30px;font-size: 12px;padding: 9px 26px;margin-right: 9px;width: 200px;text-transform: capitalize;" class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com/contact/"><i class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="https://www.cybrosys.com/images/logo.png" style="width: 190px; margin-bottom: 25px;margin-top: 30px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px; ;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;height: 35px;padding-top: 7px;font-size: 21px;margin-right: 6px;border-radius: 100%;"></i></a></td>
</div>
</div>
</section>

BIN
product_profit_report/static/description/pdf_report.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

BIN
product_profit_report/static/description/wizard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

100
product_profit_report/views/product_profit_report_pdf_report.xml

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_product_profit_report">
<t t-call="web.html_container">
<t t-call="web.external_layout">
<div class="page">
<center>
<h2><span style="color:#a24689 !important;">Product Profit Report</span></h2>
<div>
<span style="font-size: 18px;">Company</span> : <t t-if="data['company']"> <span style="font-size: 16px;" t-esc="data['company'][1]"/></t>
</div>
</center>
<br></br>
<table border="1" style="width:99%;">
<tr></tr>
<tr>
<t t-if="data['from_date']"><td><span style="color:#a24689 !important; font-size: 16px;">From Date: </span> <span t-esc="data['from_date']"/></td></t>
<t t-if="data['to_date']"><td><span style="color:#a24689 !important; font-size: 16px;">To Date: </span> <span t-esc="data['to_date']"/></td></t>
<t t-if="report_date"><td><span style="color:#a24689 !important; font-size: 16px;">Report Date: </span> <span t-esc="report_date"/></td></t>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<t t-if="data['categ_id']"><td><span style="color:#a24689 !important; font-size: 16px;">Product Category: </span> <span t-esc="data['categ_id'][1]"/></td></t>
<t t-if="data['product_id']"><td><span style="color:#a24689 !important; font-size: 16px;">Product: </span> <span t-esc="data['product_id'][1]"/></td></t>
</tr>
<tr></tr>
</table>
<br></br><br></br>
<t t-if="groups">
<table class="table table-condensed">
<thead>
<tr>
<th class="text-left" style="color:#a24689 !important;">No</th>
<th class="text-center" style="color:#a24689 !important;">Product</th>
<th class="text-right" style="color:#a24689 !important;">Qty</th>
<th class="text-center" style="color:#a24689 !important;">Unit</th>
<th class="text-right" style="color:#a24689 !important;">Cost</th>
<th class="text-right" style="color:#a24689 !important;">Sale Amount</th>
<th class="text-right" style="color:#a24689 !important;">Profit</th>
</tr>
</thead>
<tbody>
<t t-set="i" t-value="1"/>
<t t-set="sum_espense" t-value="0.00"/>
<t t-set="sum_sales" t-value="0.00"/>
<t t-set="sum_profit" t-value="0.00"/>
<t t-foreach="groups" t-as="group">
<tr t-if="groups[group]['qty'] != 0.0">
<td class="text-left"><span t-esc="i" /></td>
<td class="text-left"><span t-esc="groups[group]['name']"/></td>
<td class="text-right"><span t-esc="groups[group]['qty']"/></td>
<td class="text-left"><span t-esc="groups[group]['unit']"/></td>
<td class="text-right">
<t t-if="groups[group]['expense'] == 0.0">
<span style="color: #e60000 !important;" t-esc="groups[group]['expense']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
<t t-if="groups[group]['expense'] != 0.0">
<span t-esc="groups[group]['expense']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</td>
<td class="text-right">
<t t-if="groups[group]['sales'] == 0.0">
<span style="color: #0000ff !important;" t-esc="groups[group]['sales']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
<t t-if="groups[group]['sales'] != 0.0">
<span t-esc="groups[group]['sales']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</td>
<td class="text-right">
<t t-if="groups[group]['profit'] &lt; 1">
<span style="color: #FF0000 !important;" t-esc="groups[group]['profit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
<t t-if="groups[group]['profit'] &gt; 0.0">
<span t-esc="groups[group]['profit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</t>
</td>
<t t-set="i" t-value="i+1"/>
<t t-set="sum_espense" t-value="sum_espense + groups[group]['expense'] "/>
<t t-set="sum_sales" t-value="sum_sales + groups[group]['sales']"/>
<t t-set="sum_profit" t-value="sum_profit + groups[group]['profit']"/>
</tr>
</t>
<tr>
<td style="font-weight: bold;" colspan="5" class="text-right"><span t-esc="sum_espense" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
<td style="font-weight: bold;" class="text-right"><span t-esc="sum_sales" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
<td style="font-weight: bold;" class="text-right"><span t-esc="sum_profit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
</tr>
</tbody>
</table>
</t>
<t t-if="not groups">
<span style="font-size: 20px;">No Data to Display...!!!</span>
</t>
</div>
</t>
</t>
</template>
</odoo>

12
product_profit_report/views/product_profit_report_report.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<report
id="action_product_profit_report_pdf"
model="product_profit_report.report"
string="Product Profit Report"
report_type="qweb-pdf"
name="product_profit_report.report_product_profit_report"
file="product_profit_report.report_product_profit_report"/>
</data>
</odoo>

2
product_profit_report/wizard/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import product_profit_report_wizard

37
product_profit_report/wizard/product_profit_report_wizard.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
import datetime
from odoo import models, fields, api
class ProductProfitReport(models.TransientModel):
_name = "product_profit_report.report"
_description = 'Product Profit Report'
@api.model
def _get_from_date(self):
company = self.env.user.company_id
current_date = datetime.date.today()
from_date = company.compute_fiscalyear_dates(current_date)['date_from']
return from_date
from_date = fields.Date(string='From Date', default=_get_from_date, required=True)
to_date = fields.Date(string='To Date', default=fields.Date.context_today, required=True)
company = fields.Many2one('res.company', string='Company', required=True,
default=lambda self: self.env.user.company_id.id)
categ_id = fields.Many2one('product.category', string='Product Category', required=False)
product_id = fields.Many2one('product.product', string='Product', required=False,)
@api.onchange('categ_id')
def _onchange_category_products(self):
if self.categ_id:
products = self.env['product.product'].search([('categ_id', '=', self.categ_id.id)])
return {
'domain': {'product_id': [('id', 'in', products.ids)]}
}
def print_pdf_report(self, data):
data = {}
data['form'] = {}
data['form'].update(self.read([])[0])
return self.env.ref('product_profit_report.action_product_profit_report_pdf').with_context(
landscape=True).report_action(self, data=data)

43
product_profit_report/wizard/product_profit_report_wizard_view.xml

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="product_profit_report_view" model="ir.ui.view">
<field name="name">Product Profit Report</field>
<field name="model">product_profit_report.report</field>
<field name="arch" type="xml">
<form>
<group>
<group>
<field name="from_date"/>
<field name="to_date"/>
</group>
<group>
<field name="company" groups="base.group_multi_company" options='{"no_open": True, "no_create": True}'/>
</group>
<group>
<field name="categ_id" options='{"no_create": True}' />
<field name="product_id" options='{"no_create": True}'/>
</group>
</group>
<footer>
<button name="print_pdf_report" string="PDF" icon="fa-print" type="object" context="{'pdf':1}" default_focus="1" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_product_profit_report_wizard" model="ir.actions.act_window">
<field name="name">Product Profit Report</field>
<field name="res_model">product_profit_report.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="product_profit_report_view"/>
<field name="target">new</field>
</record>
<menuitem id="menu_product_profit_report" name="Product Profit Report" action="action_product_profit_report_wizard" parent="account.menu_finance_legal_statement" sequence="21"/>
</odoo>
Loading…
Cancel
Save