Skip to content

Commit

Permalink
Merge 16c6aa1 into 8a322d9
Browse files Browse the repository at this point in the history
  • Loading branch information
floraXiao committed Jul 12, 2018
2 parents 8a322d9 + 16c6aa1 commit 8761ae5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
16 changes: 14 additions & 2 deletions good_process/models/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ def is_current_model(self):

@api.model
def create(self, vals):
if not self.is_current_model():
return super(MailThread, self).create(vals)
thread_row = super(MailThread, self).create(vals)
approvers = self.__add_approver__(thread_row, self._name, thread_row.id)
thread_row._approver_num = len(approvers)
Expand All @@ -198,6 +196,20 @@ def write(self, vals):
continue
change_state = vals.get('state', False)

if change_state == 'cancel': # 作废时移除待审批人
model_row = th
manger_row = self.__has_manager__(th.id, th._name)

if (manger_row and manger_row.user_id.id == self.env.uid) or not manger_row:
manger_user = []
if manger_row:
manger_user = [manger_row.user_id.id]
self.__is_departement_manager__(manger_row)
users, can_clean_groups = (self.__get_user_group__(
th.id, th._name, manger_user, model_row))
self.__remove_approver__(
th.id, th._name, users, can_clean_groups)

# 已提交,确认时报错
if len(th._to_approver_ids) == th._approver_num and change_state == 'done':
raise ValidationError(u"审批后才能确认")
Expand Down
7 changes: 7 additions & 0 deletions warehouse/tests/test_goods.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ def test_write(self):
with self.assertRaises(UserError):
self.goods_cable.conversion = 3

def test_get_matching_records_has_location(self):
'''获取匹配记录(出库单行填写了库位)'''
# 已有键鼠套装入库到总仓的a库位
wh_out = self.env.ref('warehouse.wh_out_whout1')
wh_out.line_out_ids[0].location_id = self.env.ref('warehouse.a001_location')
wh_out.approve_order()


class TestResCompany(TransactionCase):

Expand Down

0 comments on commit 8761ae5

Please sign in to comment.