Merge pull request #241 from incaser/8.0-portal_payment_mode

[NEW][8.0] portal_payment_mode. Adds ACL's to payment_mode model for portal users
This commit is contained in:
Pedro M. Baeza
2016-02-15 13:23:31 +01:00
7 changed files with 142 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
.. 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
===================
Portal Payment Mode
===================
This module extends the functionality of *account_payment_partner* module to
allow to portal users view theirs invoices adding security permissions to
payment mode model.
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/173/8.0
For further information, please visit:
* https://www.odoo.com/forum/help-1
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/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
`here <https://github.com/OCA/bank-payment/issues/new?body=module:%20portal_payment_mode%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Rafael Blasco <rafabn@antiun.com>
* Carlos Dauden <carlos@incaser.es>
* Sergio Teruel <sergio@incaser.es>
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 http://odoo-community.org.

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': "Portal Payment Mode",
'summary': "Adds payment mode ACL's for portal users ",
'category': 'Portal',
'version': '8.0.1.0.0',
'depends': [
'portal_sale',
'account_payment_partner',
],
'data': [
'security/ir.model.access.csv',
],
'author': 'Antiun Ingeniería S.L., '
'Incaser Informatica S.L., '
'Odoo Community Association (OCA)',
'website': 'http://www.antiun.com',
'license': 'AGPL-3',
'installable': True,
'auto_install': True,
'application': False,
}

View File

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_payment_portal,Read access on payment.mode to Portal Users,account_payment.model_payment_mode,base.group_portal,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_payment_portal Read access on payment.mode to Portal Users account_payment.model_payment_mode base.group_portal 1 0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import test_portal_payment_mode

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
# (c) 2015 Antiun Ingeniería S.L. - Sergio Teruel
# (c) 2015 Antiun Ingeniería S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp.tests.common import TransactionCase
class TestPortalPaymentMode(TransactionCase):
def setUp(self):
super(TestPortalPaymentMode, self).setUp()
self.partner = self.env.ref('portal.partner_demo_portal')
self.bank = self.env['res.partner.bank'].create({
'state': 'bank',
'bank_name': 'Test bank',
'acc_number': '1234567890'})
self.journal = self.env['account.journal'].create({
'name': 'Test journal',
'code': 'TEST',
'type': 'general'})
self.payment_mode = self.env['payment.mode'].create({
'name': 'Test Payment Mode',
'journal': self.journal.id,
'bank_id': self.bank.id,
'type': self.env.ref(
'account_banking_payment_export.manual_bank_tranfer').id,
'sale_ok': True,
})
vals_invoice = {
'partner_id': self.partner.id,
'account_id': self.env.ref('account.a_sale').id,
'journal_id': self.env.ref('account.sales_journal').id,
'payment_mode_id': self.payment_mode.id,
'invoice_line': [(0, 0, {
'name': 'test',
'account_id': self.env.ref('account.a_sale').id,
'price_unit': 100.00,
'quantity': 1
})],
}
self.invoice = self.env['account.invoice'].create(vals_invoice)
self.invoice.invoice_validate()
def test_access_invoice(self):
user_portal = self.env['res.users'].search(
[('partner_id', '=', self.partner.id)])
self.assert_(self.invoice.sudo(user_portal).payment_mode_id)