Skip to content

Commit

Permalink
Refactor test to be able to track issue
Browse files Browse the repository at this point in the history
  • Loading branch information
grindtildeath committed Oct 28, 2021
1 parent 50deb5a commit cab7403
Showing 1 changed file with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,19 @@ def setUpClass(cls):

cls.account_move = cls.env["account.move"]


def test_invoice_line_with_accounting_description(self):
invoice_form_acc_desc = Form(
cls.account_move.with_context(default_move_type="out_invoice")
)
invoice_form_no_acc_desc = Form(
cls.account_move.with_context(default_move_type="out_invoice")
self.account_move.with_context(default_move_type="out_invoice")
)

invoice_form_acc_desc.partner_id = (
invoice_form_no_acc_desc.partner_id
) = cls.partner_1
invoice_form_acc_desc.partner_id = self.partner_1

with invoice_form_acc_desc.invoice_line_ids.new() as line_form:
line_form.product_id = cls.product_with_acc_desc
line_form.quantity = 1
line_form.price_unit = 2.99

cls.invoice_acc_desc = invoice_form_acc_desc.save()

with invoice_form_no_acc_desc.invoice_line_ids.new() as line_form:
line_form.product_id = cls.product_without_acc_desc
line_form.product_id = self.product_with_acc_desc
line_form.quantity = 1
line_form.price_unit = 2.99

cls.invoice_no_acc_desc = invoice_form_no_acc_desc.save()

def test_invoice_line_description(self):
self.invoice_acc_desc = invoice_form_acc_desc.save()
inv_line_with_product = self.invoice_acc_desc.invoice_line_ids.filtered(
lambda x: x.product_id
)
Expand All @@ -58,11 +45,23 @@ def test_invoice_line_description(self):
inv_line_with_product.name,
self.product_with_acc_desc.accounting_description,
)

self.assertEqual(
inv_line_with_product.product_id.name, inv_line_with_product.external_name
)

def test_invoice_line_without_accounting_description(self):
invoice_form_no_acc_desc = Form(
self.account_move.with_context(default_move_type="out_invoice")
)

invoice_form_no_acc_desc.partner_id = self.partner_1

with invoice_form_no_acc_desc.invoice_line_ids.new() as line_form:
line_form.product_id = self.product_without_acc_desc
line_form.quantity = 1
line_form.price_unit = 2.99

self.invoice_no_acc_desc = invoice_form_no_acc_desc.save()
inv_line_with_product = self.invoice_no_acc_desc.invoice_line_ids.filtered(
lambda x: x.product_id
)
Expand Down

0 comments on commit cab7403

Please sign in to comment.