Project profit percentage and expense percentage calc added
This commit is contained in:
parent
83f6ea35e6
commit
26517b2dac
|
@ -10,4 +10,9 @@ class AccountAnalyticLine(models.Model):
|
|||
|
||||
ispercentage = fields.Boolean(string="Is Percentage", default=False)
|
||||
percentage_rate = fields.Float(string="Percentage (%)")
|
||||
per_from_amt = fields.Float(string="Of", digits=(6, 2))
|
||||
per_from_amt = fields.Float(string="Of", digits=(6, 2))
|
||||
|
||||
@api.onchange('ispercentage', 'percentage_rate', 'per_from_amt')
|
||||
def onchange_amount(self):
|
||||
if self.ispercentage == True and self.percentage_rate > 0.0 and self.per_from_amt > 0.0:
|
||||
self.amount = - (self.per_from_amt * (self.percentage_rate / 100))
|
|
@ -102,6 +102,15 @@ class Project(models.Model):
|
|||
|
||||
values['dashboard'] = dashboard_values
|
||||
|
||||
# Profit Percentage added in COR Project
|
||||
try:
|
||||
profit_amount = profit['total']
|
||||
revenues_amount = profit['invoiced'] + profit['to_invoice'] + profit['other_revenues']
|
||||
profit_percent = round(profit_amount / revenues_amount * 100, 2) if revenues_amount else 0.0
|
||||
profit['profit_percent'] = profit_percent
|
||||
except Exception:
|
||||
profit['profit_percent'] = 0
|
||||
|
||||
#
|
||||
# Time Repartition (per employee per billable types)
|
||||
#
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<field name="model">account.analytic.line</field>
|
||||
<field name="inherit_id" ref="analytic.view_account_analytic_line_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='company_id']" position="after">
|
||||
<xpath expr="//field[@name='currency_id']" position="after">
|
||||
<separator string="Percentage"/>
|
||||
<field name="ispercentage"/>
|
||||
<field name="percentage_rate" attrs="{'invisible':[('ispercentage','=',False)]}"/>
|
||||
|
|
|
@ -6,6 +6,23 @@
|
|||
<field name="model">project.project</field>
|
||||
<field name="inherit_id" ref="sale_timesheet.timesheet_plan"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[hasclass('o_profitability_wrapper')]//div[hasclass('o_profitability_section')][2]//tr[7]"
|
||||
position="replace">
|
||||
<tr>
|
||||
<td class="o_timesheet_plan_dashboard_total">
|
||||
<b>
|
||||
<t t-esc="dashboard['profit']['total']"
|
||||
t-options='{"widget": "monetary", "display_currency": currency}'/>
|
||||
</b>
|
||||
</td>
|
||||
<td class="o_timesheet_plan_dashboard_cell">
|
||||
(<t t-esc="dashboard['profit']['profit_percent']"/> %)
|
||||
</td>
|
||||
<td>
|
||||
<b>Total</b>
|
||||
</td>
|
||||
</tr>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='o_timesheet_plan_sale_timesheet_people_time']/t/div/table/thead/tr/th[2]"
|
||||
position="after">
|
||||
<th>Hourly Rate</th>
|
||||
|
|
Loading…
Reference in New Issue