[FIX] sale, account: disable selection with a private address

Steps to repoduce:
	- create a customer with a private address (first select "individual" to show the selection field)
	- create a quotation (and/or invoice) and select this customer
	- this customer cannot receive an email and cannot be contacted afterwards (this behavior is intended)

Issue:
	- it's possible to choose this type of client

Cause:
	- there is no address type filter for this field

Solution:
	- add a condition in the domain of the field

opw-2909395

closes odoo/odoo#100487

X-original-commit: a24384b7ede2a132125d24681cba7056bc64ccbe
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2022-09-19 13:20:54 +02:00
parent e331d96412
commit 997c371a56
2 changed files with 2 additions and 1 deletions
@@ -773,6 +773,7 @@
context="{
'res_partner_search_mode': (context.get('default_move_type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt') and 'customer') or (context.get('default_move_type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') and 'supplier') or False,
'show_address': 1, 'default_is_company': True, 'show_vat': True}"
domain="[('type', '!=', 'private'), ('company_id', 'in', (False, company_id))]"
options='{"always_reload": True, "no_quick_create": True}'
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
<field name="partner_shipping_id"
+1 -1
View File
@@ -70,7 +70,7 @@ class SaleOrder(models.Model):
required=True, readonly=False, change_default=True, index=True,
tracking=1,
states=READONLY_FIELD_STATES,
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
domain="[('type', '!=', 'private'), ('company_id', 'in', (False, company_id))]")
state = fields.Selection(
selection=[
('draft', "Quotation"),