add purchase_hide_report_print_menu

This commit is contained in:
chafique-delli
2016-05-03 15:27:13 +02:00
parent 9c67a6df5d
commit aa3568e986
5 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
================================
Purchase Hide Report Print Menu
================================
This module hide print report 'Request for Quotation' in purchase order menu.
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/142/8.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/akretion/odoo-usability/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed `feedback
<https://github.com/akretion/
odoo-usability/issues/new?body=module:%20
purchase_hide_report_print_menu%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Chafique Delli chafique.delli@akretion.com
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import purchase

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Purchase Hide Report Print Menu',
'summary': "Hide print report 'Request for Quotation' "
"in purchase order menu",
'version': '8.0.1.0.0',
'category': 'Purchase Management',
'website': 'http://akretion.com',
'author': 'Akretion, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'application': False,
'installable': True,
'depends': [
'purchase',
],
'data': [
'purchase_view.xml',
]
}

View File

@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
if context is None:
context = {}
res = super(PurchaseOrder, self).fields_view_get(
cr, uid, view_id=view_id, view_type=view_type, context=context,
toolbar=toolbar, submenu=submenu)
if ('purchase_order' in context and 'toolbar' in res and
'print' in res['toolbar']):
model_data_obj = self.pool['ir.model.data']
report_purchase_quotation_id = model_data_obj.xmlid_to_res_id(
cr, uid, 'purchase.report_purchase_quotation',
raise_if_not_found=True)
list_print_submenu_to_hide = []
for print_submenu in res['toolbar']['print']:
if print_submenu['id'] in [report_purchase_quotation_id]:
list_print_submenu_to_hide.append(print_submenu)
for print_submenu_to_hide in list_print_submenu_to_hide:
res['toolbar']['print'].remove(print_submenu_to_hide)
return res

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.actions.act_window" id="purchase.purchase_form_action">
<field name="context">{'purchase_order': True}</field>
</record>
</data>
</openerp>