Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to change the view in a creation modal

Subscribe

Get notified when there's activity on this post

This question has been flagged
uiview_listmodalodoo13CE
3 Replies
6031 Views
Avatar
ALBRAHMS

Hi,

From the expense report form view, I can add a new expense line by clicking on "add a line". This open a search form, then I have to click on "Create"  to access to the creation form.

I want to skip the search view and show the create form when the modal open.

Is there a way to do this ?



EDIT:

I tried to add a control to the list with no success.


    <record id="view_hr_expense_sheet_form" model="ir.ui.view">
        <field name="model">hr.expense.sheet</field>
        <field name="inherit_id" ref="hr_expense.view_hr_expense_sheet_form" />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='expense_line_ids']/tree" position="after">
                <control>
                    <create string="Add new line" />
                </control>
            </xpath>
        </field>
    </record>

According to the documentation this should shows a button and remove the "Add a line" link.

regards








0
Avatar
Discard
Avatar
ALBRAHMS
Author Best Answer

I solved my problem.

I replaced the widget "many2many" by "one2many", now when I click on "add a line" it's open the creation form.



0
Avatar
Discard
Avatar
Muhammed Fasil
Best Answer

update view_mode  and view_id in record

<field name="view_mode">form</field>
<field
name="view_id" ref="sample_form_view"/>
0
Avatar
Discard
ALBRAHMS
Author

Fasil,

Thank you for your answer.

I'm not sure how I can use those tags. I can't find the related action.

The view I'm talking about is "hr_expense.view_hr_expense_sheet_form".

...

<notebook>

<page name="expenses" string="Expense">

<field name="expense_line_ids" nolabel="1" widget="many2many"

domain="[('state', '=', 'draft'), ('employee_id', '=', employee_id), ('company_id', '=', company_id)]"

options="{'reload_on_button': True}"

context="{'form_view_ref' : 'hr_expense.hr_expense_view_form_without_header', 'default_company_id': company_id}">

<tree decoration-danger="is_refused">

<field name="date" />

<field name="name" />

<field name="state" invisible="1" />

<field name="analytic_account_id"

domain="['|', ('company_id', '=', parent.company_id), ('company_id', '=', False)]"

groups="analytic.group_analytic_accounting" />

<field name="analytic_tag_ids" widget="many2many_tags"

groups="analytic.group_analytic_tags" />

<field name="message_unread" invisible="1" />

<field name="attachment_number" string=" " />

<button name="action_get_attachment_view" string="View Attachments" type="object"

icon="fa-paperclip" />

<field name="tax_ids" widget="many2many_tags" groups="account.group_account_user"

context="{'default_company_id': company_id}" />

<field name="company_id" />

<field name="currency_id" invisible="1" />

<field name="total_amount" />

<field name="company_currency_id" invisible="1" />

<field name="total_amount_company" groups="base.group_multi_currency" />

<field name="is_refused" invisible="True" />

</tree>

</field>

...

The "Add a line" button in the tree view seems to be generated dynamically.

Regards

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
how can i set a field default value on a form depends on the active company Solved
odoo13CE
Avatar
Avatar
Avatar
2
Sep 23
4778
Field `state` does not exist
odoo13CE
Avatar
Avatar
1
Dec 22
2833
UI issues in version 16
ui
Avatar
Avatar
1
Dec 22
3704
odoo 13: inverse name in comodel Solved
odoo13CE
Avatar
Avatar
Avatar
3
Nov 22
5240
Contacts visible to all users in a multi-company setup Odoo 13 CE Solved
odoo13CE
Avatar
Avatar
1
Nov 22
5538
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now