Browse Source

[10.0][FIX+IMP] contract: Improve usability and don't fail on wrong data (#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
pull/329/head
Pedro M. Baeza 7 years ago
committed by Sylvain Van Hoof
parent
commit
29192aa014
  1. 13
      contract_sale_generation/tests/test_contract_sale.py

13
contract_sale_generation/tests/test_contract_sale.py

@ -57,19 +57,12 @@ class TestContractSale(TransactionCase):
res = self.contract_line._onchange_product_id() res = self.contract_line._onchange_product_id()
self.assertIn('uom_id', res['domain']) self.assertIn('uom_id', res['domain'])
self.contract_line.price_unit = 100.0 self.contract_line.price_unit = 100.0
self.contract.partner_id = False
with self.assertRaises(ValidationError):
self.contract.recurring_create_sale()
self.contract.partner_id = self.partner.id
self.contract.recurring_create_sale() self.contract.recurring_create_sale()
self.sale_monthly = self.env['sale.order'].search( self.sale_monthly = self.env['sale.order'].search(
[('project_id', '=', self.contract.id), [('project_id', '=', self.contract.id),
('state', '=', 'draft')]) ('state', '=', 'draft')])
self.assertTrue(self.sale_monthly) self.assertTrue(self.sale_monthly)
self.assertEqual(self.contract.recurring_next_date, '2017-02-28') self.assertEqual(self.contract.recurring_next_date, '2017-02-28')
self.sale_line = self.sale_monthly.order_line[0] self.sale_line = self.sale_monthly.order_line[0]
self.assertAlmostEqual(self.sale_line.price_subtotal, 50.0) self.assertAlmostEqual(self.sale_line.price_subtotal, 50.0)
self.assertEqual(self.contract.partner_id.user_id, self.assertEqual(self.contract.partner_id.user_id,
@ -81,12 +74,6 @@ class TestContractSale(TransactionCase):
res = self.contract_line._onchange_product_id() res = self.contract_line._onchange_product_id()
self.assertIn('uom_id', res['domain']) self.assertIn('uom_id', res['domain'])
self.contract_line.price_unit = 100.0 self.contract_line.price_unit = 100.0
self.contract.partner_id = False
with self.assertRaises(ValidationError):
self.contract.recurring_create_sale()
self.contract.partner_id = self.partner.id
self.contract.recurring_create_sale() self.contract.recurring_create_sale()
self.sale_monthly = self.env['sale.order'].search( self.sale_monthly = self.env['sale.order'].search(
[('project_id', '=', self.contract.id), [('project_id', '=', self.contract.id),

Loading…
Cancel
Save