You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
# -*- coding: utf-8 -*- from openerp import models, fields, api import uuid
class MemberCard(models.Model):
def _get_current_user(self): return self.env.uid
def _compute_bar_code(self): rule = self.env['barcode.rule'].search([('name', '=', 'Customer Barcodes')])[0] size = 13 - len(rule.pattern) ean = rule.pattern + str(uuid.uuid4().fields[-1])[:size] return ean[0:12] + str(self.env['barcode.nomenclature'].ean_checksum(ean))
_name = 'member.card' _order = 'create_date desc'
valid = fields.Boolean(default=True, string="Active") barcode = fields.Char("Barcode", oldname='ean13', default=_compute_bar_code) partner_id = fields.Many2one('res.partner') #, default=_get_current_client) responsible_id = fields.Many2one('res.users', default=_get_current_user, string="Responsible") end_date = fields.Date(readonly=True, string="Expiration Date") comment = fields.Char("Reason", required=True)
|