Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

12.0-[ADD] l10n be cooperator national number #178

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions l10n_be_cooperator_national_number/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
===================================
Belgium: Cooperator National Number
===================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-oca%2Fl10n--belgium-lightgray.png?logo=github
:target: https://github.com/oca/l10n-belgium/tree/12.0/l10n_be_cooperator_national_number
:alt: oca/l10n-belgium

|badge1| |badge2| |badge3|

Ask for Belgian National Number in Subscription Request.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/oca/l10n-belgium/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/oca/l10n-belgium/issues/new?body=module:%20l10n_be_cooperator_national_number%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* Coop IT Easy SC

Maintainers
~~~~~~~~~~~

This module is part of the `oca/l10n-belgium <https://github.com/oca/l10n-belgium/tree/12.0/l10n_be_cooperator_national_number>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions l10n_be_cooperator_national_number/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import controllers
20 changes: 20 additions & 0 deletions l10n_be_cooperator_national_number/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2018 Coop IT Easy SC (<http://www.coopiteasy.be>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).#
{
"name": "Belgium: Cooperator National Number",
"summary": "Ask for Belgian National Number in Cooperative Subscription Request.",
"version": "12.0.1.0.0",
"depends": [
"cooperator",
"l10n_be_national_number",
],
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
"category": "Cooperative management",
"website": "https://github.com/OCA/l10n-belgium",
"license": "AGPL-3",
"data": [
"views/subscription_request_view.xml",
"views/res_company_view.xml",
],
"demo": [],
}
1 change: 1 addition & 0 deletions l10n_be_cooperator_national_number/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
19 changes: 19 additions & 0 deletions l10n_be_cooperator_national_number/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from odoo import http
from odoo.http import request


class WebsiteSubscription(http.Controller):

def get_values_from_user(self, values, is_company):
values = super().get_values_from_user(self, values, is_company)
if request.env.user.login != "public":
partner = request.env.user.partner_id
company = self.env["res.company"]._company_default_get()
if not is_company and company.require_national_number:
national_number_id_category = self.env.ref(
"l10n_be_national_number.l10n_be_national_number_category"
).id
national_number = partner.id_numbers.search(
[('category_id', '=', national_number_id_category)])
values["national_number"] = national_number
return values
Loading