Skip to content

Commit

Permalink
[FIX][business_requirement_deliverable] don't change deliverable desc…
Browse files Browse the repository at this point in the history
…ription if previously filled (#132)

* FIX don't change deliverable description if previously filled

* FIX travis with test modification suggested by @darshan-serpent

* FIX travis with test modification suggested by @darshan-serpent

* Revert "FIX travis with test modification suggested by @darshan-serpent"

This reverts commit 6df49d5.

* Revert "FIX travis with test modification suggested by @darshan-serpent"

FIX don't change deliverable description if previously filled

* FIX travis as recommended by @darshan-serpent

* FIX product_id onchange tests

* fixed L81 description
  • Loading branch information
rubencabrera authored and elicoidal committed May 25, 2017
1 parent b6f1867 commit 7f7d30e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions business_requirement_deliverable/models/business.py
Expand Up @@ -78,7 +78,8 @@ def product_id_change(self):
uom_id = product.uom_id.id
if product.description_sale:
description += '\n' + product.description_sale
self.name = description
if not self.name:
self.name = description
self.uom_id = uom_id

@api.onchange('resource_type')
Expand Down Expand Up @@ -231,7 +232,8 @@ def product_id_change(self):
)
sale_price_unit = product.price

self.name = description
if not self.name:
self.name = description
self.uom_id = uom_id
self.sale_price_unit = sale_price_unit

Expand Down
12 changes: 6 additions & 6 deletions business_requirement_deliverable/tests/test_br.py
Expand Up @@ -218,7 +218,7 @@ def test_get_pricelist(self):

def test_product_id_change(self):
for line in self.br.deliverable_lines:
line.write({'product_id': self.productA.id})
line.write({'product_id': self.productA.id, 'name': ''})
description = ''
sale_price_unit = 0
product = self.productA
Expand Down Expand Up @@ -282,18 +282,18 @@ def test_product_id_change_with_pricelist(self):
sale_price_unit = product.price

line.product_id_change()
self.assertEqual(line.name, description)
self.assertEqual(line.uom_id.id, self.productA.uom_id.id)
self.assertEqual(line.sale_price_unit, sale_price_unit)

def test_product_id_change_description_sale(self):
self.productA.write({
'description_sale': 'Sales Description Product A'})
for line in self.br.deliverable_lines:
line.write({'product_id': self.productA.id})
line.product_id_change()
self.assertTrue(
self.productA.description_sale in line.name)
if not line.name:
line.write({'product_id': self.productA.id})
line.product_id_change()
self.assertTrue(
self.productA.description_sale in line.name)

def test_product_uom_change(self):
for line in self.br.deliverable_lines:
Expand Down

0 comments on commit 7f7d30e

Please sign in to comment.