diff --git a/setup/website_account_fiscal_position_partner_type/odoo/addons/website_account_fiscal_position_partner_type b/setup/website_account_fiscal_position_partner_type/odoo/addons/website_account_fiscal_position_partner_type new file mode 120000 index 0000000000..ffd37fffd6 --- /dev/null +++ b/setup/website_account_fiscal_position_partner_type/odoo/addons/website_account_fiscal_position_partner_type @@ -0,0 +1 @@ +../../../../website_account_fiscal_position_partner_type \ No newline at end of file diff --git a/setup/website_account_fiscal_position_partner_type/setup.py b/setup/website_account_fiscal_position_partner_type/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/website_account_fiscal_position_partner_type/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/website_account_fiscal_position_partner_type/README.rst b/website_account_fiscal_position_partner_type/README.rst new file mode 100644 index 0000000000..78b3726ac7 --- /dev/null +++ b/website_account_fiscal_position_partner_type/README.rst @@ -0,0 +1,108 @@ +============================================ +Website Account Fiscal Position Partner Type +============================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5c213150d8bd7ba3fc421454f772d2fdbcf5186f276573e7f116c1f4b09c3b85 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fe--commerce-lightgray.png?logo=github + :target: https://github.com/OCA/e-commerce/tree/16.0/website_account_fiscal_position_partner_type + :alt: OCA/e-commerce +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/e-commerce-16-0/e-commerce-16-0-website_account_fiscal_position_partner_type + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows e-commerce customers to select if they're end customers or companies. + +This module has been designed to be used according the EU One-Stop-Shop in combination with l10n_eu_oss for helping to differentiate which taxes have to be applied. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +If you need to define a message to be shown on the registration page to provide information related to the Fiscal Position Types (B2B or B2C) you need to go to a website configuration form view and complete the HTML fields "B2B Information" and "B2C Information" displayed in the B2B/B2C Website Info tab. + +Usage +===== + +After allowing e-commerce customers to a free sign up: + +#. Once the customer wants to buy a product in the e-commerce, he/she will have to specify the partner type field (End customer/company) before finishing the checkout. + +#. Depending on the partner type, the applied taxes to the products may change. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Sygel Technology + +Contributors +~~~~~~~~~~~~ + +* `Sygel `_: + + * Harald Panten + * Valentin Vinagre + * Manuel Regidor + +* `Trey `_: + + * Vicent Cubells + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-cubells| image:: https://github.com/cubells.png?size=40px + :target: https://github.com/cubells + :alt: cubells + +Current `maintainer `__: + +|maintainer-cubells| + +This module is part of the `OCA/e-commerce `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_account_fiscal_position_partner_type/__init__.py b/website_account_fiscal_position_partner_type/__init__.py new file mode 100644 index 0000000000..b1973aa9f6 --- /dev/null +++ b/website_account_fiscal_position_partner_type/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2021 Valentin Vinagre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import controllers +from . import models diff --git a/website_account_fiscal_position_partner_type/__manifest__.py b/website_account_fiscal_position_partner_type/__manifest__.py new file mode 100644 index 0000000000..4e1f40ffd7 --- /dev/null +++ b/website_account_fiscal_position_partner_type/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2021 Valentín Vinagre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Website Account Fiscal Position Partner Type", + "version": "16.0.1.0.0", + "category": "Website", + "website": "https://github.com/OCA/e-commerce", + "author": "Sygel Technology," "Odoo Community Association (OCA)", + "maintainers": ["cubells"], + "license": "AGPL-3", + "application": False, + "installable": True, + "development_status": "Beta", + "depends": ["account_fiscal_position_partner_type", "website_sale"], + "data": [ + "views/website_sale.xml", + "views/portal_templates.xml", + "views/auth_signup_login_templates.xml", + "views/website_views.xml", + ], + "assets": { + "web.assets_frontend": [ + "website_account_fiscal_position_partner_type/static/src/js/signup.js", + ], + }, +} diff --git a/website_account_fiscal_position_partner_type/controllers/__init__.py b/website_account_fiscal_position_partner_type/controllers/__init__.py new file mode 100644 index 0000000000..65fa27a301 --- /dev/null +++ b/website_account_fiscal_position_partner_type/controllers/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2021 Valentin Vinagre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import main +from . import portal diff --git a/website_account_fiscal_position_partner_type/controllers/main.py b/website_account_fiscal_position_partner_type/controllers/main.py new file mode 100644 index 0000000000..62dc40f265 --- /dev/null +++ b/website_account_fiscal_position_partner_type/controllers/main.py @@ -0,0 +1,110 @@ +# Copyright 2021 Valentin Vinagre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import _, http +from odoo.http import request + +from odoo.addons.auth_signup.controllers.main import AuthSignupHome +from odoo.addons.website_sale.controllers.main import WebsiteSale + + +class WebsiteSale(WebsiteSale): + def values_postprocess(self, order, mode, values, errors, error_msg): + new_values, errors, error_msg = super(WebsiteSale, self).values_postprocess( + order=order, mode=mode, values=values, errors=errors, error_msg=error_msg + ) + if mode[1] in ("billing") and values.get("fiscal_position_type", False): + new_values.update( + {"fiscal_position_type": values.get("fiscal_position_type")} + ) + return new_values, errors, error_msg + + def checkout_form_validate(self, mode, all_form_values, data): + old_context = request.context + request.update_context( + fiscal_position_type=all_form_values.get("fiscal_position_type") + ) + error, error_message = super().checkout_form_validate( + mode, all_form_values, data + ) + request.update_context(**old_context) + if data.get("fiscal_position_type"): + partner_su = ( + request.env["res.partner"] + .sudo() + .browse(int(data["partner_id"])) + .exists() + ) + fiscal_position_type_change = ( + partner_su + and "fiscal_position_type" in data + and data["fiscal_position_type"] != partner_su.fiscal_position_type + ) + if fiscal_position_type_change and not partner_su.can_edit_vat(): + error["fiscal_position_type"] = "error" + error_message.append( + _( + "Changing partner type is not allowed once invoices have " + "been issued for your account. Please contact us directly" + " for this operation." + ) + ) + return error, error_message + + @http.route() + def address(self, **kw): + res = super(WebsiteSale, self).address(**kw) + if res.qcontext: + mode = res.qcontext.get("mode", False) + if mode and mode[1] == "billing": + # Get default position + def_fiscpostype = ( + request.website.company_id.default_fiscal_position_type or "b2c" + ) + # Get position if exist order + order = request.website.sale_get_order() + if order.partner_id: + def_fiscpostype = order.partner_id.fiscal_position_type + # if posted, get the last value + if kw.get("submitted", False): + if res.qcontext.get("error", False): + def_fiscpostype = kw.get( + "fiscal_position_type", def_fiscpostype + ) + # get all options + afp_obj = request.env["account.fiscal.position"].sudo() + res.qcontext.update( + { + "def_fiscpostype": def_fiscpostype, + "fiscpostypevalues": dict( + afp_obj._fields[ + "fiscal_position_type" + ]._description_selection(request.env) + ), + } + ) + return res + + +class AuthSignupHome(AuthSignupHome): + def get_auth_signup_qcontext(self): + qcontext = super().get_auth_signup_qcontext() + qcontext.update( + {k: v for (k, v) in request.params.items() if k in {"fiscal_position_type"}} + ) + afp_obj = request.env["account.fiscal.position"].sudo() + qcontext["fiscpostypevalues"] = dict( + afp_obj._fields["fiscal_position_type"]._description_selection(request.env) + ) + if not qcontext.get("fiscal_position_type_selected"): + def_fiscpostype = ( + request.website.company_id.default_fiscal_position_type or "b2c" + ) + qcontext["fiscal_position_type_selected"] = def_fiscpostype + return qcontext + + def _prepare_signup_values(self, qcontext): + values = super()._prepare_signup_values(qcontext) + if "fiscal_position_type" in qcontext: + values["fiscal_position_type"] = qcontext["fiscal_position_type"] + return values diff --git a/website_account_fiscal_position_partner_type/controllers/portal.py b/website_account_fiscal_position_partner_type/controllers/portal.py new file mode 100644 index 0000000000..e3e6ce1ccf --- /dev/null +++ b/website_account_fiscal_position_partner_type/controllers/portal.py @@ -0,0 +1,46 @@ +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import _ +from odoo.http import request + +from odoo.addons.portal.controllers.portal import CustomerPortal + + +class CustomerPortal(CustomerPortal): + + CustomerPortal.OPTIONAL_BILLING_FIELDS += ["fiscal_position_type"] + + def details_form_validate(self, data): + error, error_message = super().details_form_validate(data) + partner = request.env.user.partner_id + if ( + not partner.can_edit_vat() + and "fiscal_position_type" in data + and data.get("fiscal_position_type") != partner.fiscal_position_type + ): + error["fiscal_position_type"] = "error" + error_message.append( + _( + "Changing Partner Type is not allowed once document(s) have " + "been issued for your account. Please contact us directly for" + " this operation." + ) + ) + return error, error_message + + def _prepare_portal_layout_values(self): + vals = super()._prepare_portal_layout_values() + afp_obj = request.env["account.fiscal.position"].sudo() + partner = request.env.user.partner_id + vals.update( + { + "fiscpostypevalues": dict( + afp_obj._fields["fiscal_position_type"]._description_selection( + request.env + ) + ), + "fiscal_position_type_selected": partner.fiscal_position_type, + } + ) + return vals diff --git a/website_account_fiscal_position_partner_type/i18n/es.po b/website_account_fiscal_position_partner_type/i18n/es.po new file mode 100644 index 0000000000..f281e9a3ea --- /dev/null +++ b/website_account_fiscal_position_partner_type/i18n/es.po @@ -0,0 +1,76 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_account_fiscal_position_partner_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-03-20 20:36+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model.fields,field_description:website_account_fiscal_position_partner_type.field_website__b2b_information +msgid "B2B Information" +msgstr "Información B2B" + +#. module: website_account_fiscal_position_partner_type +#: model_terms:ir.ui.view,arch_db:website_account_fiscal_position_partner_type.website_account_fiscal_position_partner_type_view_website_form +msgid "B2B/B2C Website Info" +msgstr "Información del sitio Web B2B/B2C" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model.fields,field_description:website_account_fiscal_position_partner_type.field_website__b2c_information +msgid "B2C Information" +msgstr "Información B2C" + +#. module: website_account_fiscal_position_partner_type +#: code:addons/website_account_fiscal_position_partner_type/controllers/portal.py:0 +#, python-format +msgid "" +"Changing Partner Type is not allowed once document(s) have been issued for " +"your account. Please contact us directly for this operation." +msgstr "" +"No se permite cambiar el tipo de socio una vez que se han emitido los " +"documentos para su cuenta. Póngase en contacto con nosotros directamente " +"para realizar esta operación." + +#. module: website_account_fiscal_position_partner_type +#: code:addons/website_account_fiscal_position_partner_type/controllers/main.py:0 +#, python-format +msgid "" +"Changing partner type is not allowed once invoices have been issued for your " +"account. Please contact us directly for this operation." +msgstr "" +"No se permite cambiar el tipo de socio una vez emitidas las facturas de su " +"cuenta. Póngase en contacto con nosotros directamente para realizar esta " +"operación." + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model,name:website_account_fiscal_position_partner_type.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: website_account_fiscal_position_partner_type +#: model_terms:ir.ui.view,arch_db:website_account_fiscal_position_partner_type.address_fiscal_position_type +#: model_terms:ir.ui.view,arch_db:website_account_fiscal_position_partner_type.website_account_fiscal_position_partner_type_auth_signup +#: model_terms:ir.ui.view,arch_db:website_account_fiscal_position_partner_type.website_checkoout_second_lastname_portal_my_details +msgid "Partner Type" +msgstr "Tipo de cliente" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model,name:website_account_fiscal_position_partner_type.model_res_users +msgid "Users" +msgstr "Usuarios" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model,name:website_account_fiscal_position_partner_type.model_website +msgid "Website" +msgstr "Sitio Web" diff --git a/website_account_fiscal_position_partner_type/i18n/website_account_fiscal_position_partner_type.pot b/website_account_fiscal_position_partner_type/i18n/website_account_fiscal_position_partner_type.pot new file mode 100644 index 0000000000..d84b0686e9 --- /dev/null +++ b/website_account_fiscal_position_partner_type/i18n/website_account_fiscal_position_partner_type.pot @@ -0,0 +1,67 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_account_fiscal_position_partner_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model.fields,field_description:website_account_fiscal_position_partner_type.field_website__b2b_information +msgid "B2B Information" +msgstr "" + +#. module: website_account_fiscal_position_partner_type +#: model_terms:ir.ui.view,arch_db:website_account_fiscal_position_partner_type.website_account_fiscal_position_partner_type_view_website_form +msgid "B2B/B2C Website Info" +msgstr "" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model.fields,field_description:website_account_fiscal_position_partner_type.field_website__b2c_information +msgid "B2C Information" +msgstr "" + +#. module: website_account_fiscal_position_partner_type +#: code:addons/website_account_fiscal_position_partner_type/controllers/portal.py:0 +#, python-format +msgid "" +"Changing Partner Type is not allowed once document(s) have been issued for " +"your account. Please contact us directly for this operation." +msgstr "" + +#. module: website_account_fiscal_position_partner_type +#: code:addons/website_account_fiscal_position_partner_type/controllers/main.py:0 +#, python-format +msgid "" +"Changing partner type is not allowed once invoices have been issued for your" +" account. Please contact us directly for this operation." +msgstr "" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model,name:website_account_fiscal_position_partner_type.model_res_partner +msgid "Contact" +msgstr "" + +#. module: website_account_fiscal_position_partner_type +#: model_terms:ir.ui.view,arch_db:website_account_fiscal_position_partner_type.address_fiscal_position_type +#: model_terms:ir.ui.view,arch_db:website_account_fiscal_position_partner_type.website_account_fiscal_position_partner_type_auth_signup +#: model_terms:ir.ui.view,arch_db:website_account_fiscal_position_partner_type.website_checkoout_second_lastname_portal_my_details +msgid "Partner Type" +msgstr "" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model,name:website_account_fiscal_position_partner_type.model_res_users +msgid "Users" +msgstr "" + +#. module: website_account_fiscal_position_partner_type +#: model:ir.model,name:website_account_fiscal_position_partner_type.model_website +msgid "Website" +msgstr "" diff --git a/website_account_fiscal_position_partner_type/models/__init__.py b/website_account_fiscal_position_partner_type/models/__init__.py new file mode 100644 index 0000000000..0689472527 --- /dev/null +++ b/website_account_fiscal_position_partner_type/models/__init__.py @@ -0,0 +1,6 @@ +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import res_users +from . import res_partner +from . import website diff --git a/website_account_fiscal_position_partner_type/models/res_partner.py b/website_account_fiscal_position_partner_type/models/res_partner.py new file mode 100644 index 0000000000..cf29672283 --- /dev/null +++ b/website_account_fiscal_position_partner_type/models/res_partner.py @@ -0,0 +1,15 @@ +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3). + +from odoo import api, models + + +class Partner(models.Model): + _inherit = "res.partner" + + @api.model + def signup_retrieve_info(self, token): + res = super().signup_retrieve_info(token) + partner = self._signup_retrieve_partner(token, raise_exception=True) + res.update({"fiscal_position_type_selected": partner.fiscal_position_type}) + return res diff --git a/website_account_fiscal_position_partner_type/models/res_users.py b/website_account_fiscal_position_partner_type/models/res_users.py new file mode 100644 index 0000000000..88a1cd97ea --- /dev/null +++ b/website_account_fiscal_position_partner_type/models/res_users.py @@ -0,0 +1,29 @@ +# Copyright 2023 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3). + +from odoo import api, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + @api.model + def signup(self, values, token=None): + if token: + partner = self.env["res.partner"]._signup_retrieve_partner( + token, check_validity=True, raise_exception=True + ) + partner_user = partner.user_ids and partner.user_ids[0] or False + # Don't update fiscal_position_type if partner related to user + # exists (i.e. when resetting password) + if partner_user: + values.pop("fiscal_position_type", None) + return super().signup(values, token) + + def _create_user_from_template(self, values): + user = super()._create_user_from_template(values) + if user and user.partner_id and values.get("fiscal_position_type"): + user.partner_id.write( + {"fiscal_position_type": values.get("fiscal_position_type")} + ) + return user diff --git a/website_account_fiscal_position_partner_type/models/website.py b/website_account_fiscal_position_partner_type/models/website.py new file mode 100644 index 0000000000..29b81650c0 --- /dev/null +++ b/website_account_fiscal_position_partner_type/models/website.py @@ -0,0 +1,11 @@ +# Copyright 2024 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3). + +from odoo import fields, models + + +class Website(models.Model): + _inherit = "website" + + b2b_information = fields.Html(translate=True) + b2c_information = fields.Html(translate=True) diff --git a/website_account_fiscal_position_partner_type/readme/CONFIGURE.rst b/website_account_fiscal_position_partner_type/readme/CONFIGURE.rst new file mode 100644 index 0000000000..39b87eae03 --- /dev/null +++ b/website_account_fiscal_position_partner_type/readme/CONFIGURE.rst @@ -0,0 +1 @@ +If you need to define a message to be shown on the registration page to provide information related to the Fiscal Position Types (B2B or B2C) you need to go to a website configuration form view and complete the HTML fields "B2B Information" and "B2C Information" displayed in the B2B/B2C Website Info tab. diff --git a/website_account_fiscal_position_partner_type/readme/CONTRIBUTORS.rst b/website_account_fiscal_position_partner_type/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..68837f7a34 --- /dev/null +++ b/website_account_fiscal_position_partner_type/readme/CONTRIBUTORS.rst @@ -0,0 +1,9 @@ +* `Sygel `_: + + * Harald Panten + * Valentin Vinagre + * Manuel Regidor + +* `Trey `_: + + * Vicent Cubells diff --git a/website_account_fiscal_position_partner_type/readme/DESCRIPTION.rst b/website_account_fiscal_position_partner_type/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..1594a96478 --- /dev/null +++ b/website_account_fiscal_position_partner_type/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows e-commerce customers to select if they're end customers or companies. + +This module has been designed to be used according the EU One-Stop-Shop in combination with l10n_eu_oss for helping to differentiate which taxes have to be applied. diff --git a/website_account_fiscal_position_partner_type/readme/USAGE.rst b/website_account_fiscal_position_partner_type/readme/USAGE.rst new file mode 100644 index 0000000000..ac6fd8956b --- /dev/null +++ b/website_account_fiscal_position_partner_type/readme/USAGE.rst @@ -0,0 +1,5 @@ +After allowing e-commerce customers to a free sign up: + +#. Once the customer wants to buy a product in the e-commerce, he/she will have to specify the partner type field (End customer/company) before finishing the checkout. + +#. Depending on the partner type, the applied taxes to the products may change. diff --git a/website_account_fiscal_position_partner_type/static/description/icon.png b/website_account_fiscal_position_partner_type/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/website_account_fiscal_position_partner_type/static/description/icon.png differ diff --git a/website_account_fiscal_position_partner_type/static/description/index.html b/website_account_fiscal_position_partner_type/static/description/index.html new file mode 100644 index 0000000000..a5fcf7ed2a --- /dev/null +++ b/website_account_fiscal_position_partner_type/static/description/index.html @@ -0,0 +1,453 @@ + + + + + +Website Account Fiscal Position Partner Type + + + +
+

