@ -0,0 +1,49 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Restrict Delivery Method |
|||
======================== |
|||
Restrict the delivery methods in both sales and website. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configuration is needed. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License, v3.0 (AGPL v3) |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developers: (V16) Shafna K, |
|||
(V17) Sabeel B, |
|||
(V18) Aysha Shalin, |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
---------- |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
------------------- |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import controllers |
|||
from . import models |
|||
from . import wizards |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': "Restrict Delivery Method", |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Website', |
|||
'summary': """Restrict the delivery methods in both sales and website.""", |
|||
'description': """This module helps to restrict the delivery methods for |
|||
certain products that set inside the shipping methods.""", |
|||
'author': " Cybrosys Techno Solutions", |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['sale_management', 'delivery', 'website_sale'], |
|||
'data': [ |
|||
'views/delivery_carrier_views.xml', |
|||
'views/sale_order_views.xml', |
|||
'wizards/choose_delivery_method_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import restrict_delivery_method |
@ -0,0 +1,65 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import _ |
|||
from odoo.addons.website_sale.controllers.payment import PaymentPortal |
|||
|
|||
from odoo.http import request, route |
|||
from odoo.tools import str2bool |
|||
|
|||
|
|||
class WebsiteSale(PaymentPortal): |
|||
""" This class is the inherited class and uses the function in that class |
|||
and super that function. """ |
|||
@route('/shop/checkout', type='http', methods=['GET'], auth='public', |
|||
website=True, sitemap=False) |
|||
def shop_checkout(self, try_skip_step=None, **query_params): |
|||
""" This function is overrode to update the delivery methods with |
|||
removing the restricted ones. """ |
|||
try_skip_step = str2bool(try_skip_step or 'false') |
|||
order_sudo = request.website.sale_get_order() |
|||
request.session['sale_last_order_id'] = order_sudo.id |
|||
|
|||
if redirection := self._check_cart_and_addresses(order_sudo): |
|||
return redirection |
|||
|
|||
checkout_page_values = self._prepare_checkout_page_values(order_sudo, |
|||
**query_params) |
|||
|
|||
can_skip_delivery = True # Delivery is only needed for deliverable products. |
|||
if order_sudo._has_deliverable_products(): |
|||
available_dms = order_sudo._get_delivery_methods() |
|||
checkout_page_values['delivery_methods'] = available_dms |
|||
checkout_page_values.update({'errors': []}) |
|||
if delivery_method := order_sudo._get_preferred_delivery_method(available_dms): |
|||
rate = delivery_method.rate_shipment(order_sudo) |
|||
if ( |
|||
not order_sudo.carrier_id |
|||
or not rate.get('success') |
|||
or order_sudo.amount_delivery != rate['price'] |
|||
): |
|||
order_sudo._set_delivery_method(delivery_method, rate=rate) |
|||
delivery_carriers = order_sudo._get_restrict_delivery_method() |
|||
checkout_page_values['delivery_methods'] = delivery_carriers.sudo() |
|||
|
|||
if try_skip_step and can_skip_delivery: |
|||
return request.redirect('/shop/confirm_order') |
|||
return request.render('website_sale.checkout', checkout_page_values) |
@ -0,0 +1,6 @@ |
|||
## Module <restrict_delivery_method> |
|||
|
|||
#### 22.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial Commit for Restrict Delivery Method |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import delivery_carrier |
|||
from . import sale_order |
@ -0,0 +1,58 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import _, api, fields, models |
|||
|
|||
|
|||
class DeliveryCarrier(models.Model): |
|||
""" This contains the fields added in shipping methods in odoo """ |
|||
_inherit = "delivery.carrier" |
|||
|
|||
restrict_product_ids = fields.Many2many('product.template', |
|||
string="Restrict Product", |
|||
help="Choose the products" |
|||
" to restrict from this " |
|||
"delivery method") |
|||
partner_warning = fields.Boolean(string="Warning", |
|||
help="Enable if partner " |
|||
"warning needed") |
|||
|
|||
def action_notification(self): |
|||
""" Function to show the sticky notification """ |
|||
return { |
|||
'type': 'ir.actions.client', |
|||
'tag': 'display_notification', |
|||
'params': { |
|||
'title': 'Warning', |
|||
'message': _("Default delivery method given for a partner" |
|||
" cannot be restricted!"), |
|||
'type': 'warning', |
|||
'sticky': False, |
|||
} |
|||
} |
|||
|
|||
@api.onchange('restrict_product_ids') |
|||
def _onchange_restrict_product_ids(self): |
|||
""" To show a warning when products are given for restriction """ |
|||
if self.restrict_product_ids: |
|||
self.partner_warning = True |
|||
else: |
|||
self.partner_warning = False |
@ -0,0 +1,56 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class SaleOrder(models.Model): |
|||
""" This class contains the compute function to calculate the restricted |
|||
delivery method. """ |
|||
_inherit = "sale.order" |
|||
|
|||
delivery_method_ids = fields.Many2many( |
|||
'delivery.carrier', |
|||
string="Delivery Method", |
|||
compute="_compute_delivery_method_ids", |
|||
help="Select delivery method for shipping", |
|||
readonly=False) |
|||
|
|||
@api.depends('order_line.product_template_id') |
|||
def _compute_delivery_method_ids(self): |
|||
""" This function helps to calculate the delivery method for a sale order |
|||
based on the field in delivery carrier model. """ |
|||
for rec in self: |
|||
delivery = (self.env['delivery.carrier'].search( |
|||
[('restrict_product_ids', 'in', |
|||
rec.order_line.product_template_id.ids)])) |
|||
if delivery: |
|||
self.delivery_method_ids = [(4, ids) for ids in delivery.ids] |
|||
else: |
|||
self.delivery_method_ids = False |
|||
|
|||
def _get_restrict_delivery_method(self): |
|||
""" From this function the controller gets the restricted methods value """ |
|||
address = self.delivery_method_ids |
|||
return self.env['delivery.carrier'].sudo().search( |
|||
[('website_published', '=', True), |
|||
('id', 'not in', address.ids)]).available_carriers( |
|||
address, order=None) |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 165 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 47 KiB |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Inherited form view of delivery carrier to include the option to add |
|||
products to be restricted --> |
|||
<record id="view_delivery_carrier_form" model="ir.ui.view"> |
|||
<field name="name"> |
|||
delivery.carrier.view.form.inherit.restrict.delivery.method |
|||
</field> |
|||
<field name="model">delivery.carrier</field> |
|||
<field name="inherit_id" ref="delivery.view_delivery_carrier_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//group[@name='delivery_details']" position="after"> |
|||
<group> |
|||
<label for="restrict_product_ids"/> |
|||
<div> |
|||
<field name="restrict_product_ids" |
|||
widget="many2many_tags" class="oe_inline"/> |
|||
<button type="object" name="action_notification" |
|||
class="o_tz_warning fa fa-exclamation-triangle position-static align-self-center m-0 ms-2 oe_inline" |
|||
invisible="partner_warning == False"/> |
|||
<field name="partner_warning" invisible="1"/> |
|||
</div> |
|||
</group> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,16 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Inherited form view of sale order to add delivery method field --> |
|||
<record id="view_order_form" model="ir.ui.view"> |
|||
<field name="name"> |
|||
sale.order.view.form.inherit.restrict.delivery.method |
|||
</field> |
|||
<field name="model">sale.order</field> |
|||
<field name="inherit_id" ref="sale.view_order_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//group[@name='sale_shipping']" position="inside"> |
|||
<field name="delivery_method_ids" widget="many2many_tags"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import choose_delivery_carrier |
@ -0,0 +1,33 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ChooseDeliveryCarrier(models.TransientModel): |
|||
""" This class contains the fields in wizard which is related |
|||
to that particular sale order. """ |
|||
_inherit = "choose.delivery.carrier" |
|||
|
|||
delivery_method_ids = fields.Many2many('delivery.carrier', |
|||
related='order_id.' |
|||
'delivery_method_ids', |
|||
help="Choose the delivery method") |
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Inherited form view of choose delivery carrier to show the delivery |
|||
methods excluding that delivery method for which it is restricted --> |
|||
<record id="choose_delivery_carrier_view_form" model="ir.ui.view"> |
|||
<field name="name"> |
|||
choose.delivery.carrier.view.form.inherit.restrict.delivery.method |
|||
</field> |
|||
<field name="model">choose.delivery.carrier</field> |
|||
<field name="inherit_id" |
|||
ref="delivery.choose_delivery_carrier_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="carrier_id" position="attributes"> |
|||
<attribute name="domain">[('id', 'in', available_carrier_ids),('id', 'not in', delivery_method_ids)]</attribute> |
|||
</field> |
|||
<field name="display_price" position="before"> |
|||
<field name="delivery_method_ids" widget="many2many_tags" |
|||
invisible="1"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
</odoo> |