Skip to content

Commit

Permalink
[ADD] website_sale_order_type (OCA#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoRubi authored and david-s73 committed Sep 17, 2024
1 parent f45330d commit d97b244
Show file tree
Hide file tree
Showing 13 changed files with 654 additions and 0 deletions.
85 changes: 85 additions & 0 deletions website_sale_order_type/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
=======================
Website sale order type
=======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fe--commerce-lightgray.png?logo=github
:target: https://github.com/OCA/e-commerce/tree/10.0/website_sale_order_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-10-0/e-commerce-10-0-website_sale_order_type
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/113/10.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows `sale_order_type <https://github.com/OCA/sale-workflow/tree/10.0/sale_order_type>`__ to work with website_sale.

This module is useful for users having a sale order type defined in their Partner form:
when these users buy a product in the e-commerce, the sale order generated will have the same sale order type that is defined in their Partner form.

Note that the sale order type is defined contact by contact and not at Company level.

**Table of contents**

.. contents::
:local:

Usage
=====

#. In the backend (Sales -> Customers) set a sale order type in any contact;
#. Log in with the associated user in the e-commerce website and buy a product;
#. Check that the created sale oder has the same sale order type that has been set in the contact.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/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/e-commerce/issues/new?body=module:%20website_sale_order_type%0Aversion:%2010.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
~~~~~~~

* Agile Business Group

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

* Simone Rubino <[email protected]>

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.

This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/10.0/website_sale_order_type>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions website_sale_order_type/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
19 changes: 19 additions & 0 deletions website_sale_order_type/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Website sale order type",
"summary": "This module allows sale_order_type to work with website_sale.",
"version": "10.0.1.0.0",
"development_status": "Beta",
"category": "Website",
"website": "https://github.com/OCA/e-commerce/tree/"
"10.0/website_sale_order_type",
"author": "Agile Business Group, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": [
"website_sale",
"sale_order_type"
],
"auto_install": True
}
20 changes: 20 additions & 0 deletions website_sale_order_type/i18n/website_sale_order_type.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_order_type
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.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_sale_order_type
#: model:ir.model,name:website_sale_order_type.model_sale_order
msgid "Sales Order"
msgstr ""

4 changes: 4 additions & 0 deletions website_sale_order_type/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import sale_order
23 changes: 23 additions & 0 deletions website_sale_order_type/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class SaleOrder(models.Model):
_inherit = 'sale.order'

@api.multi
def _cart_update(
self, product_id=None, line_id=None, add_qty=0, set_qty=0,
attributes=None, **kwargs):
self.ensure_one()
res = super(SaleOrder, self)._cart_update(
product_id=product_id, line_id=line_id,
add_qty=add_qty, set_qty=set_qty, attributes=attributes, **kwargs)
if self.partner_id.sale_type:
self.type_id = self.partner_id.sale_type
self.onchange_type_id()
self.match_order_type()
return res
1 change: 1 addition & 0 deletions website_sale_order_type/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Simone Rubino <[email protected]>
6 changes: 6 additions & 0 deletions website_sale_order_type/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This module allows `sale_order_type <https://github.com/OCA/sale-workflow/tree/10.0/sale_order_type>`__ to work with website_sale.

This module is useful for users having a sale order type defined in their Partner form:
when these users buy a product in the e-commerce, the sale order generated will have the same sale order type that is defined in their Partner form.

Note that the sale order type is defined contact by contact and not at Company level.
3 changes: 3 additions & 0 deletions website_sale_order_type/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#. In the backend (Sales -> Customers) set a sale order type in any contact;
#. Log in with the associated user in the e-commerce website and buy a product;
#. Check that the created sale oder has the same sale order type that has been set in the contact.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d97b244

Please sign in to comment.