Skip to content

Commit

Permalink
[17.0][IMP]: account_invoice_section_sale_order add option to always …
Browse files Browse the repository at this point in the history
…create sections
  • Loading branch information
victorvermot committed Jan 22, 2025
1 parent 3738d95 commit faa3278
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions account_invoice_section_sale_order/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ class ResCompany(models.Model):
default="sale_order",
required=True,
)

invoice_section_treshold = fields.Selection(
[
("1", "Create section if multiple sale orders are selected"),
("-1", "Always Create section"),
],
help="Defines when to create sections",
default="1",
required=True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ class ResConfigSettings(models.TransientModel):
readonly=False,
required=True,
)

invoice_section_treshold = fields.Selection(
related="company_id.invoice_section_treshold",
readonly=False,
required=True,
)
2 changes: 1 addition & 1 deletion account_invoice_section_sale_order/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _create_invoices(self, grouped=False, final=False, date=None):
for invoice in invoice_ids:
if (
len(invoice.line_ids.mapped(invoice.line_ids._get_section_grouping()))
== 1
== int(invoice.company_id.invoice_section_treshold)
):
continue
sequence = 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
/>
<field name="invoice_section_name_scheme" />
</div>
<div class="row">
<label
for="invoice_section_treshold"
class="col-lg-4 o_light_label"
string="When to create sections"
/>
<field name="invoice_section_treshold" />
</div>
</setting>
</xpath>
</field>
Expand Down

0 comments on commit faa3278

Please sign in to comment.