For the purposes of this question say I have the following tables Orders, Order Items, Items, Item Components and Components.
Orders with
- Items (one2many field connecting to Order-Items)
Order-Items has
- Order (many2one)
- Item (many2one)
Items
- Components (one2many field connecting to Item-Components)
Item Components has
- Item (many2one)
- Component(many2one)
I need a way to generate a list of all the component involved in an order, aka I need to pull the Item-Component details for every Item on the Order. I don't even particularly care whether or not it is broken out by part, but I can only use xml, computed fields, or server actions because I'm using Odoo Studio w/ Odoo Online.
I have tried to find a way to do it through related fields.
I have tried to find a way to do it through on views.
I have tried to find a way to do it through report views, although that is less than ideal.
At this point unless someone knows a trick for one of the above methods, I'm looking for a way to setup a server action to create a new record for every line in a one to many table so I can setup a Order-Item-Component table with the item-component details added every time an item is added to an order, but i'm not sure how to accomplish that inside of a server action. There is a ton of documentation about how to write into a one2many field, but I wasn't finding much about iterating out of a one2many field.
Hopefully, this isn't like the other night when I was trying to test an error message and getting frustrated it was throwing an error message. (Lesson there, despite the majority of the documentation still saying to use raise Warning, if you want it to be user-friendly you need to use raise UserError. But that doesn't mean that Warning won't raise an error :D)