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 fill the note field automatically in product_id_change()

Subscribe

Get notified when there's activity on this post

This question has been flagged
note
4 Replies
8780 Views
Avatar
mohamed abdelwahed

hello everybody , i want to know how can i put some notes in the "note" fields in sale.order obj from the product_id_change() function ???

1
Avatar
Discard
Avatar
ClueLogics Technologies Pvt. Ltd.
Best Answer

Hi mohamed abdelwahed

you can override method product_id_change as like below

example:

def product_id_change(self, cr, uid, ids, uom_id,uom_po_id, context=None):
   vals = super(sale_order, self).product_id_change(cr, uid, ids, uom_id, uom_po_id)
   note = "Mys Notes"
   vals['value'].update({'note':note})
   return vals

Good Luck Thanks

5
Avatar
Discard
mohamed abdelwahed
Author

i inherit the "sale.order.line" and i override the product_id_change() but nothing seems to work :/

ClueLogics Technologies Pvt. Ltd.

i gave an example , in real case you should use the place of vals.update({'note':note}) to vals['value'].update({'note':note})

ClueLogics Technologies Pvt. Ltd.

for your information , there is no field note in sale.order.line object

mohamed abdelwahed
Author

i know that there is no field "note" in "sale.order.line" but my question is to know if there is a trick that allow me to access the "sale.order" field from "sale.order.line"

Avatar
le_dilem
Best Answer

Hi you can not use product_id_change in sale.order. Because it is in sale.order.line

Sale.order = the header Sale.order.line = a detail

So in sale.order.line you generates a field with product_id_change ans in sale.order you change your field note in function.

the principle of this function :

she travels sale.order.line your field x_discount, and affect in the header "note".

2
Avatar
Discard
mohamed abdelwahed
Author

thanks le dilem for all your support but i'm a newbie in openerp and python so i can't understand your solution :/ i'm really stacked

le_dilem

ok step by step : http://help.openerp.com/question/16336/how-i-can-create-module-openerp-7/

mohamed abdelwahed
Author

can you add me on facebook so we can speak french please here is my profile facebook.com/looser87

Avatar
Keyur
Best Answer

You can set note field of sale.order model by overriding product_id_change() method.

Here is the example,

def product_id_change(self, cr, uid, ids, .. ):
    vals = super(your_class, self).product_id_change(cr, uid, ids, uom_id, uom_po_id)
    note = "My Sale Order note"
    vals = {'value':{'note':note}}
    return vals
1
Avatar
Discard
Avatar
mohamed abdelwahed
Author Best Answer

thank you sir but here is my code and it dont seems to work

class sale_order(osv.osv):

_name='sale.order'
_inherit='sale.order'

def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
    uom=False, qty_uos=0, uos=False, name='', partner_id=False,
    lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
    vals = super(sale_order, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
    uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
    lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
    note = "Mys Notes"
    vals.update({'note':note})
    return vals

sale_order()

0
Avatar
Discard
Keyur

Please add your query in comment section not in answer section & product_id_change method is not of sale.order model. It is of sale.order.line model. Hope now it will work. Thanks

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
New note access denied
note
Avatar
2
Mar 15
5544
Unable to hide fields Solved
note
Avatar
Avatar
Avatar
2
Mar 15
4929
Document type: Note, Operation: read in openerp 7?
note
Avatar
0
Mar 15
3936
How is the account.move.line name not shown in columns?
note section
Avatar
0
Jan 25
2125
Dedicated credit note sequence - What is this, what does it do in Journals app?
credit note dedicated
Avatar
0
Sep 22
3675
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