(self, product_id=None)
return res
Returns dates based on number of days configured in current lot's product.
Returns dates based on number of days configured in current lot's product.
Returns dates based on number of days configured in current lot s product .
def _get_dates(self, product_id=None):
        """Returns dates based on number of days configured in current lot's product."""
        mapped_fields = {
            'expiration_date': 'expiration_time',
            'use_date': 'use_time',
            'removal_date': 'removal_time',
            'alert_date': 'alert_time'
        }
        res = dict.fromkeys(mapped_fields, False)
        product = self.env['product.product'].browse(product_id) or self.product_id
        if product:
            for field in mapped_fields:
                duration = getattr(product, mapped_fields[field])
                if duration:
                    date = datetime.datetime.now() + datetime.timedelta(days=duration)
                    res[field] = fields.Datetime.to_string(date)
        return res
def _get_dates ( self , product_id = None ) : mapped_fields = { 'expiration_date' : 'expiration_time' , 'use_date' : 'use_time' , 'removal_date' : 'removal_time' , 'alert_date' : 'alert_time' } res = dict . fromkeys ( mapped_fields , False ) product = self . env [ 'product.product' ] . browse ( product_id ) or self . product_id if product : for field in mapped_fields : duration = getattr ( product , mapped_fields [ field ] ) if duration : date = datetime . datetime . now ( ) + datetime . timedelta ( days = duration ) res [ field ] = fields . Datetime . to_string ( date ) return res