diff --git a/sale_partner_shipping_filter_with_customer/__init__.py b/sale_partner_shipping_filter_with_customer/__init__.py new file mode 100644 index 0000000..947f3a3 --- /dev/null +++ b/sale_partner_shipping_filter_with_customer/__init__.py @@ -0,0 +1,5 @@ +# coding: utf-8 +# © 2017 Chafique DELLI @ Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/sale_partner_shipping_filter_with_customer/__manifest__.py b/sale_partner_shipping_filter_with_customer/__manifest__.py new file mode 100644 index 0000000..57bf13f --- /dev/null +++ b/sale_partner_shipping_filter_with_customer/__manifest__.py @@ -0,0 +1,21 @@ +# coding: utf-8 +# © 2017 Chafique DELLI @ Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Partner Shipping Filter with Customer', + 'summary': "Shows only delivery addresses that are linked " + "with the customer", + 'version': '10.0.1.0.0', + 'category': 'Sale Management', + 'website': 'http://akretion.com', + 'author': 'Akretion, Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'installable': True, + 'depends': [ + 'sale', + ], + 'data': [ + 'views/sale_view.xml', + ] +} diff --git a/sale_partner_shipping_filter_with_customer/models/__init__.py b/sale_partner_shipping_filter_with_customer/models/__init__.py new file mode 100644 index 0000000..68faef7 --- /dev/null +++ b/sale_partner_shipping_filter_with_customer/models/__init__.py @@ -0,0 +1,5 @@ +# coding: utf-8 +# © 2017 Chafique DELLI @ Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import sale diff --git a/sale_partner_shipping_filter_with_customer/models/sale.py b/sale_partner_shipping_filter_with_customer/models/sale.py new file mode 100644 index 0000000..66069f0 --- /dev/null +++ b/sale_partner_shipping_filter_with_customer/models/sale.py @@ -0,0 +1,12 @@ +# coding: utf-8 +# © 2017 Chafique DELLI @ Akretion +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields + + +class SaleOrder(models.Model): + _inherit = 'sale.order' + + commercial_partner_id = fields.Many2one( + related='partner_id.commercial_partner_id', readonly=True) diff --git a/sale_partner_shipping_filter_with_customer/views/sale_view.xml b/sale_partner_shipping_filter_with_customer/views/sale_view.xml new file mode 100644 index 0000000..ef8ba6e --- /dev/null +++ b/sale_partner_shipping_filter_with_customer/views/sale_view.xml @@ -0,0 +1,21 @@ + + + + + + sale.order + + + + + + + ['|', + ('id', '=', partner_id), '&', + ('type','=', 'delivery'), '&', + ('id', 'child_of', commercial_partner_id), ('parent_id', '!=', False)] + + + + +