Esempio n. 1
0
 def get_csv_value(self, resource, context, item, column):
     brain, item_resource = item
     if column == 'name':
         return brain.name
     elif column == 'customer_id':
         return item_resource.get_property('customer_id')
     elif column == 'workflow_state':
         value = item_resource.get_statename()
         title = OrderStateEnumerate.get_value(value)
         return title.gettext()
     elif column in ('total_price', 'total_paid'):
         value = item_resource.get_property(column)
         return value
     elif column in ('total_pre_vat', 'total_vat'):
         total_pre_vat, total_vat = item_resource.get_vat_details(context)
         return get_arrondi(eval(column))
     elif column in ('ctime',):
         value = brain.ctime
         return context.format_datetime(value)
     return ''
Esempio n. 2
0
 def get_item_value(self, resource, context, item, column):
     brain, item_resource = item
     if column in ('total_price', 'total_paid'):
         value = item_resource.get_property(column)
         return item_resource.format_price(value)
     elif column == 'name':
         return OrderState_Template(title=brain.name,
             link=context.get_link(item_resource), color='#BF0000')
     elif column == 'workflow_state':
         value = item_resource.get_statename()
         title = OrderStateEnumerate.get_value(value)
         return OrderState_Template(title=title,
             link=context.get_link(item_resource), color='#BF0000')
     elif column == 'bill':
         bill = item_resource.get_bill()
         if bill is None:
             return None
         return XMLParser("""
                 <a href="%s/;download">
                   <img src="/ui/icons/16x16/pdf.png"/>
                 </a>""" % context.get_link(bill))
     proxy = super(OrderModule_ViewOrders, self)
     return proxy.get_item_value(resource, context, item, column)