Skip to content

Commit

Permalink
[IMP] sale_timesheet_round: add case when unit_amount_rounded null
Browse files Browse the repository at this point in the history
  • Loading branch information
sonhd91 committed Mar 27, 2024
1 parent b90cb7a commit 25b7202
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ odoo_test_flavor: Both
odoo_version: 15.0
org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups:
- sale_timesheet_rounded
rebel_module_groups: []
repo_description: 'TODO: add repo description.'
repo_name: timesheet
repo_slug: timesheet
Expand Down
6 changes: 4 additions & 2 deletions sale_timesheet_rounded/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def read_group(
if ctx_ts_rounded:
# To set the unit_amount_rounded value instead of unit_amount
for rec in res:
rec["unit_amount"] = rec["unit_amount_rounded"]
if rec.get("unit_amount_rounded"):
rec["unit_amount"] = rec["unit_amount_rounded"]
return res

def read(self, fields=None, load="_classic_read"):
Expand All @@ -111,5 +112,6 @@ def read(self, fields=None, load="_classic_read"):
if ctx_ts_rounded and read_unit_amount:
# To set the unit_amount_rounded value instead of unit_amount
for rec in res:
rec["unit_amount"] = rec["unit_amount_rounded"]
if rec.get("unit_amount_rounded"):
rec["unit_amount"] = rec["unit_amount_rounded"]
return res

0 comments on commit 25b7202

Please sign in to comment.