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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilitate
- Inventar
- PoS
- Project
- MRP
Această întrebare a fost marcată
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
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
- 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
- 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.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Înscrie-te