Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2954 มุมมอง

Hi everyone, I have overridden the CRM lead create, creating a series of changes BEFORE the super.


In the same addons of the modification I am inserting the tests, as always I create the objects crm lead, crm team etc., when I check if the changes have been applied to the lead I realize that the tests are not passed.


test:

# ... rest of test code
        self.crm_lead1 = CRMLead.create(
{
'name': "CRM Lead Test",
'team_id': self.crm_team1.id
}
)


def test_01_autoassign_user(self):
""" Test autoassign user_id from team """
self.assertEqual(self.user1_id, self.crm_lead1.user_id)

override:

    @api.model
def create(self, vals):
if not vals.get('user_id', False) and vals.get('team_id', False):
team_id = self.env['crm.team'].browse(vals['team_id'])
vals['user_id'] = team_id.default_user_id.id

return super(CrmLead, self).create(vals)
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Why native test fails? แก้ไขแล้ว
2
มิ.ย. 20
6595
2
ก.พ. 20
4968
0
พ.ย. 19
4358
2
มี.ค. 15
4504
Very simple POS Tests go to backoffice แก้ไขแล้ว
1
มี.ค. 23
2543