fix: add xref button to customer profile, for trainwreck txn view

This commit is contained in:
Lance Edgar 2024-07-05 14:30:52 -05:00
parent 19e65f5bb9
commit b7d26b6b8c

View file

@ -270,6 +270,23 @@ class TransactionView(MasterView):
return kwargs
def get_xref_buttons(self, txn):
app = self.get_rattail_app()
clientele = app.get_clientele_handler()
buttons = super().get_xref_buttons(txn)
if txn.customer_id:
customer = clientele.locate_customer_for_key(Session(), txn.customer_id)
if customer:
person = app.get_person(customer)
if person:
url = self.request.route_url('people.view_profile', uuid=person.uuid)
buttons.append(self.make_xref_button(text=str(person),
url=url,
internal=True))
return buttons
def get_row_data(self, transaction):
return self.Session.query(self.model_row_class)\
.filter(self.model_row_class.transaction == transaction)