feat: attrs on product
This commit is contained in:
		
							
								
								
									
										12
									
								
								barcodes/attributes/inn_attribute_getter.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								barcodes/attributes/inn_attribute_getter.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
from barcodes.attributes.base import BaseAttributeGetter
 | 
			
		||||
from models import Product, Client, ClientDetails
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class InnAttributeGetter(BaseAttributeGetter):
 | 
			
		||||
    def get_value(self, product: Product):
 | 
			
		||||
        client: Client = product.client
 | 
			
		||||
        client_details: ClientDetails = client.details
 | 
			
		||||
        result = client_details.inn
 | 
			
		||||
        if not result:
 | 
			
		||||
            result = ''
 | 
			
		||||
        return result
 | 
			
		||||
		Reference in New Issue
	
	Block a user