-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from osbzr/master
180712
- Loading branch information
Showing
19 changed files
with
142 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 上海开阖软件 ((http:www.osbzr.com).) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2018 上海开阖软件 ((http:www.osbzr.com).) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import goods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
import test_buy | ||
import test_wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestBuy(TransactionCase): | ||
|
||
def setUp(self): | ||
super(TestBuy, self).setUp() | ||
self.order = self.env.ref('buy.buy_order_1') | ||
self.sell_order = self.env.ref('sell.sell_order_1') | ||
|
||
def test_sell_to_buy(self): | ||
'''根据销货订单生成购货订单''' | ||
res = self.order.sell_to_buy() | ||
self.assertEqual(res['res_model'], 'sell.to.buy.wizard') | ||
|
||
def test_buy_order_line_unlink(self): | ||
'''删除购货订单行时,如果对应销货订单行已采购,则去掉打勾''' | ||
wizard = self.env['sell.to.buy.wizard'].with_context({'active_id': self.order.id}).create( | ||
{'sell_line_ids': [(6, 0, [self.sell_order.line_ids.ids])]}) | ||
wizard.button_ok() | ||
for line in self.order.line_ids: | ||
if line.sell_line_id: | ||
line.unlink() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
from odoo.tests.common import TransactionCase | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class TestSellToBuyWizard(TransactionCase): | ||
|
||
def setUp(self): | ||
super(TestSellToBuyWizard, self).setUp() | ||
self.order = self.env.ref('buy.buy_order_1') | ||
self.sell_order = self.env.ref('sell.sell_order_1') | ||
self.sell_line_1 = self.env.ref('sell.sell_order_line_1') | ||
self.sell_line_1.copy() | ||
self.wizard = self.env['sell.to.buy.wizard'].with_context({'active_id': self.order.id}).create({'sell_line_ids': [(6, 0, [self.sell_order.line_ids.ids])]}) | ||
|
||
|
||
def test_button_ok(self): | ||
'''生成按钮,复制销货订单行到购货订单中''' | ||
self.wizard.button_ok() | ||
self.assertEqual(len(self.order.line_ids), 3) | ||
self.assertEqual(self.order.sell_id, self.sell_order) | ||
for line in self.sell_order.line_ids: | ||
self.assertTrue(line.is_bought) | ||
|
||
def test_button_ok_select_two_sell_order(self): | ||
'''一次只能勾选同一张销货订单的行''' | ||
order_2 = self.env.ref('sell.sell_order_2') | ||
lines = self.sell_order.line_ids + order_2.line_ids | ||
self.wizard.write({'sell_line_ids': [(6, 0, [lines.ids])]}) | ||
with self.assertRaises(UserError): | ||
self.wizard.button_ok() | ||
|
||
def test_button_ok_no_sell_line_ids(self): | ||
'''销货订单行不能为空''' | ||
wizard = self.env['sell.to.buy.wizard'].with_context({'active_id': self.order.id}).create({'sell_line_ids': []}) | ||
with self.assertRaises(UserError): | ||
wizard.button_ok() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters