-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
[16.0][ADD] hr_timesheet_hours_billed #570
[16.0][ADD] hr_timesheet_hours_billed #570
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
PR Name must be have format [verion][ADD] module_name
Exmaple: [16.0][ADD] hr_timesheet_hours_billed
2f3dc42
to
8ab7b42
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File names must follow OCA rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM!
27d023b
to
d7e7969
Compare
@@ -29,7 +29,8 @@ def _inverse_approved(self): | |||
def create(self, vals_list): | |||
for vals in vals_list: | |||
if not vals.get("unit_amount_billed"): | |||
vals["unit_amount_billed"] = vals["unit_amount"] | |||
unit_amount = vals.get("unit_amount") | |||
vals["unit_amount_billed"] = 0.0 if not unit_amount else unit_amount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replace these 2 lines with a single one:
vals["unit_amount_billed"] = vals.get("unit_amount", 0.0)
5c2132d
to
81b8fae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR has the |
1 similar comment
This PR has the |
Hey @OCA/project-service-maintainers any chances to have this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tech review only. LG overall, some minor glitches.
"category": "Timesheet", | ||
"website": "https://github.com/OCA/timesheet", | ||
"maintainers": ["solo4games", "CetmixGitDrone"], | ||
"author": "Odoo Community Association (OCA), Cetmix", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls keep OCA at the end of the list
def _inverse_approved(self): | ||
user = self.env.user | ||
now = fields.Datetime.now() | ||
for record in self.filtered(lambda rec: rec.approved): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rule of thumb: if you don't need a variable w/ the result of filtered
to play with later, avoid this approach because you loop twice (possibly on the same recordset):
for record in self.filtered(lambda rec: rec.approved): | |
for record in self: | |
if not rec.approved: | |
continue |
"analytic_line_ids.approved", | ||
) | ||
def _compute_qty_delivered(self): | ||
"""This method compute the delivered quantity of the SO lines: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds more like a comment. A relevant info would be that you added some more field to depends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to write after this text something like
"Added analytic_line_ids.so_line, analytic_line_ids.unit_amount_billed, ..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Compute and write the delivered quantity of current SO lines, | ||
based on their related analytic lines. | ||
:param additional_domain: domain to restrict AAL to include in computation | ||
(required since timesheet is an AAL with a project ...) | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to write. Plus, having a get
method that writes can be misleading and sometime dangerous.
Regarding the format of docstring, I always recommend to follow https://peps.python.org/pep-0257/#multi-line-docstrings (which is kind of the same guideline we have for commit messages).
"""Compute and write the delivered quantity of current SO lines, | |
based on their related analytic lines. | |
:param additional_domain: domain to restrict AAL to include in computation | |
(required since timesheet is an AAL with a project ...) | |
""" | |
"""Retrieve delivered quantity by line. | |
$longer-explanation-here-if-you-like | |
:param additional_domain: domain to restrict AAL to include in computation | |
(required since timesheet is an AAL with a project ...) | |
""" |
uom.id: uom for uom in self.env["uom.uom"].browse(product_uom_ids) | ||
} | ||
for item in data: | ||
if not item["product_uom_id"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't this check be part of the domain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not, because this is contains tuple, so this will be hard to check it from domain, but I can check approved in domain
so_line = lines_map[so_line_id] | ||
result.setdefault(so_line_id, 0.0) | ||
uom = product_uom_map.get(item["product_uom_id"][0]) | ||
if item.get("approved"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here as it seems non approved lines and lines w/o uom are totally ignored here
@tagged("-at_install", "post_install") | ||
class TestCommonHourBilled(TestCommonSaleTimesheet): | ||
# @classmethod | ||
def setUp(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to setUpClass and disable tracking unless you need it for functional purposes
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
This module allows to specify billed amount of time in timesheet while still keeping original time tracked. Additional field "Hours Billed" and "Approved" "Approved by" and "Approved on" are added to timesheet. These fields are visible only for "Timesheets: Administrator" group
c3124d9
to
24ef59c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, if I understand correctly, this module allows to:
- specify an invoicable amount
- adds fields to manage the approval status of the analytic lines
The base features of rounding are already present into sale_timesheet_rounding
https://github.com/OCA/timesheet/tree/15.0/sale_timesheet_rounded
I think it would be better if you port the already existing module and add a new one with the features of approval
I can not understand what the meaning of using sale_timesheet_rounding module, because, if I understand correctly, there is only rounding mechanism, but in hr_timesheet_hours_billed module we use approval mechanism to invoice only "approved" timesheets. |
Thank you for the hint! Sounds reasonable. We will check this. |
Hello @solo4games , Adding a field Hours Billed This feature possibility is fully covered in The module, will add
This means it covers the possibility to keep track of the real time (for HR purpose), to maybe reduce manually the time to be invoiced or event better, to round it by default if your policy on support is to round hours to a given amount of time. The only thing that is not handled into the module we created, is the strict handling of the approval that you're adding. So my proposition is to migrate the module |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
This module allows to specify billed amount of time in timesheet while still keeping original time tracked. Additional field "Hours Billed" and "Approved" "Approved by" and "Approved on" are added to timesheet. These fields are visible only for "Timesheets: Administrator" group