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

[16.0][MIG] website_sale_delivery_product_restriction: migration to 16.0 #28

Open
wants to merge 11 commits into
base: 16.0
Choose a base branch
from
Open
6 changes: 6 additions & 0 deletions setup/website_sale_delivery_product_restriction/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git+https://github.com/coopiteasy/addons@16.0-mig-delivery_product_restriction#subdirectory=setup/delivery_product_restriction
65 changes: 65 additions & 0 deletions website_sale_delivery_product_restriction/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
=========================================
Website Sale Delivery Product Restriction
=========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0b373bb3bdfa5915f7fec1ab97dbf50c792f703e9a946a8a5d34e5e06a68d354
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-coopiteasy%2Fcie--e--commerce-lightgray.png?logo=github
:target: https://github.com/coopiteasy/cie-e-commerce/tree/16.0/website_sale_delivery_product_restriction
:alt: coopiteasy/cie-e-commerce

|badge1| |badge2| |badge3|

This is a complement of the module `delivery_product_restriction` to
bring it's features into the eCommerce. It allows some product to be
shipped only by some delivery carrier. If such a product is found in a
SO then the SO can only be shipped via these delivery carrier.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/cie-e-commerce/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 <https://github.com/coopiteasy/cie-e-commerce/issues/new?body=module:%20website_sale_delivery_product_restriction%0Aversion:%2016.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 <https://coopiteasy.be>`_:

* Rémy Taymans

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

This module is part of the `coopiteasy/cie-e-commerce <https://github.com/coopiteasy/cie-e-commerce/tree/16.0/website_sale_delivery_product_restriction>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions website_sale_delivery_product_restriction/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions website_sale_delivery_product_restriction/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2022 Coop IT Easy SC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Website Sale Delivery Product Restriction",
"summary": (
"Allow some product to be shipped only by some delivery carrier and "
"also on eCommerce"
),
"version": "16.0.1.0.0",
"category": "Website",
"website": "https://coopiteasy.be",
"author": "Coop IT Easy SC",
"license": "AGPL-3",
"depends": [
"delivery_product_restriction",
"website_sale_delivery",
],
}
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_delivery_product_restriction
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.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_delivery_product_restriction
#: model:ir.model,name:website_sale_delivery_product_restriction.model_sale_order
msgid "Sale Order"
msgstr ""

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
21 changes: 21 additions & 0 deletions website_sale_delivery_product_restriction/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2022 Coop IT Easy SC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


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

# another way would be to override
# delivery.carrier._is_available_for_order() (defined in the delivery
# module and called by sale.order._get_delivery_methods() in the
# website_sale_delivery module), but this would have to map the products
# for each delivery.carrier, so this is more optimal.
def _get_delivery_methods(self):
products = list(self.order_line.mapped("product_id"))
return (
super()
._get_delivery_methods()
.filtered(lambda c: c._can_be_used_to_deliver_products(products))
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Rémy Taymans
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This is a complement of the module `delivery_product_restriction` to
bring it's features into the eCommerce. It allows some product to be
shipped only by some delivery carrier. If such a product is found in a
SO then the SO can only be shipped via these delivery carrier.
Loading
Loading