Skip to content

Commit

Permalink
[FIX] sale_timesheet_invoice_description: Fix bug TID
Browse files Browse the repository at this point in the history
Fix bug of setting Timesheet Invoice Description field as false by default or in the configuration and sales view
Improve sale model allowing for a False situation of Timesheet Invoice Description
  • Loading branch information
mario committed Apr 30, 2024
1 parent 1f08500 commit 6352247
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions sale_timesheet_invoice_description/models/res_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ResConfigSettings(models.TransientModel):
selection="_get_timesheet_invoice_description",
string="Timesheet Invoice Description",
default_model="sale.order",
default="000",
)

@api.model
Expand Down
2 changes: 2 additions & 0 deletions sale_timesheet_invoice_description/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def _get_timesheet_invoice_description(self):

def _get_timesheet_details(self, timesheet, desc_rule):
details = []
if not desc_rule:
return details
if desc_rule[0] == "1":
details.append(fields.Date.to_string(timesheet.date))
if desc_rule[1] == "1":
Expand Down
5 changes: 4 additions & 1 deletion sale_timesheet_invoice_description/views/res_config_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
Default timesheet details on invoice lines
</div>
<div class="text-muted">
<field name="default_timesheet_invoice_description" />
<field
name="default_timesheet_invoice_description"
required="1"
/>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion sale_timesheet_invoice_description/views/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="show_update_fpos" position="after">
<field name="timesheet_invoice_description" />
<field name="timesheet_invoice_description" required="1" />
<field name="timesheet_invoice_split" />
</field>
</field>
Expand Down

0 comments on commit 6352247

Please sign in to comment.