Skip to Content
मेन्यू
This question has been flagged
3 Replies
1502 Views

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

Avatar
Discard

Are you using MTO? If not, where should the customer come from?

Author

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.

Best Answer

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:

  1. Use a server action, as per this answer
  2. Set the new field not to be stored.  I have had problems with this in the past, but it can be worth trying.


I think you could use the same logic to get the project name.

Avatar
Discard
Best Answer

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.

Avatar
Discard

Yes, that's correct. I had assumed that it was MTO.

Author Best Answer

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. 

Avatar
Discard

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.