Browse Source

[ADD] Initial Commit

pull/90/head
Sreejith P 7 years ago
parent
commit
70ff491578
  1. 3
      account_partner_ledger_filter/__init__.py
  2. 41
      account_partner_ledger_filter/__manifest__.py
  3. 2
      account_partner_ledger_filter/models/__init__.py
  4. 72
      account_partner_ledger_filter/models/account_partner_ledger.py
  5. BIN
      account_partner_ledger_filter/static/description/banner.jpg
  6. BIN
      account_partner_ledger_filter/static/description/cybro_logo.png
  7. BIN
      account_partner_ledger_filter/static/description/icon.png
  8. 62
      account_partner_ledger_filter/static/description/index.html
  9. BIN
      account_partner_ledger_filter/static/description/partner_form.png
  10. BIN
      account_partner_ledger_filter/static/description/partner_list.png
  11. BIN
      account_partner_ledger_filter/static/description/report_wiz.png
  12. 16
      account_partner_ledger_filter/views/report.xml
  13. 2
      account_partner_ledger_filter/wizard/__init__.py
  14. 15
      account_partner_ledger_filter/wizard/account_report_general_ledger_view.xml
  15. 15
      account_partner_ledger_filter/wizard/account_report_partner_ledger.py

3
account_partner_ledger_filter/__init__.py

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

