diff --git a/portal_payment_mode/README.rst b/portal_payment_mode/README.rst new file mode 100644 index 000000000..ffe2b69c0 --- /dev/null +++ b/portal_payment_mode/README.rst @@ -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 `_. +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 `_. + +Credits +======= + +Contributors +------------ + +* Rafael Blasco +* Carlos Dauden +* Sergio Teruel + +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. diff --git a/portal_payment_mode/__init__.py b/portal_payment_mode/__init__.py new file mode 100644 index 000000000..396df42f4 --- /dev/null +++ b/portal_payment_mode/__init__.py @@ -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 diff --git a/portal_payment_mode/__openerp__.py b/portal_payment_mode/__openerp__.py new file mode 100644 index 000000000..39e0a21a7 --- /dev/null +++ b/portal_payment_mode/__openerp__.py @@ -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, +} diff --git a/portal_payment_mode/security/ir.model.access.csv b/portal_payment_mode/security/ir.model.access.csv new file mode 100644 index 000000000..d8953bceb --- /dev/null +++ b/portal_payment_mode/security/ir.model.access.csv @@ -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 diff --git a/portal_payment_mode/static/description/icon.png b/portal_payment_mode/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/portal_payment_mode/static/description/icon.png differ diff --git a/portal_payment_mode/tests/__init__.py b/portal_payment_mode/tests/__init__.py new file mode 100644 index 000000000..80320b927 --- /dev/null +++ b/portal_payment_mode/tests/__init__.py @@ -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 diff --git a/portal_payment_mode/tests/test_portal_payment_mode.py b/portal_payment_mode/tests/test_portal_payment_mode.py new file mode 100644 index 000000000..918392473 --- /dev/null +++ b/portal_payment_mode/tests/test_portal_payment_mode.py @@ -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)