Skip to content

Commit

Permalink
fixup! account_invoice_section_sale_order: Custom section name
Browse files Browse the repository at this point in the history
  • Loading branch information
sebalix committed Sep 20, 2024
1 parent a2d4119 commit 18ba581
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 35 deletions.
2 changes: 0 additions & 2 deletions account_invoice_section_sale_order/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class AccountMove(models.Model):

_inherit = "account.move"

def _get_ordered_invoice_lines(self):
Expand All @@ -16,7 +15,6 @@ def _get_ordered_invoice_lines(self):


class AccountMoveLine(models.Model):

_inherit = "account.move.line"

def _get_section_group(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ResConfigSettings(models.TransientModel):

_inherit = "res.config.settings"

invoice_section_name_scheme = fields.Char(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ def setUpClass(cls):
cls.product_2 = cls.env.ref("product.product_product_2")
cls.product_1.invoice_policy = "order"
cls.product_2.invoice_policy = "order"
eur = cls.env.ref("base.EUR")
cls.pricelist = cls.env["product.pricelist"].create(
{"name": "Europe pricelist", "currency_id": eur.id}
)
cls.order1_p1 = cls.env["sale.order"].create(
{
"partner_id": cls.partner_1.id,
"partner_shipping_id": cls.partner_1.id,
"partner_invoice_id": cls.partner_1.id,
"pricelist_id": cls.pricelist.id,
"client_order_ref": "ref123",
"order_line": [
(
Expand Down Expand Up @@ -58,6 +63,7 @@ def setUpClass(cls):
"partner_id": cls.partner_1.id,
"partner_shipping_id": cls.partner_1.id,
"partner_invoice_id": cls.partner_1.id,
"pricelist_id": cls.pricelist.id,
"order_line": [
(
0,
Expand Down Expand Up @@ -127,12 +133,7 @@ def test_create_invoice(self):

def test_create_invoice_with_currency(self):
"""Check invoice is generated with a correct total amount"""
eur = self.env.ref("base.EUR")
pricelist = self.env["product.pricelist"].create(
{"name": "Europe pricelist", "currency_id": eur.id}
)
orders = self.order1_p1 | self.order2_p1
orders.write({"pricelist_id": pricelist.id})
invoices = orders._create_invoices()
self.assertEqual(invoices.amount_total, 80)

Expand Down
48 changes: 21 additions & 27 deletions account_invoice_section_sale_order/views/res_config_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,30 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='invoicing_settings']" position="inside">
<div
class="col-12 col-lg-6 o_setting_box"
<xpath expr="//block[@id='invoicing_settings']" position="inside">

<setting
id="invoice_section_sale_order"
groups="account_invoice_section_sale_order.group_sale_order_invoice_section_name"
string="Section names"
help="Customize section names when invoicing from sale orders"
>
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<span class="o_form_label">Section names</span>
<div class="text-muted">
Customize section names when invoicing from sale orders
</div>
<div class="row mt16">
<label
for="invoice_section_grouping"
class="col-lg-4 o_light_label"
string="Grouping object"
/>
<field name="invoice_section_grouping" />
</div>
<div class="row">
<label
for="invoice_section_name_scheme"
class="col-lg-4 o_light_label"
string="Naming scheme"
/>
<field name="invoice_section_name_scheme" />
</div>
<div class="row mt16">
<label
for="invoice_section_grouping"
class="col-lg-4 o_light_label"
string="Grouping object"
/>
<field name="invoice_section_grouping" />
</div>
</div>
<div class="row">
<label
for="invoice_section_name_scheme"
class="col-lg-4 o_light_label"
string="Naming scheme"
/>
<field name="invoice_section_name_scheme" />
</div>
</setting>
</xpath>
</field>
</record>
Expand Down

0 comments on commit 18ba581

Please sign in to comment.