Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Never mind. I figured it out :D
1) There is a field in account.invoice that is already related to account.invoice.line (named invoice_line_ids)
2) I created a new monetary field (x_sum_my_field) in account.invoice and added invoice_lines_ids as a dependency.
3) in the compute field, I wrote a simple code for summing the entries of my custom field (account.invoice.lines.x_my_field)
for record in self:
record['x_sum_my_field'] = sum(l.x_my_field for l in record.invoice_line_ids)
Hopefully it will help someone.
Just to answer the question is the title.. You can access fields of other objects by using a relational field (one2many in my case).
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
ACTIVATE DEVELOPER MODE
Solved
|
|
1
Aug 24
|
631 | |
Compute Fields
Solved
|
|
2
Jul 24
|
404 | |
|
1
Jan 24
|
420 | ||
|
2
Apr 24
|
1920 | ||
|
1
Jul 22
|
890 |