Skip to content
Snippets Groups Projects
Commit 8dd4daf0 authored by OCA Git Bot's avatar OCA Git Bot
Browse files

Merge remote-tracking branch 'odoo/14.0' into 14.0

parents 1561a5cb 1ac274c3
No related branches found
No related tags found
No related merge requests found
......@@ -130,12 +130,12 @@ class Task(models.Model):
def _compute_effective_hours(self):
if not any(self._ids):
for task in self:
task.effective_hours = round(sum(task.timesheet_ids.mapped('unit_amount')), 2)
task.effective_hours = sum(task.timesheet_ids.mapped('unit_amount'))
return
timesheet_read_group = self.env['account.analytic.line'].read_group([('task_id', 'in', self.ids)], ['unit_amount', 'task_id'], ['task_id'])
timesheets_per_task = {res['task_id'][0]: res['unit_amount'] for res in timesheet_read_group}
for task in self:
task.effective_hours = round(timesheets_per_task.get(task.id, 0.0), 2)
task.effective_hours = timesheets_per_task.get(task.id, 0.0)
@api.depends('effective_hours', 'subtask_effective_hours', 'planned_hours')
def _compute_progress_hours(self):
......
......@@ -499,3 +499,31 @@ class TestTimesheet(TestCommonTimesheet):
self.assertEqual(timesheet.product_uom_id, self.project_customer.company_id.project_time_mode_id,
"The product_uom_id of the timesheet should be equal to the project's company uom "
"if the project's analytic account has no company_id")
def test_percentage_of_planned_hours(self):
""" Test the percentage of planned hours on a task. """
self.task1.planned_hours = round(11/60, 2)
self.assertEqual(self.task1.effective_hours, 0, 'No timesheet should be created yet.')
self.assertEqual(self.task1.progress, 0, 'No timesheet should be created yet.')
self.env['account.analytic.line'].create([
{
'name': 'Timesheet',
'project_id': self.project_customer.id,
'task_id': self.task1.id,
'unit_amount': 3/60,
'employee_id': self.empl_employee.id,
}, {
'name': 'Timesheet',
'project_id': self.project_customer.id,
'task_id': self.task1.id,
'unit_amount': 4/60,
'employee_id': self.empl_employee.id,
}, {
'name': 'Timesheet',
'project_id': self.project_customer.id,
'task_id': self.task1.id,
'unit_amount': 4/60,
'employee_id': self.empl_employee.id,
},
])
self.assertEqual(self.task1.progress, 100, 'The percentage of planned hours should be 100%.')
......@@ -3404,6 +3404,39 @@
}),
]"/>
</record>
<record id="account_tax_template_p_irpf24_rdc" model="account.tax.template">
<field name="type_tax_use">purchase</field>
<field name="name">Retenciones IRPF 24% (Rendimientos del capital)</field>
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
<field name="amount" eval="-24"/>
<field name="amount_type">percent</field>
<field name="tax_group_id" ref="tax_group_retenciones_24"/>
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
(0,0, {
'factor_percent': 100,
'repartition_type': 'base',
}),
(0,0, {
'factor_percent': 100,
'repartition_type': 'tax',
'account_id': ref('l10n_es.account_common_4751'),
}),
]"/>
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
(0,0, {
'factor_percent': 100,
'repartition_type': 'base',
}),
(0,0, {
'factor_percent': 100,
'repartition_type': 'tax',
'account_id': ref('l10n_es.account_common_4751'),
}),
]"/>
</record>
<record id="account_tax_template_s_irpf20" model="account.tax.template">
<field name="description">Retención 20%</field>
<field name="type_tax_use">sale</field>
......@@ -3506,6 +3539,40 @@
}),
]"/>
</record>
<record id="account_tax_template_s_irpf24_rdc" model="account.tax.template">
<field name="description">Retención 24% (Rendimientos del capital)</field>
<field name="type_tax_use">sale</field>
<field name="name">Retenciones a cuenta IRPF 24%</field>
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
<field name="amount" eval="-24"/>
<field name="amount_type">percent</field>
<field name="tax_group_id" ref="tax_group_retenciones_24"/>
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
(0,0, {
'factor_percent': 100,
'repartition_type': 'base',
}),
(0,0, {
'factor_percent': 100,
'repartition_type': 'tax',
'account_id': ref('l10n_es.account_common_473'),
}),
]"/>
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
(0,0, {
'factor_percent': 100,
'repartition_type': 'base',
}),
(0,0, {
'factor_percent': 100,
'repartition_type': 'tax',
'account_id': ref('l10n_es.account_common_473'),
}),
]"/>
</record>
<record id="account_tax_template_p_iva12_agr" model="account.tax.template">
<field name="description"/> <!-- for resetting the value on existing DBs -->
<field name="type_tax_use">purchase</field>
......
......@@ -13,7 +13,7 @@ const TableOfContent = publicWidget.Widget.extend({
*/
async start() {
await this._super(...arguments);
this.$scrollingElement = $().getScrollingElement();
this.$scrollingElement = this.$target.closest(".s_table_of_content").closestScrollable();
this.previousPosition = -1;
this._updateTableOfContentNavbarPosition();
extraMenuUpdateCallbacks.push(this._updateTableOfContentNavbarPosition.bind(this));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment