Skip to Content
Menú
This question has been flagged
2 Respostes
317 Vistes

I want to add a custom field in sales order "Name" which I have done and when I create an invoice from that sales order I want it to keep that name in that custom field. I have tried creating the custom field in the sales order and then making another one for invoice form and making the related field description x_studio_name, however, it still does not hold the name

Avatar
Descartar
Autor Best Answer

I tried to create a new field inside of account.move call invoice_person_name. I entered the information you gave as the computation field, however, it asked for dependencies so I used x_studio_name as dependency but this did not work

Avatar
Descartar
Best Answer

Hi Gabe,

It seems to me that you are using Odoo Studio to create the fields and the relations.

First of all you need to understand the relation between sales order and invoice

  1. Sales order and invoice are not directly related. Instead, they are related through Sales Order Line and Account Move Line. Because, in Odoo we can handle multiple Sales Order as One Invoice
  2. I would suggest you to create a computed field instead of doing relational fields, because you might face singleton issue.

A simple computation field can be like this in the AccountMove model, you can add it with Odoo Studio

for record in self:

​record['x_studio_name'] = record.mapped('invoice_line_ids.sale_line_ids.name')


You can test the code and change accordingly, ensure you are working on a development environment

Hope this helps.

Avatar
Descartar