Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Sales - Project
Entity: project.project
Compute Method: _compute_real_cost
| Inputs | Method | Outputs |
|---|---|---|
|
+ cost_per_account = dict(self.env['account.analytic.line']._read_group( + domain=[('account_id', 'in', self.account_id.ids), ('amount', '<', 0)], + groupby=['account_id'], + aggregates=['amount:sum'], + )) + revenue_per_account = dict(self.env['account.analytic.line']._read_group( + domain=[('account_id', 'in', self.account_id.ids), ('amount', '>=', 0)], + groupby=['account_id'], + aggregates=['amount:sum'], + )) + for project in self: + project.real_cost = abs(cost_per_account.get(project.account_id, 0)) + total = project.real_cost + revenue_per_account.get(project.account_id, 0) + project.real_cost_ratio = 100 * (project.real_cost / total) if total else 0 |
|