41
account_partner_ledger_filter/__manifest__.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# 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': 'Partner Ledger with Partner Filter',
'version': '11.0.1.0',
'summary': """Partner Ledger Report with Partner Filter""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': "https://cybrosys.com/",
'category': 'Accounting',
'depends': ['account'],
'data': [
'views/report.xml',
'wizard/account_report_general_ledger_view.xml'
],
'demo': [],
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'application': False
}

2
account_partner_ledger_filter/models/__init__.py

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

72
account_partner_ledger_filter/models/account_partner_ledger.py

@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
import time
import logging
from odoo import api, models, _
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
class ReportPartnerLedger(models.AbstractModel):
_inherit = 'report.account.report_partnerledger'
@api.model
def get_report_values(self, docids, data=None):
if not data.get('form'):
raise UserError(_("Form content is missing, this report cannot be printed."))
data['computed'] = {}
obj_partner = self.env['res.partner']
query_get_data = self.env['account.move.line'].with_context(data['form'].get('used_context', {}))._query_get()
data['computed']['move_state'] = ['draft', 'posted']
if data['form'].get('target_move', 'all') == 'posted':
data['computed']['move_state'] = ['posted']
result_selection = data['form'].get('result_selection', 'customer')
if result_selection == 'supplier':
data['computed']['ACCOUNT_TYPE'] = ['payable']
elif result_selection == 'customer':
data['computed']['ACCOUNT_TYPE'] = ['receivable']
else:
data['computed']['ACCOUNT_TYPE'] = ['payable', 'receivable']
self.env.cr.execute("""
SELECT a.id
FROM account_account a
WHERE a.internal_type IN %s
AND NOT a.deprecated""", (tuple(data['computed']['ACCOUNT_TYPE']),))
data['computed']['account_ids'] = [a for (a,) in self.env.cr.fetchall()]
params = [tuple(data['computed']['move_state']), tuple(data['computed']['account_ids'])] + query_get_data[2]
reconcile_clause = "" if data['form']['reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL '
query = """
SELECT DISTINCT "account_move_line".partner_id
FROM """ + query_get_data[0] + """, account_account AS account, account_move AS am
WHERE "account_move_line".partner_id IS NOT NULL
AND "account_move_line".account_id = account.id
AND am.id = "account_move_line".move_id
AND am.state IN %s
AND "account_move_line".account_id IN %s
AND NOT account.deprecated
AND """ + query_get_data[1] + reconcile_clause
self.env.cr.execute(query, tuple(params))
# ---------------------Taking only selected partners---------------------------
if data['form']['partner_ids']:
partner_ids = data['form']['partner_ids']
else:
partner_ids = [res['partner_id'] for res in self.env.cr.dictfetchall()]
# -----------------------------------------------------------------------------
# partner_ids = [res['partner_id'] for res in self.env.cr.dictfetchall()]
partners = obj_partner.browse(partner_ids)
partners = sorted(partners, key=lambda x: (x.ref or '', x.name or ''))
return {
'doc_ids': partner_ids,
'doc_model': self.env['res.partner'],
'data': data,
'docs': partners,
'time': time,
'lines': self._lines,
'sum_partner': self._sum_partner,
}

BIN
account_partner_ledger_filter/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
account_partner_ledger_filter/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
account_partner_ledger_filter/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

62
account_partner_ledger_filter/static/description/index.html

@ -0,0 +1,62 @@
<section class="oe_container oe_dark">
<h2 class="oe_slogan">Partner Ledger report with Partner Filter</h2>
<h4 class="oe_slogan">Cybrosys Techno Solutions - www.cybrosys.com</h4>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h5 class="oe_slogan"><b>You can generate partner ledger report from partner form and list</b></h5>
<div class="col-md-12">
<div class=" oe_demo oe_picture oe_screenshot">
<img src="partner_list.png">
<div class="oe_demo_footer oe_centeralign"style="background-color:rgba(162, 70, 137, 0.7);">Partner List View</div>
</div>
</div>
<div class="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="partner_form.png">
<div class="oe_demo_footer oe_centeralign"style="background-color:rgba(162, 70, 137, 0.7);">Partner Form View</div>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h5 class="oe_slogan"><b>This will open partner ledger report wizard with the selected partner. </b></h5>
<h5 class="oe_slogan"><b>You can add or remove partner from wizard in case of fault selection </b></h5>
<div class="col-md-12">
<div class=" oe_demo oe_picture oe_screenshot">
<img src="report_wiz.png">
<div class="oe_demo_footer oe_centeralign"style="background-color:rgba(162, 70, 137, 0.7);">Partner Ledger Wizard</div>
</div>
</div>
</div>
</section>
<section class="oe_container">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
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
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" 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;"></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;"></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;padding-left: 8px;"></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;"></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;"></i></a></td>
</div>
</div>
</section>

BIN
account_partner_ledger_filter/static/description/partner_form.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
account_partner_ledger_filter/static/description/partner_list.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
account_partner_ledger_filter/static/description/report_wiz.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

16
account_partner_ledger_filter/views/report.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<act_window name="Partner Ledger"
res_model="account.report.partner.ledger"
src_model="res.partner"
view_mode="form"
view_id ="account.account_report_partner_ledger_view"
target="new"
key2="client_print_multi"
id="action_account_partner_ledger_report_filter"
context="{'default_partner_ids':active_ids}"
/>
</data>
</odoo>

2
account_partner_ledger_filter/wizard/__init__.py

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

15
account_partner_ledger_filter/wizard/account_report_general_ledger_view.xml

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_report_partner_ledger_filter_view" model="ir.ui.view">
<field name="name">Partner Ledger</field>
<field name="model">account.report.partner.ledger</field>
<field name="inherit_id" ref="account.account_report_partner_ledger_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='journal_ids']" position="before">
<field name="partner_ids" widget="many2many_tags"/>
</xpath>
</data>
</field>
</record>
</odoo>

15
account_partner_ledger_filter/wizard/account_report_partner_ledger.py

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from odoo import fields, models
class AccountPartnerLedger(models.TransientModel):
_inherit = "account.report.partner.ledger"
partner_ids = fields.Many2many('res.partner', 'partner_ledger_partner_rel', 'id', 'partner_id', string='Partners')
def _print_report(self, data):
data = self.pre_print_report(data)
data['form'].update({'reconciled': self.reconciled, 'amount_currency': self.amount_currency,
'partner_ids': self.partner_ids.ids})
return self.env.ref('account.action_report_partnerledger').report_action(self, data=data)
Loading…
Cancel
Save