Tweak how vendor link is rendered for readonly field
This commit is contained in:
		
							parent
							
								
									797a65e9c8
								
							
						
					
					
						commit
						b3867d9c89
					
				
					 2 changed files with 5 additions and 12 deletions
				
			
		| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  Rattail -- Retail Software Framework
 | 
					#  Rattail -- Retail Software Framework
 | 
				
			||||||
#  Copyright © 2010-2020 Lance Edgar
 | 
					#  Copyright © 2010-2021 Lance Edgar
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  This file is part of Rattail.
 | 
					#  This file is part of Rattail.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					@ -953,8 +953,9 @@ class MasterView(View):
 | 
				
			||||||
        vendor = getattr(obj, field)
 | 
					        vendor = getattr(obj, field)
 | 
				
			||||||
        if not vendor:
 | 
					        if not vendor:
 | 
				
			||||||
            return ""
 | 
					            return ""
 | 
				
			||||||
        if vendor.id:
 | 
					        short = vendor.id or vendor.abbreviation
 | 
				
			||||||
            text = "({}) {}".format(vendor.id, vendor.name)
 | 
					        if short:
 | 
				
			||||||
 | 
					            text = "({}) {}".format(short, vendor.name)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            text = six.text_type(vendor)
 | 
					            text = six.text_type(vendor)
 | 
				
			||||||
        url = self.request.route_url('vendors.view', uuid=vendor.uuid)
 | 
					        url = self.request.route_url('vendors.view', uuid=vendor.uuid)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,7 @@
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  Rattail -- Retail Software Framework
 | 
					#  Rattail -- Retail Software Framework
 | 
				
			||||||
#  Copyright © 2010-2020 Lance Edgar
 | 
					#  Copyright © 2010-2021 Lance Edgar
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  This file is part of Rattail.
 | 
					#  This file is part of Rattail.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					@ -409,14 +409,6 @@ class PurchasingBatchView(BatchMasterView):
 | 
				
			||||||
        url = self.request.route_url('purchases.view', uuid=purchase.uuid)
 | 
					        url = self.request.route_url('purchases.view', uuid=purchase.uuid)
 | 
				
			||||||
        return tags.link_to(text, url)
 | 
					        return tags.link_to(text, url)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def render_vendor(self, batch, field):
 | 
					 | 
				
			||||||
        vendor = batch.vendor
 | 
					 | 
				
			||||||
        if not vendor:
 | 
					 | 
				
			||||||
            return ""
 | 
					 | 
				
			||||||
        text = "({}) {}".format(vendor.id, vendor.name)
 | 
					 | 
				
			||||||
        url = self.request.route_url('vendors.view', uuid=vendor.uuid)
 | 
					 | 
				
			||||||
        return tags.link_to(text, url)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def render_vendor_email(self, batch, field):
 | 
					    def render_vendor_email(self, batch, field):
 | 
				
			||||||
        if batch.vendor.email:
 | 
					        if batch.vendor.email:
 | 
				
			||||||
            return batch.vendor.email.address
 | 
					            return batch.vendor.email.address
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue