Add setting to show/hide product image for mobile purchasing/receiving

This commit is contained in:
Lance Edgar 2018-09-19 16:42:50 -05:00
parent 5b2f4127ea
commit 6fb78c5dde
2 changed files with 12 additions and 7 deletions

View file

@ -7,7 +7,7 @@
<%def name="page_title()">${h.link_to("Receiving", url('mobile.receiving'))} &raquo; ${h.link_to(batch.id_str, url('mobile.receiving.view', uuid=batch.uuid))} &raquo; ${master.render_product_key_value(row)}</%def> <%def name="page_title()">${h.link_to("Receiving", url('mobile.receiving'))} &raquo; ${h.link_to(batch.id_str, url('mobile.receiving.view', uuid=batch.uuid))} &raquo; ${master.render_product_key_value(row)}</%def>
<div class="ui-grid-a"> <div${' class="ui-grid-a"' if product_image_url else ''|n}>
<div class="ui-block-a"> <div class="ui-block-a">
% if instance.product: % if instance.product:
<h3>${instance.brand_name or ""}</h3> <h3>${instance.brand_name or ""}</h3>
@ -19,11 +19,11 @@
<h3>${instance.description}</h3> <h3>${instance.description}</h3>
% endif % endif
</div> </div>
<div class="ui-block-b"> % if product_image_url:
% if product_image_url: <div class="ui-block-b">
${h.image(product_image_url, "product image")} ${h.image(product_image_url, "product image")}
% endif </div>
</div> % endif
</div> </div>
<table> <table>

View file

@ -1109,11 +1109,16 @@ class ReceivingBatchView(PurchasingBatchView):
return self.redirect(self.get_row_action_url('view', row, mobile=mobile)) return self.redirect(self.get_row_action_url('view', row, mobile=mobile))
return super(ReceivingBatchView, self).redirect_after_quick_row(row, mobile=mobile) return super(ReceivingBatchView, self).redirect_after_quick_row(row, mobile=mobile)
def get_row_image_url(self, row):
if self.rattail_config.getbool('rattail.batch', 'purchase.mobile_images', default=True):
return pod.get_image_url(self.rattail_config, row.upc)
def mobile_view_row(self): def mobile_view_row(self):
""" """
Mobile view for receiving batch row items. Note that this also handles Mobile view for receiving batch row items. Note that this also handles
updating a row. updating a row.
""" """
self.mobile = True
self.viewing = True self.viewing = True
row = self.get_row_instance() row = self.get_row_instance()
batch = row.batch batch = row.batch
@ -1126,7 +1131,7 @@ class ReceivingBatchView(PurchasingBatchView):
'instance': row, 'instance': row,
'instance_title': self.get_row_instance_title(row), 'instance_title': self.get_row_instance_title(row),
'parent_model_title': self.get_model_title(), 'parent_model_title': self.get_model_title(),
'product_image_url': pod.get_image_url(self.rattail_config, row.upc), 'product_image_url': self.get_row_image_url(row),
'form': form, 'form': form,
'allow_expired': self.handler.allow_expired_credits(), 'allow_expired': self.handler.allow_expired_credits(),
'allow_cases': self.handler.allow_cases(), 'allow_cases': self.handler.allow_cases(),