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 can I update a record stored with the attribute noupdate="1"?

Subscribe

Get notified when there's activity on this post

This question has been flagged
6 Replies
48967 Views
Avatar
Robin Chatfield

I have a module that got the noupdate="1" attribute added to all views, actions and menuitems. Now those records can't be upgraded, even after the xml file in the module has been corrected. I'm already using the module, and would rather not have to reinstall it and lose the data.

Some options I've considered:

Find where the noupdate attribute is stored in the database, and change it for my records. Does anyone know how this can be done?

Delete all the records from the database. Tried it, and it works. Unfortunately the db crashes before I've goten all the records, and then I have to restore and am back to square one.

Export the data, uninstall module, reinstall, and import the data again.

4
Avatar
Discard
Mansi Kariya (mka)

Do you want to improve those views?

CARLOS ALBERTO GARCIA BRIZUELA

The first answer in this web page works well for me:

https://stackoverflow.com/questions/38995280/in-odoo-how-to-force-overwriting-of-a-record-rule-which-is-defined-in-a-base-mod

Avatar
Muhammad Awais
Best Answer

For version 16.0

<function name="write" model="ir.model.data">
<value model="ir.model.data" search="[('module', '=', 'base'), ('name', '=', 'res_partner_rule_private_employee')]"/>
<value eval="{'noupdate': False}"/>
function>

<record id="base.res_partner_rule_private_employee" model="ir.rule">
<field name="groups" eval="[Command.set([ref('base.group_system')])]"/>
record>

<function name="write" model="ir.model.data">
<value model="ir.model.data" search="[('module', '=', 'base'), ('name', '=', 'res_partner_rule_private_employee')]"/>
<value eval="{'noupdate': True}"/>
function>

3
Avatar
Discard
Avatar
Muhammad Irfan
Best Answer

Other answers are okay, but if you want to do it using a XML file inside a module, you can try to do the following (change the model based on your needs):

<function name="write" model="ir.model.data">

            <!-- First we need to find the record...-->

            <function name="search" model="ir.model.data">

                <value

                  eval="[('module', '=', 'purchase'), ('name', '=', 'purchase_order_comp_rule')]"

                  />

            </function>

           <!-- ...and temporarily set the noupdate field to False-->

            <value eval="{'noupdate': False}" />

        </function>

       <!-- Get our main job done, i.e. modify the domain_force field of a record -->

        <record id="purchase.purchase_order_comp_rule" model="ir.rule">

            <field name="domain_force">[('company_id','=',user.company_id.id)]</field>

        </record>

       <!-- (Optional) Time to clean our dirty hand, set the previously noupdate False to True again -->

        <function name="write" model="ir.model.data">

            <function name="search" model="ir.model.data">

                <value

                  eval="[('module', '=', 'purchase'), ('name', '=', 'purchase_order_comp_rule')]"

                  />

            </function>

            <value eval="{'noupdate': True}" />

        </function>


Hope it helps!

*Sorry i'm not using the code tag to put the code above, for unknown reasons it behaves strangely.

22
Avatar
Discard
Jose Gpe Osuna

Thank you! I really liked this option

Pranav P S

Thanks a lot irfan...you made my day

S****** D******

Muhammad, your proposal is really nice.

It worked on a first try for me.

But in an other case, it does not work anymore.

I try to modify a sequence.

<function name="write" model="ir.sequence">

<function name="search" model="ir.sequence">

<value eval="[('module', '=', 'account'), ('name', '=', 'sequence_payment_customer_invoice')]"/>

</function>

<value eval="{'noupdate': False}" />

</function>

I have the following error :

"Invalid field 'module' in leaf "<osv.ExtendedLeaf: ('module', '=', 'account') on ir_sequence (ctx: )>

Dimas Aditya Kristianto

For future people. This is working in odoo 16. BUT!!! remove any comment inside the function tag. Because somehow odoo read it as passing argument. At least that was what happen to me. I will give this answer an upvote anyway (because it's working)

Avatar
Habib
Best Answer

Records that are created in xml files also create an external identifier which is named [module name].[id]

When noupdate="1" is specified in the xml data file, then the external identifier created has a field called noupdate set to True. Once this happens, it is impossible to update a record using xml.

You can find the external identifier in Technical -> Sequences and Identifiers -> External Identifiers. Find the id of the record you're looking for and uncheck the noupdate field. Once this is done, you can update the record using your xml data file.

I had a requirement for a module to update existing records which were previously set to noupdate. This had to be done in xml. To achieve this I did the following in the data file (new_module_data.xml)

1.I deleted the record

2. I re-created the record using the original identifier

<openerp>
<data noupdate="0">
<delete id="old_module_name.identifier" model="old_module_name.model"/>
<record id="old_module_name.identifier" model="old_module_name.model">
...
</record>
</data>
</openerp>
5
Avatar
Discard
omar ahmed

i used your answer and it works but i have 2 questions :

1 - is ID of new record must be like the old one ?

2 - is there any dangerous to delete this record ?

thanks

Oleksandr Komarov

If model have a links with other models,

which launched as cascade delete,

then you got a problem in record

<delete id="old_module_name.identifier" model="old_module_name.model"/>

Avatar
Ivan
Best Answer

The noupdate is stored in the ir_model_data table.  Just change the noupdate column to FALSE for the record (search it using the XML ID against the name column).  This will allow you to make "noupdate" records to be updateable in the future.

If you want to just change something in the records created by the data XML, I would recommend that you just change it via the application, e.g. for ir.ui.view --> through Settings >> Technical >> User Interface >> Views.

4
Avatar
Discard
Avatar
Mokrani lilya
Best Answer

Thanks a lot! @ Muhammad Irfan

It worked for me but without comments


name="write" model="ir.model.data">
name="search" model="ir.model.data">
eval="[('module', '=', 'sale'), ('name', '=', 'sale_order_personal_rule')]" />

eval="{'noupdate': False}"/>







1
Avatar
Discard
Avatar
Jasmin Hirani
Best Answer

Your solution is right but the syntax have a little correction.  For any Function in version 18.0 


<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'purchase'), ('name', '=', 'seq_purchase_order')]"/>
</function>
<value eval="{'noupdate': False}"/>
</function>

<record id="purchase.seq_purchase_order" model="ir.sequence">
<field name="Your Field"> Your Changes of Value </field>
</record>

<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'purchase'), ('name', '=', 'seq_purchase_order')]"/>
</function>
<value eval="{'noupdate': True}"/>
</function>

0
Avatar
Discard
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
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