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

Add customer name manufacturing order

Subscribe

Get notified when there's activity on this post

This question has been flagged
salesmanufacturingManufacturing Order
1 Reply
3712 Views
Avatar
Aunchalee
By follow this

Firstly, open Studio on the Manufacturing Order and add a 'Many2One' field that is linked to the 'Sales Order' model.

Secondly, create an automated action with the following settings:

- Model: Production Order

- Action To Do: Update the Record

- Trigger: On Creation

- Field: (Select the custom Many2One field that is linked to the sales order model)

- Evaluation Type: Python Expression

- Value: record.env['sale.order'].search([('name','=',record.origin)])

Thirdly, Add a Related Field on the Manufacturing Order using Studio. Use the path Sales Order > Customer > Display Name


I can't find "A Related Field" is the Thirdly Part

How to Add customer name in manufacturing order? 

Is there another way to Add customer name in manufacturing order? (uesing odoo online 16 - 17) 

Thank you 

0
Avatar
Discard
Lars Aam

Hello Chris.
We enter the sales order manually into the manuifacturong order, and collect som additional information. I will try your automatic action to be more efficient.
But we have another challenge: Multi level manufaturing and we want the sales order information also on the child order. We can have two or three levels below the top order. Do you have any tips to include that in automation?

Chris TRINGHAM

Hello Lars,
The same logic can be used anywhere if there is a link. For a child MO, the source is the parent MO. I think the fields Count of Source SO and Number of source MO will tell you whether the parent is an SO or MO.

Lars Aam

Hello Chris.
The field 'mrp_production_source_count' is not available to set criteria in the domain in the action. Confused there. But I will get help on the coding anyway, so we will solve it.

Chris TRINGHAM

Hello Lars,
It should be possible to add it to the Python code, something like this

if record.origin record and mrp_production_source_count:

Lars Aam

Thanks Chris
Your comment was very helpful. I will explain some details, if anybody else should be interested:

It was in the user interface where you can define the domain that the field 'Number of source' was not available to look up. But I could modify in that window where the code is generated. Just write the right field name on the right place. So domain for the action looks like this, so we do not run this action on child orders, and we do not need it on backorders:
["&", ("backorder_sequence", "=", 0), ("mrp_production_source_count", "=", 0)]

This is to select the top order. And the code to find the sales order number:

if record.origin:
order = env['sale.order'].search([('name','=',record.origin)])
record['x_studio_many2one_field_416E4'] = order.id

The top order is created first. We have MTO also on the semifinished products. So child order is generated after the top order. For those I wanted to copy the sales order number that exist in the top order. Or more correct - from the source order.
Domain filter is a little different, so we only run this action if the order is a child order and is not a backorder:
["&", ("backorder_sequence", "=", 0), ("mrp_production_source_count", "=", 1)]

Code to get the sales order number:
if record.origin:
order = env['mrp.production'].search([('name','=',record.origin)])
record['x_studio_many2one_field_416E4'] = order.x_studio_many2one_field_416E4

So today I could make our sales person happy as manual work is reduced.

Chris TRINGHAM

I suppose that you can't select mrp_production_source_count from the UI because it is a computed field. If you can enter it manually that is a good solution.

Avatar
Chris TRINGHAM
Best Answer

Create a many2one field on the Manufacturing Order (production.order) linked to Contacts (res.partner).  I called it x_studio_customer.

Create an Automated Action with Execute Python code as the Action and this should get you the customer:



if record.origin:
  order =  env['sale.order'].search([('name','=',record.origin)])
  record['x_studio_customer'] = order.partner_id


Substitute x_studio_customer with your field name


This can also be created as a server action.  I have added more checking to make it extra robust, but can't guarantee it will work in every case:


for record in records:
  order = False
  if record.origin:
      if record.sale_order_count:
          order = record.env['sale.order'].search([('name','=',record.origin)])
          if order:
            record['x_studio_customer'] = order.partner_id

This checks that 

  1. There is a source and
  2. There is a sales order in the source and 
  3. The sales order can be retrieved.  

This Python code can be used in the Automated Action (and if you create an Automated Action it can also be used as a Server Action).

Creating a contextual action lets you update the customer on existing manufacturing orders.


Check it with your configuration / version of Odoo

0
Avatar
Discard
Aunchalee
Author

Can you give me more guide on how to do it? I might do sometings wrong
the Customer name it's not showing.

Thank you sir

Chris TRINGHAM

I added a screenshot and some extra information

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 get a report about the Consumption of raw materials to delivery orders per month?
sales manufacturing
Avatar
Avatar
1
Jun 23
4385
Odoo16 Scheduling the Parent WO after Child WO
manufacturing Manufacturing Order
Avatar
0
Apr 23
2632
How to group and filter order lines for manufacturing order?
sales manufacturing
Avatar
0
Jan 23
3337
What does "Plan" do in a Manufacturing Order? v15 Solved
manufacturing Manufacturing Order
Avatar
Avatar
1
Sep 24
4688
How to do sale of per-customer custom-product that spawns manufacturing order. Solved
sales manufacturing
Avatar
Avatar
1
Jun 22
4054
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