|
- from odoo.tests.common import TransactionCase
- from odoo.exceptions import UserError, ValidationError
-
-
- class TestMonthProductCost(TransactionCase):
-
- def setUp(self):
- super(TestMonthProductCost, self).setUp()
- self.period_id = self.env.ref('finance.period_201601')
- self.period_id_15 = self.env.ref('finance.period_201512')
-
- def test_generate_issue_cost(self):
- """本月成本结算 相关逻辑的测试"""
- checkout_wizard_row = self.env['checkout.wizard'].create(
- {'date': '2016-01-31', 'period_id': self.period_id.id})
- with self.assertRaises(UserError):
- checkout_wizard_row.button_checkout()
-
- wh_in_rows = self.env['wh.in'].search([('state','!=','done')])
- wh_in_rows.write({'date': '2016-01-31'})
- wh_out_rows = self.env['wh.out'].search(
- [('name', '=', self.env.ref('warehouse.wh_out_whout1').name)])
- wh_out_rows.write({'date': '2016-01-31'})
-
-
- [wh_in_row.approve_order() for wh_in_row in wh_in_rows]
- [wh_out_row.approve_order() for wh_out_row in wh_out_rows]
-
- self.env['month.product.cost'].generate_issue_cost(
- self.period_id, '2016-01-31')
-
-
- wh_in_rows = self.env['wh.in'].search([])
- wh_in_rows.write({'date': '2015-12-31'})
- self.env['month.product.cost'].generate_issue_cost(
- self.period_id_15, '2015-12-31')
-
- wh_out_2 = self.env.ref('warehouse.wh_out_whout1')
- wh_out_2.write({'date': '2016-1-31'})
- self.env['month.product.cost'].generate_issue_cost(
- self.period_id, '2016-01-31')
-
-
- company = self.env['res.company'].search([], limit=1)
- company.cost_method = 'fifo'
- self.env['month.product.cost'].generate_issue_cost(
- self.period_id, '2016-01-31')
-
-
- class TestPartner(TransactionCase):
- def test_action_view_sell_history(self):
- """ 测试 客户采购记录(最近一年)"""
- customer_yixun = self.env.ref('core.yixun')
- customer_yixun.action_view_sell_history()
-
- self.env.user.company_id.start_date = '2016-01-01'
- customer_yixun.action_view_sell_history()
|