[IMP]Improved the codecov.

This commit is contained in:
HemanginiPatel
2021-08-17 12:26:45 +05:30
parent ffaa36d0b1
commit 058ed4b4a3
2 changed files with 26 additions and 2 deletions

View File

@@ -69,7 +69,6 @@ class SaleOrder(models.Model):
# we create the Agreement.
# To work around that, we check if that is the case,
# and make sure the SO Analytic Account is copied to the Agreement.
res = super(SaleOrder, self).action_confirm()
for order in self:
agreement = order.agreement_id
if (
@@ -78,4 +77,4 @@ class SaleOrder(models.Model):
and not agreement.analytic_account_id
):
agreement.analytic_account_id = order.analytic_account_id
return res
return super(SaleOrder, self).action_confirm()

View File

@@ -84,6 +84,26 @@ class TestSaleOrder(TransactionCase):
],
}
)
self.test_agreement = self.env["agreement"].create(
{
"name": "TestAgreement A",
"description": "Test Agreement A",
"special_terms": "TestAgreement A",
"start_date": fields.Date.today(),
"end_date": fields.Date.today() + timedelta(days=365),
}
)
self.test_sale_order_account_analytic_account = self.env["sale.order"].create(
{
"partner_id": self.test_customer.id,
"agreement_template_id": self.test_agreement_template_no_analytic_account_id.id,
"date_order": fields.Date.today(),
"agreement_id": self.test_agreement.id,
"order_line": [
(0, 0, {"product_id": self.test_product.id, "product_uom_qty": 1.0})
],
}
)
# TEST 01: Test _action_confirm method
def test_action_confirm(self):
@@ -105,3 +125,8 @@ class TestSaleOrder(TransactionCase):
agreement.sale_id.id,
is_serviceprofile_so.id,
)
# Test 03: Test action_confirm method
self.test_sale_order_account_analytic_account.write(
{"analytic_account_id": self.test_account_analytic_account.id}
)
self.test_sale_order_account_analytic_account.action_confirm()