[MERGE, IMP] crm_claim: Update YML test case as state and stage are dependent to each other now

bzr revid: psi@tinyerp.com-20120515125909-go6biqkkx1sbkvf8
This commit is contained in:
Purnendu Singh (OpenERP) 2012-05-15 18:29:09 +05:30
commit 0a2fba04e3
2 changed files with 5 additions and 6 deletions

View File

@ -60,10 +60,9 @@ class crm_claim(crm.crm_case, osv.osv):
def _save_state(self, cr, uid, claim_id, field_name, field_value, arg, context=None):
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('state', '=', field_value)], context=context)
if stage_ids:
self.write(cr, uid, claim_id, {'stage_id': stage_ids[0]}, context=context)
return self.write(cr, uid, claim_id, {'stage_id': stage_ids[0]}, context=context)
else:
cr.execute("""UPDATE crm_claim SET state=%s WHERE id=%s""", (field_value, claim_id, ))
return True
return cr.execute("""UPDATE crm_claim SET state=%s WHERE id=%s""", (field_value, claim_id, ))
_name = "crm.claim"
_description = "Claim"
@ -104,8 +103,8 @@ class crm_claim(crm.crm_case, osv.osv):
'state': fields.function(_get_state, fnct_inv=_save_state, type='selection', selection=crm.AVAILABLE_STATES, string="State", readonly=True,
store = {
'crm.claim': (lambda self, cr, uid, ids, c={}: ids, ['stage_id'], 10),
'crm.claim.stage': (_get_stage, ['state'], 10)
},
'crm.case.stage': (_get_stage, ['state'], 10)
},
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\

View File

@ -30,7 +30,7 @@
claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
claim = self.browse(cr, uid, claim_ids[0])
assert claim.state == "open", "Claim is not in Open state"
assert claim.stage_id.id == ref("crm.stage_lead1"), "Claim is not in New stage"
assert claim.stage_id.id == ref("crm.stage_lead2"), "Claim is not in Qualification stage"
-
After complete all service from our side, I close this claim.
-