def incr_actions(self): """action types that increment/decrement stock""" actions = [action_config for action_config in self.config.actions if action_config.action_type in ('receipts', 'consumption')] if not any(a.action_type == 'consumption' for a in actions): # add implicitly calculated consumption -- TODO find a way to refer to this more explicitly once we track different kinds of consumption (losses, etc.) actions.append(CommtrackActionConfig(action_type='consumption', caption='Consumption')) if is_psi_domain(self.domain): ordering = ['sales', 'receipts', 'consumption'] actions.sort(key=lambda a: (0, ordering.index(a.action_name)) if a.action_name in ordering else (1, a.action_name)) return actions
def incr_actions(self): """action types that increment/decrement stock""" actions = [ action_config for action_config in self.config.actions if action_config.action_type in ('receipts', 'consumption') ] if not any(a.action_type == 'consumption' for a in actions): # add implicitly calculated consumption -- TODO find a way to refer to this more explicitly once we track different kinds of consumption (losses, etc.) actions.append( CommtrackActionConfig(action_type='consumption', caption='Consumption')) if is_psi_domain(self.domain): ordering = ['sales', 'receipts', 'consumption'] actions.sort(key=lambda a: (0, ordering.index(a.action_name)) if a.action_name in ordering else (1, a.action_name)) return actions
def _village_classes(domain): # todo: meh. if is_psi_domain(domain): return [ _('Town'), _('A'), _('B'), _('C'), _('D'), _('E'), ] else: return [ _('Village'), _('City'), _('Town'), _('Hamlet'), ]
def _enabled_hack(domain): return not is_psi_domain(domain)
def _village_classes(domain): # todo: meh. if is_psi_domain(domain): return [_("Town"), _("A"), _("B"), _("C"), _("D"), _("E")] else: return [_("Village"), _("City"), _("Town"), _("Hamlet")]