예제 #1
0
파일: __init__.py 프로젝트: forexblog/xl
class Plugin(Plugin):

    verbose_name = _("Pages")
    ui_label = _("Pages")

    # ui_handle_attr_name = 'pages_handle'
    # url_prefix = 'p'

    # media_name = 'pages'

    # def on_ui_init(self, ui):
    #     from .renderer import Renderer
    #     self.renderer = Renderer(self)
    #     # from lino.modlib.bootstrap3.renderer import Renderer
    #     # self.renderer = Renderer(self)

    # if not is_installed("publisher"):
    #
    #     def get_patterns(self):
    #         from django.conf.urls import url
    #         from . import views
    #
    #         return [
    #             # url(r'^/?$', self.get_index_view()),
    #             url(r'^$', self.get_index_view()),
    #             url(r'^(?P<ref>\w*)$', views.PagesIndex.as_view())]
    #
    #     def get_index_view(self):
    #         from . import views
    #         return views.PagesIndex.as_view()

    def setup_main_menu(self, site, user_type, m):
        m = m.add_menu(self.app_label, self.verbose_name)
        m.add_action('pages.Pages')
예제 #2
0
class Plugin(Plugin):

    ui_label = _("Pages")
    verbose_name = _("Pages")

    ui_handle_attr_name = 'pages_handle'
    url_prefix = 'p'

    # media_name = 'pages'

    def on_ui_init(self, ui):
        from .renderer import Renderer
        self.renderer = Renderer(self)
        # from lino.modlib.bootstrap3.renderer import Renderer
        # self.renderer = Renderer(self)

    def get_patterns(self):
        from django.conf.urls import url
        from . import views

        return [
            # url(r'^/?$', self.get_index_view()),
            url(r'^$', self.get_index_view()),
            url(r'^(?P<ref>\w*)$', views.PagesIndex.as_view())
        ]

    def get_index_view(self):
        from . import views
        return views.PagesIndex.as_view()

    def setup_main_menu(self, site, profile, m):
        m = m.add_menu(self.app_label, self.verbose_name)
        m.add_action('pages.Pages')
예제 #3
0
    def setup_quicklinks(self, user, tb):
        super(Site, self).setup_quicklinks(user, tb)
        tb.add_action(self.models.contacts.Persons)
        tb.add_action(self.models.contacts.Companies)

        a = self.models.users.MySettings.default_action
        tb.add_instance_action(
            user, action=a, label=_("My settings"))
        

        tb.add_action(
            self.models.blogs.MyEntries.insert_action,
            label=_("New blog entry"))
예제 #4
0
    def setup_quicklinks(self, user, tb):
        super(Site, self).setup_quicklinks(user, tb)
        # tb.add_action(self.models.courses.MyActivities)
        # tb.add_action(self.models.meetings.MyMeetings)
        # tb.add_action(self.modules.deploy.MyMilestones)
        # tb.add_action(self.models.tickets.MyTickets)
        # tb.add_action(self.models.tickets.TicketsToTriage)
        # tb.add_action(self.models.tickets.TicketsToTalk)
        # tb.add_action(self.modules.tickets.TicketsToDo)
        tb.add_action(self.models.tickets.RefTickets)
        tb.add_action(self.models.tickets.ActiveTickets)
        tb.add_action(self.models.tickets.AllTickets)
        tb.add_action(self.models.tickets.AllTickets.insert_action,
                      label=_("Submit a ticket"))

        a = self.models.users.MySettings.default_action
        tb.add_instance_action(user, action=a, label=_("My settings"))
예제 #5
0
    def setup_quicklinks(self, user, tb):
        super(Site, self).setup_quicklinks(user, tb)
        # tb.add_action(self.models.courses.MyCourses)
        # tb.add_action(self.models.meetings.MyMeetings)
        # tb.add_action(self.modules.deploy.MyMilestones)
        # tb.add_action(self.models.tickets.MyTickets)
        # tb.add_action(self.models.tickets.TicketsToTriage)
        # tb.add_action(self.models.tickets.TicketsToTalk)
        # tb.add_action(self.modules.tickets.TicketsToDo)
        tb.add_action(self.models.tickets.RefTickets)
        tb.add_action(self.models.tickets.ActiveTickets)
        tb.add_action(self.models.tickets.AllTickets)
        tb.add_action(
            self.models.tickets.AllTickets.insert_action,
            label=_("Submit a ticket"))

        a = self.models.users.MySettings.default_action
        tb.add_instance_action(
            user, action=a, label=_("My settings"))
예제 #6
0
파일: __init__.py 프로젝트: khchine5/noi
    def setup_quicklinks(self, ar, tb):
        super(Site, self).setup_quicklinks(ar, tb)
        tb.add_action(self.modules.tickets.MyTickets)
        tb.add_action(self.modules.tickets.TicketsToTriage)
        tb.add_action(self.modules.tickets.TicketsToTalk)
        tb.add_action(self.modules.tickets.TicketsToDo)
        tb.add_action(self.modules.tickets.AllTickets)
        tb.add_action(self.modules.tickets.AllTickets.insert_action, label=_("Submit a ticket"))

        a = self.actors.users.MySettings.default_action
        tb.add_instance_action(ar.get_user(), action=a)
