I am trying to add an attribute that has several totals from other tables and that influences the type of account it is in. For example in an account called "Bank" I have totals 5, 10, 15 and the sum of all those totals is 30. To do this I have two tables that are "document_ detail" and "account". In the table "document_detail" I have the total_debt attribute which in this attribute the totals of other products are added and the account of where "bank" is added in this case is added.
I have used this method to add but it does not:
@ api.multi
@ api.depends ("account_id") def _sum_of_credit (self): self.sum_total_credit = sum (line.total_credit for line in self) if self.account_id.title == "Cash" or self.account_id.title == "Bank" else 0
I attached an image to see what I want to reach: \photoexample https://ibb.co/1rZv0TV