Skip to Content
Menu
This question has been flagged
3 Replies
3338 Views

How is it possible to force sales only to companies and not the contacts attached to the company?


Example:

- Company: Odoo S.A.

- Contacts in Odoo: Mitchel and Mike

- Standard behaviour in a new quotation: write "Odoo" in customer field and the system suggests Odoo S.A. & Odoo S.A., Mitchel & Odoo S.A., Mike

- Desired behaviour in a new quotation: write "Odoo" in customer field and the system suggests only Odoo S.A.


I dont know about other countries but in Spain you should only invoice to companies and not the contact of the company as this customer field in quotations is taken until the end to the invoice creation

Avatar
Discard
Best Answer

Hi,

You can change the domain of the partner field to only show company records in dropdown.

The following code can be used

<odoo>
<data>
<record id="sale_order_form_view_inherit" model="ir.ui.view">
           <field name="name">Sale Order Form View Inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="domain">[('is_company', '=', True)]</attribute>
</xpath>
</field>
</record>
</data>
</odoo>
Avatar
Discard
Author

Thanks Divyansh, I will try the modification. The code you propos seems to do what I need

Best Answer

As an option, you can set an "invoicing address". If set, it will be used for all the invoices by default. Just add a new contact-address to the partner and mark the radio button "invoicing address".

You can also go to Sales / Configuration / Settings / Quotations & Orders and mark the check "Customer Addresses". This lets you choose the addreces for delivering and invoicing in every single quotation or sales order. 

Hope this helps to you. 


Avatar
Discard
Best Answer

Hi,

If you are familiar with adding codes, then you can use the example code below.

<odoo>
<data>
<record id="view_sale_order_form_inherit" model="ir.ui.view">
<field name="name">sale.order.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="replace">
<field name="partner_id" widget="res_partner_many2one"
context="{'res_partner_search_mode': 'customer', 'show_address': 1, 'show_vat': True}"
options='{"always_reload": True}'
domain="[('is_company', '=', True)]"/>
</xpath>
</field>
</record>
</data>
</odoo>

Regards

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 24
31
1
Dec 24
77
0
Nov 24
53
0
Nov 24
68
1
Oct 24
171