Skip to content

Commit

Permalink
[MIG] sale_partner_address_restrict: migration to V17
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiMForgeFlow committed Dec 10, 2024
1 parent 0108f2a commit 73342b9
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 27 deletions.
4 changes: 2 additions & 2 deletions sale_partner_address_restrict/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Sale Partner Address Restrict

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

This module restricts the addresses to be used in the sales order form,
according to the partner selected.
This module restricts the addresses to be used in the sales order form
to only addresses of the selected customer.

**Table of contents**

Expand Down
4 changes: 2 additions & 2 deletions sale_partner_address_restrict/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Sale Partner Address Restrict",
"summary": "Restrict addresses domain in the sales order form"
" taking into account the partner selected",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Sales",
"website": "https://github.com/OCA/partner-contact",
"author": "ForgeFlow, Odoo Community Association (OCA)",
Expand All @@ -14,5 +14,5 @@
"depends": [
"sale",
],
"data": [],
"data": ["views/sale_order_view.xml"],
}
19 changes: 0 additions & 19 deletions sale_partner_address_restrict/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,3 @@ def _check_partner_addresses(self):
" of the selected partner or the selected partner itself."
)
)

@api.onchange("partner_id")
def _onchange_partner_id_domain(self):
domain = []
if self.partner_id:
domain = [
("commercial_partner_id", "=", self.partner_id.id),
"|",
("company_id", "=", False),
("company_id", "=", self.company_id.id),
]
else:
domain = [
"|",
("company_id", "=", False),
("company_id", "=", self.company_id.id),
]

return {"domain": {"partner_invoice_id": domain, "partner_shipping_id": domain}}
4 changes: 2 additions & 2 deletions sale_partner_address_restrict/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This module restricts the addresses to be used in the sales order form,
according to the partner selected.
This module restricts the addresses to be used in the sales order form to only
addresses of the selected customer.
4 changes: 2 additions & 2 deletions sale_partner_address_restrict/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ <h1 class="title">Sale Partner Address Restrict</h1>
!! source digest: sha256:026c9b3f140a8467f57aa94ea7d898de824516f18656d2d7e750a60246399e3b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/partner-contact/tree/17.0/sale_partner_address_restrict"><img alt="OCA/partner-contact" src="https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/partner-contact-17-0/partner-contact-17-0-sale_partner_address_restrict"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/partner-contact&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module restricts the addresses to be used in the sales order form,
according to the partner selected.</p>
<p>This module restricts the addresses to be used in the sales order form
to only addresses of the selected customer.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand Down
29 changes: 29 additions & 0 deletions sale_partner_address_restrict/views/sale_order_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form (in partner_invoicing_mode)</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="partner_invoice_id" position="attributes">
<attribute name="domain">[
('commercial_partner_id', '=', partner_id),
'|',
('company_id', '=', False),
('company_id', '=', company_id),
]</attribute>
</field>
<field name="partner_shipping_id" position="attributes">
<attribute name="domain">[
('commercial_partner_id', '=', partner_id),
'|',
('company_id', '=', False),
('company_id', '=', company_id),
]</attribute>
</field>
</field>
</record>
</odoo>

0 comments on commit 73342b9

Please sign in to comment.