123456789101112131415161718192021 |
- # -*- coding: utf-8 -*-
- # Part of BiztechCS. See LICENSE file for full copyright and licensing details.
- from openerp import api, fields, models, _
- class subscribe_website(models.Model):
- _inherit = 'res.partner'
- subscribe = fields.Boolean(string="Subscribe", help="Subscribe")
- @api.model
- def create(self, vals):
- if vals.has_key('email') and vals['email']:
- subscribe_customer = self.search([('subscribe', '=', True),
- ('email', '=', vals['email'])])
- if subscribe_customer:
- vals.update({'subscribe': True})
- self.write(subscribe_customer, vals)
- return subscribe_customer[0]
- return super(subscribe_website, self).create(vals)
|