Website Account Fiscal Position Partner Type

+ + +

Beta License: AGPL-3 OCA/e-commerce Translate me on Weblate Try me on Runboat

+

This module allows e-commerce customers to select if they’re end customers or companies.

+

This module has been designed to be used according the EU One-Stop-Shop in combination with l10n_eu_oss for helping to differentiate which taxes have to be applied.

+

Table of contents

+ +
+

Configuration

+

If you need to define a message to be shown on the registration page to provide information related to the Fiscal Position Types (B2B or B2C) you need to go to a website configuration form view and complete the HTML fields “B2B Information” and “B2C Information” displayed in the B2B/B2C Website Info tab.

+
+
+

Usage

+

After allowing e-commerce customers to a free sign up:

+
    +
  1. Once the customer wants to buy a product in the e-commerce, he/she will have to specify the partner type field (End customer/company) before finishing the checkout.
  2. +
  3. Depending on the partner type, the applied taxes to the products may change.
  4. +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Sygel Technology
  • +
+
+
+

Contributors

+
    +
  • Sygel:

    +
    +
      +
    • Harald Panten
    • +
    • Valentin Vinagre
    • +
    • Manuel Regidor
    • +
    +
    +
  • +
  • Trey:

    +
      +
    • Vicent Cubells
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

cubells

