Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][OCA-PORT] sale_timesheet_line_exclude from 16.0 to 17.0 pr #707 #718 #719

Open
wants to merge 3 commits into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sale_timesheet_line_exclude/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
"application": False,
"summary": "Exclude Timesheet Line from Sale Order",
"depends": ["sale_timesheet"],
"data": ["views/account_analytic_line.xml", "views/project_task.xml"],
"data": [
"security/exclude_from_sale_order.xml",
"views/account_analytic_line.xml",
"views/project_task.xml",
],
}
6 changes: 4 additions & 2 deletions sale_timesheet_line_exclude/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class AccountAnalyticLine(models.Model):
exclude_from_sale_order = fields.Boolean(
string="Non-billable",
help="Checking this would exclude this timesheet entry from Sale Order",
groups="sale_timesheet_line_exclude.group_exclude_from_sale_order",
copy=False,
)

@api.constrains("exclude_from_sale_order")
Expand All @@ -36,8 +38,8 @@ def _compute_timesheet_invoice_type(self):
return res

@api.depends("exclude_from_sale_order")
def _compute_so_line_on_exclude(self):
self._compute_so_line()
def _compute_so_line(self):
return super()._compute_so_line()

def _timesheet_determine_sale_line(self):
self.ensure_one()
Expand Down
14 changes: 14 additions & 0 deletions sale_timesheet_line_exclude/security/exclude_from_sale_order.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright ACSONE SA/NV (https://acsone.eu)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="group_exclude_from_sale_order" model="res.groups">
<field name="name">Exclude timesheets from sale order</field>
<field name="category_id" ref="base.module_category_hidden" />
<field
name="comment"
>Gives access to the Non-Billable field on timesheets.</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ def test_write_exclude_from_sale_order(self):
"account_id": self.project.analytic_account_id.id,
}
)
self.assertTrue(timesheet.so_line)
timesheet.write({"exclude_from_sale_order": True})
self.assertFalse(timesheet.so_line)

self.assertEqual(timesheet.timesheet_invoice_type, "non_billable")
self.assertEqual(self.sale_order_line.qty_delivered, 0)
Expand Down
Loading