예제 #7
0
    def setup_quicklinks(self, user, tb):
        super(Site, self).setup_quicklinks(user, tb)
        tb.add_action(self.models.contacts.Persons)
        tb.add_action(self.models.contacts.Companies)
        # tb.add_action(self.modules.deploy.MyMilestones)
        # tb.add_action(self.models.tickets.MyTickets)
        # tb.add_action(self.models.tickets.TicketsToTriage)
        # tb.add_action(self.models.tickets.TicketsToTalk)
        # tb.add_action(self.modules.tickets.TicketsToDo)

        a = self.models.users.MySettings.default_action
        tb.add_instance_action(user, action=a, label=_("My settings"))
예제 #8
0
파일: __init__.py 프로젝트: TonisPiip/cosi
class Plugin(Plugin):
    """

    .. attribute:: voucher_model

    """

    # needs_plugins = ['lino_cosi.lib.ledger']
    needs_plugins = ['lino_cosi.lib.sales']

    voucher_model = 'sales.VatProductInvoice'
    item_model = 'sales.InvoiceItem'
    """The database model into which invoiceable objects should create
    invoice items.  Default value refers to
    :class:`sales.InvoiceItem <lino_cosi.lib.sales.models.InvoiceItem>`.

    This model will have an injected GFK field `invoiceable`.

    """

    invoiceable_label = _("Invoiced object")

    def on_site_startup(self, site):
        from lino.core.utils import resolve_model
        self.voucher_model = resolve_model(self.voucher_model)
        self.item_model = resolve_model(self.item_model)

    def get_voucher_type(self):
        # from lino.core.utils import resolve_model
        # model = resolve_model(self.voucher_model)
        # return self.site.modules.ledger.VoucherTypes.get_for_model(model)
        return self.site.modules.ledger.VoucherTypes.get_for_model(
            self.voucher_model)

    def setup_main_menu(config, site, profile, m):
        mg = site.plugins.accounts
        m = m.add_menu(mg.app_label, mg.verbose_name)
        # m.add_action('invoicing.MyPlans')
        m.add_action('invoicing.Plan', action='start_invoicing')

    def setup_explorer_menu(self, site, profile, m):
        mg = site.plugins.vat
        m = m.add_menu(mg.app_label, mg.verbose_name)
        m.add_action('invoicing.AllPlans')
예제 #9
0
class Plugin(Plugin):

    verbose_name = _("Invoicing")

    # needs_plugins = ['lino_xl.lib.ledger']
    needs_plugins = ['lino_xl.lib.sales']

    voucher_model = 'sales.VatProductInvoice'
    item_model = 'sales.InvoiceItem'
    """
    The database model into which invoiceable objects should create
    invoice items.  Default value refers to :class:`sales.InvoiceItem
    <lino_xl.lib.sales.models.InvoiceItem>`.

    This model will have an injected GFK field `invoiceable`.
    """

    invoiceable_label = _("Invoiced object")

    def on_site_startup(self, site):
        from lino.core.utils import resolve_model
        self.item_model = resolve_model(self.item_model)
        # ivm = self.item_model._meta.get_field('voucher').remote_field.model
        # if self.voucher_model != ivm:
        #     raise Exception("voucher_model is {} but should be {}".format(
        #         self.voucher_model, ivm))
        self.voucher_model = resolve_model(self.voucher_model)

    def get_voucher_type(self):
        # from lino.core.utils import resolve_model
        # model = resolve_model(self.voucher_model)
        # return self.site.modules.ledger.VoucherTypes.get_for_model(model)
        return self.site.models.ledger.VoucherTypes.get_for_model(
            self.voucher_model)

    def setup_main_menu(config, site, user_type, m):
        mg = site.plugins.sales
        m = m.add_menu(mg.app_label, mg.verbose_name)
        # m.add_action('invoicing.MyPlans')
        m.add_action('invoicing.Plan', action='start_plan')

        # Area = site.models.invoicing.Area
        # # Areas = site.models.invoicing.Areas
        # for obj in Area.objects.all():
        #     # m.add_instance_action(obj, action='start_invoicing')
        #     # m.add_action(obj, action='start_invoicing')
        #     m.add_action(
        #         'invoicing.PlansByArea', 'start_invoicing',
        #         label=format_lazy(_("Create invoices {}"), obj),
        #         params=dict(master_instance=obj))

    def setup_config_menu(self, site, user_type, m):
        mg = site.plugins.sales
        m = m.add_menu(mg.app_label, mg.verbose_name)
        m.add_action('invoicing.Tariffs')
        m.add_action('invoicing.Areas')

    def setup_explorer_menu(self, site, user_type, m):
        mg = site.plugins.sales
        m = m.add_menu(mg.app_label, mg.verbose_name)
        m.add_action('invoicing.AllPlans')
        m.add_action('invoicing.SalesRules')