+

This module is part of the OCA/e-commerce project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/website_account_fiscal_position_partner_type/static/src/js/signup.js b/website_account_fiscal_position_partner_type/static/src/js/signup.js new file mode 100644 index 0000000000..af4cacc55b --- /dev/null +++ b/website_account_fiscal_position_partner_type/static/src/js/signup.js @@ -0,0 +1,26 @@ +odoo.define("website_account_fiscal_position_partner_type.signup", function (require) { + "use strict"; + + require("auth_signup.signup"); + + var publicWidget = require("web.public.widget"); + + publicWidget.registry.SignUpForm.include({ + events: _.extend({}, publicWidget.registry.SignUpForm.prototype.events, { + "change select[name=fiscal_position_type]": "_onChangeFiscalPositionType", + }), + + _onChangeFiscalPositionType: function (event) { + if (event.target.value == "b2b") { + $("#b2c_name_instructions").hide(); + $("#b2b_name_instructions").show(); + } else if (event.target.value == "b2c") { + $("#b2b_name_instructions").hide(); + $("#b2c_name_instructions").show(); + } else { + $("#b2b_name_instructions").hide(); + $("#b2c_name_instructions").hide(); + } + }, + }); +}); diff --git a/website_account_fiscal_position_partner_type/views/auth_signup_login_templates.xml b/website_account_fiscal_position_partner_type/views/auth_signup_login_templates.xml new file mode 100644 index 0000000000..0d46345cc6 --- /dev/null +++ b/website_account_fiscal_position_partner_type/views/auth_signup_login_templates.xml @@ -0,0 +1,43 @@ + + + + + diff --git a/website_account_fiscal_position_partner_type/views/portal_templates.xml b/website_account_fiscal_position_partner_type/views/portal_templates.xml new file mode 100644 index 0000000000..c6c36dd236 --- /dev/null +++ b/website_account_fiscal_position_partner_type/views/portal_templates.xml @@ -0,0 +1,37 @@ + + + + + diff --git a/website_account_fiscal_position_partner_type/views/website_sale.xml b/website_account_fiscal_position_partner_type/views/website_sale.xml new file mode 100644 index 0000000000..fd78c53e18 --- /dev/null +++ b/website_account_fiscal_position_partner_type/views/website_sale.xml @@ -0,0 +1,38 @@ + + + + + diff --git a/website_account_fiscal_position_partner_type/views/website_views.xml b/website_account_fiscal_position_partner_type/views/website_views.xml new file mode 100644 index 0000000000..3271e2a51e --- /dev/null +++ b/website_account_fiscal_position_partner_type/views/website_views.xml @@ -0,0 +1,36 @@ + + + + + website.account.fiscal.position.partner.type.view.website.form + website + + + + + + + + + + + + +