class VendorChicken(ModelSQL, ModelView):
"Vendor Chicken"
__name__ = 'vendor.chicken'
chicken_number = fields.Char('Number')
barcode_chicken = fields.Binary('Barcode', required=True )
chicken_code = fields.Function(fields.Char('Chicken Code',readonly=True),'get_chicken_code')
@classmethod
def default_barcode_chicken(self):
global nums
fd = BytesIO()
image = barcode.generate('ean13', nums ,writer=ImageWriter(), output=fd)
fd.seek(0)
return fields.Binary.cast(fd.read())
def get_chicken_code(self,name):
return self.chicken_number
@classmethod
def default_chicken_number(self):
global nums
return nums
how can i share the same random number between the different function in model i tried implementing global var but does not seems to work
i had to assign the same ean number of barcode to another field in form
is there any way i can assign the ean number directly to char field