Use standard xref buttons for CORE record views

This commit is contained in:
Lance Edgar 2024-05-31 14:46:19 -05:00
parent 3c28c80074
commit 01afff93bf
7 changed files with 13 additions and 26 deletions

View file

@ -1,3 +0,0 @@
## -*- coding: utf-8; -*-
<%inherit file="/core-pos/master/view.mako" />
${parent.body()}

View file

@ -1,3 +0,0 @@
## -*- coding: utf-8; -*-
<%inherit file="/core-pos/master/view.mako" />
${parent.body()}

View file

@ -1,3 +0,0 @@
## -*- coding: utf-8; -*-
<%inherit file="/core-pos/master/view.mako" />
${parent.body()}

View file

@ -1,11 +0,0 @@
## -*- coding: utf-8; -*-
<%inherit file="/master/view.mako" />
<%namespace file="/corepos-util.mako" import="render_xref_helper" />
<%def name="object_helpers()">
${parent.object_helpers()}
${render_xref_helper()}
</%def>
${parent.body()}

View file

@ -1,3 +0,0 @@
## -*- coding: utf-8; -*-
<%inherit file="/core-pos/master/view.mako" />
${parent.body()}

View file

@ -1,3 +0,0 @@
## -*- coding: utf-8; -*-
<%inherit file="/core-pos/master/view.mako" />
${parent.body()}

View file

@ -137,6 +137,19 @@ class CoreMasterView(MasterView):
return kwargs return kwargs
def get_xref_buttons(self, obj):
buttons = super().get_xref_buttons(obj)
app = self.get_rattail_app()
corepos = app.get_corepos_handler()
office_url = corepos.get_office_url()
if office_url:
url = self.core_office_object_url(office_url, obj)
if url:
buttons.append(self.make_xref_button(text="View in CORE Office", url=url))
return buttons
def core_office_object_url(self, office_url, obj): def core_office_object_url(self, office_url, obj):
""" """
Subclass must define this logic; should return the "final" CORE Office Subclass must define this logic; should return the "final" CORE Office