Odoo Help

0

How to hide the 'create' option on a field but not the 'create and edit' option?

By
Pascal Tremblay
on 2/19/17, 3:18 PM 854 views

Hello there,

On a sale order creation, I want to hide the 'create. option of the field partner_shipping_id. But I want to keep the 'create and edit' option.Is it possible?

So the user will have to edit his new partner on creation.

How to achieve this?


Actual code in my custom inherited view :

<xpath expr="//field[@name='partner_shipping_id']" position="attributes">
    <attribute name="domain">['&amp;',('parent_id','=',partner_id),('type','=','delivery')]</attribute>
    <attribute name="attrs">{'no_create': True}</attribute>
</xpath>


Image :



EDIT #1

The real problem is :

I have a new field on res.partner

partner_territory = fields.Many2one(comodel_name='res.territory', string='Partner\'s territory', required=True)

With the 'Create' option, a new shipping address (partner) is created without respecting the 'required=True' of my new field. The partner is created and the field partner_territory stays empty. Isn't it weird?

With the  'Create and Edit...', a new window opens and the user must fill the field parnter_territory. Fine.


What do you think about this?


0

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
6519
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 4/16/18, 6:51 AM

Many2one widget (default)

Options : Other possible options you can use with this widget.

  • no_quick_create - It will remove Create and edit... option.
  • no_create_edit - It will remove Create "entered text" option.
  • no_create - no_quick_create and no_create_edit combined.
  • no_open - in read mode: do not render as a link.

Example:

<field name="field_name" options="{'no_quick_create': True, 'no_create_edit' : True}"/>

You can refer it from  Here

0

Pascal Tremblay

--Pascal Tremblay--
1759
| 5 3 7
Alma, Canada
--Pascal Tremblay--


Pascal Tremblay
On 2/20/17, 8:31 AM

I have found the right way to write it. With this, the 'Create' option is invisible. The 'Create and edit...' is still there.

<xpath expr="//field[@name='partner_shipping_id']" position="attributes">
    <attribute name="domain">['&amp;',('parent_id','=',partner_id),('type','=','delivery')]</attribute>
     <attribute name="options">{'no_quick_create':True}</attribute>
</xpath>


But it doesn't explain to me why the 'Create' option can create a new partner WITHOUT respecting 'Required=True' of a field declaration...


 

0
Randall Castro
On 8/17/17, 7:22 PM

Hi Pascal !

You can write attributes to avoid create and create and edit fields in many2one fields with this code:

Regards,

<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="options">{'no_quick_create':True,'no_create_edit':True}</attribute>
</xpath>

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 2/19/17, 3:18 PM
Seen: 854 times
Last updated: 4/16/18, 10:14 AM