Hi guys, it's possible to add a custom field on the manufacturing order panel to see customer name and project name link to each order? Im on Odoo 17 with studio. I see many tutorials but doesn't work in this version.
any ideas??
Thanks
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi guys, it's possible to add a custom field on the manufacturing order panel to see customer name and project name link to each order? Im on Odoo 17 with studio. I see many tutorials but doesn't work in this version.
any ideas??
Thanks
If you are using MTO, you can get the customer from the sales order.
Enable Developer Mode.
Create a many2one field on the Manufacturing Order (production.order) linked to Contacts (res.partner).
Here's how to do it in Studio:
Now we can add some Python code to get the customer from the sales order (if you are using MTO).
First I renamed the field to x_studio_customer but that is optional.
Then click on MORE in the left-hand panel.
After you click on MORE you will see the field details:
for record in self:
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
[Extra lines of code added]
Once completed, this shows the customer from the sales order (for MTO):
NOTE:
This works when a Manufacturing Order is created on confirmation of a sales order. It won't set the customer for existing sales orders.
For that, there are two options:
I think you could use the same logic to get the project name.
The search method may return nothing if the origin field is not populated. He may need to ensure he is running MTO, so the origin field gets populated.
Yes, that's correct. I had assumed that it was MTO.
thanks I follow the steps but I cannot change the field name, give me this error:
Missing Record
Record does not exist or has been deleted.
(Record: ir.ui.view(6066,), User: 2) and when I change it to the code nothing happens.
Hi Daniel, you don't need to change the field name, but I don't understand why you get this error message. I have updated my answer to make it more comprehensive.
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
Are you using MTO? If not, where should the customer come from?
im using MTO, i follow the same steps tha you give me, but same error, something like this
Missing Record
Record does not exist or has been deleted. (Record: ir.ui.view(6066,), User: 2)
even if i dont change the field name or technical name, the error pops again, if i dont change any values and i follow the same steps just changing the name in the code then the field appears without information.
Hi Daniel - adding the field in Studio will create or update an Extension View. The error message seems to be saying that either that Extension View doesn't exist, or the admin account is not authorized to it, both of which seem strange.