Skip to content
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
65 changes: 65 additions & 0 deletions l10n_it_website_sale_fiscalcode/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.. 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

=======================
Website Sale FiscalCode
=======================

This module adds:
* Fiscalcode on checkout form

Usage
=====

To use this module, you need to:

* Go to Shop.
* Buy something.
* On checkout add fiscalcode

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/122/9.0

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

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

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
* Alessio Gerace <alessio.gerace@agilebg.com>
* Lorenzo Battistini <alessio.gerace@agilebg.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.
5 changes: 5 additions & 0 deletions l10n_it_website_sale_fiscalcode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Nicola Malcontenti - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import controllers
19 changes: 19 additions & 0 deletions l10n_it_website_sale_fiscalcode/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# © 2016 Nicola Malcontenti - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Website Sale FiscalCode',
'category': 'e-commerce',
'author': "Agile Business Group,"
"Odoo Community Association (OCA)",
'version': '9.0.1.0.0',
'author': 'Agile Business Group',
'website': 'http://www.agilebg.com',
'depends': [
'l10n_it_fiscalcode',
'website_sale'
],
'data': ['views/templates.xml'],
'installable': True,
}
5 changes: 5 additions & 0 deletions l10n_it_website_sale_fiscalcode/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Nicola Malcontenti - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import main
32 changes: 32 additions & 0 deletions l10n_it_website_sale_fiscalcode/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# © 2016 Nicola Malcontenti - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import SUPERUSER_ID
from openerp.http import request
from openerp.addons.website_sale.controllers.main import website_sale


class WebsiteSaleFiscalCode(website_sale):

def checkout_form_save(self, checkout):
super(WebsiteSaleFiscalCode, self).checkout_form_save(
checkout=checkout)
partner_id = request.website.sale_get_order(
context=request.context).partner_id
partner_dict = {'fiscalcode': request.params['fiscalcode']}
partner_id.write(partner_dict)

def checkout_values(self, data=None):
res = super(WebsiteSaleFiscalCode, self).checkout_values(
data=data)
cr, uid, context, registry = (
request.cr, request.uid, request.context, request.registry)
orm_user = registry.get('res.users')
partner = orm_user.browse(
cr, SUPERUSER_ID, uid, context).partner_id
if data and 'fiscalcode' in data:
res['checkout']['fiscalcode'] = data['fiscalcode']
else:
res['checkout']['fiscalcode'] = partner.fiscalcode
return res
27 changes: 27 additions & 0 deletions l10n_it_website_sale_fiscalcode/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_website_sale_fiscalcode
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-25 15:53+0000\n"
"PO-Revision-Date: 2016-10-25 15:53+0000\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: l10n_it_website_sale_fiscalcode
#: model:ir.ui.view,arch_db:l10n_it_website_sale_fiscalcode.l10n_it_website_sale_fiscalcode_inh
msgid "Fiscal Code"
msgstr "Codice Fiscale"

#. module: l10n_it_website_sale_fiscalcode
#: model:ir.ui.view,arch_db:l10n_it_website_sale_fiscalcode.l10n_it_website_sale_fiscalcode_inh
msgid "VAT Number"
msgstr "Partita IVA"

18 changes: 18 additions & 0 deletions l10n_it_website_sale_fiscalcode/views/templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Nicola Malcontenti - Agile Business Group
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<template id="l10n_it_website_sale_fiscalcode_inh" inherit_id="website_sale.checkout">
<xpath expr="//div[@class='row']/div[6]" position="before">
<div t-attf-class="form-group #{error.get('fiscalcode') and 'has-error' or ''} col-lg-6" id="fiscalcode">
<label class="control-label" for="fiscalcode" style="font-weight: normal">Fiscal Code</label>
<input type="text" name="fiscalcode" class="form-control" t-att-value="checkout.get('fiscalcode')"/>
</div>
</xpath>
</template>

</data>
</openerp>