Ejemplo n.º 1
0
 def fillresponse(self):
     if self.item.folder is not None and notfree_mode_connect() and not self.request.user.is_superuser:
         if self.item.folder.cannot_view(self.request.user):
             raise LucteriosException(IMPORTANT, _("No allow to view!"))
         if self.item.folder.is_readonly(self.request.user):
             raise LucteriosException(IMPORTANT, _("No allow to write!"))
     XferAddEditor.fillresponse(self)
Ejemplo n.º 2
0
 def fillresponse(self):
     if (self.item.id is None) and hasattr(settings, "DIACAMMA_MAXOWNER"):
         nb_owner = len(Owner.objects.all())
         if getattr(settings, "DIACAMMA_MAXOWNER") <= nb_owner:
             raise LucteriosException(IMPORTANT,
                                      _('You have the maximum of owners!'))
     XferAddEditor.fillresponse(self)
Ejemplo n.º 3
0
 def fill_simple_fields(self):
     XferAddEditor.fill_simple_fields(self)
     if self.item.id is None:
         current_folder = self.getparam('current_folder')
         if current_folder is not None:
             self.item.folder = Folder.objects.get(id=current_folder)
             self.has_changed = True
     return self.has_changed
Ejemplo n.º 4
0
 def fillresponse(self):
     if self.getparam('CHANGE_ART') is not None:
         if self.item.article is not None:
             self.item.designation = self.item.article.designation
             self.item.price = self.item.article.price
             self.item.unit = self.item.article.unit
     XferAddEditor.fillresponse(self)
     self.get_components('article').set_select_query(Article.objects.filter(isdisabled=False))
Ejemplo n.º 5
0
 def fillresponse(self):
     if self.item.folder is not None and notfree_mode_connect(
     ) and not self.request.user.is_superuser:
         if self.item.folder.cannot_view(self.request.user):
             raise LucteriosException(IMPORTANT, _("No allow to view!"))
         if self.item.folder.is_readonly(self.request.user):
             raise LucteriosException(IMPORTANT, _("No allow to write!"))
     XferAddEditor.fillresponse(self)
Ejemplo n.º 6
0
 def fill_simple_fields(self):
     XferAddEditor.fill_simple_fields(self)
     if self.item.id is None:
         current_folder = self.getparam('current_folder')
         if current_folder is not None:
             self.item.folder = Folder.objects.get(id=current_folder)
             self.has_changed = True
     return self.has_changed
Ejemplo n.º 7
0
 def fillresponse(self):
     if (self.item.id is None) and hasattr(settings,
                                           "DIACAMMA_MAXACTIVITY"):
         nb_act = len(Activity.objects.all())
         if getattr(settings, "DIACAMMA_MAXACTIVITY") <= nb_act:
             raise LucteriosException(
                 IMPORTANT, _('You have the maximum of activities!'))
     XferAddEditor.fillresponse(self)
Ejemplo n.º 8
0
 def fillresponse(self):
     if (self.item.id is None) and hasattr(settings, "DIACAMMA_MAXOWNER"):
         nb_owner = len(Owner.objects.all())
         if getattr(settings, "DIACAMMA_MAXOWNER") <= nb_owner:
             raise LucteriosException(
                 IMPORTANT,
                 _("You can't have more than %s owners!") %
                 settings.DIACAMMA_MAXOWNER)
     XferAddEditor.fillresponse(self)
Ejemplo n.º 9
0
 def fillresponse(self):
     self.item.check_date()
     XferAddEditor.fillresponse(self)
     self.actions = []
     if self.no_change:
         if self.added:
             self.add_action(self.get_action(TITLE_MODIFY, "images/ok.png"), params={"SAVE": "YES"})
             self.add_action(EntryAccountClose.get_action(_("Closed"), "images/up.png"), close=CLOSE_YES, params={"REOPEN": "YES"})
         if (self.item.link is None) and self.item.has_third and not self.item.has_cash:
             self.add_action(EntryAccountCreateLinked.get_action(_('Payment'), "images/right.png"), close=CLOSE_YES)
         self.add_action(EntryAccountReverse.get_action(_('Reverse'), 'images/edit.png'), close=CLOSE_YES)
         self.add_action(WrapAction(TITLE_CLOSE, 'images/close.png'))
     else:
         if (self.debit_rest < 0.0001) and (self.credit_rest < 0.0001) and (self.nb_lines > 0):
             self.add_action(EntryAccountValidate.get_action(TITLE_OK, 'images/ok.png'))
         elif self.added:
             self.add_action(self.get_action(TITLE_MODIFY, "images/ok.png"), params={"SAVE": "YES"})
         if self.item.id is None:
             self.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
         else:
             self.add_action(EntryAccountUnlock.get_action(TITLE_CANCEL, 'images/cancel.png'))
Ejemplo n.º 10
0
 def run_save(self, request, *args, **kwargs):
     supportings = self.getparam('supportings', ())
     if len(supportings) > 0:
         multisave = XferContainerAcknowledge()
         multisave.is_view_right = self.is_view_right
         multisave.locked = self.locked
         multisave.model = self.model
         multisave.field_id = self.field_id
         multisave.caption = self.caption
         multisave.closeaction = self.closeaction
         multisave.fillresponse = self.fillresponse_multisave
         return multisave.get(request, *args, **kwargs)
     else:
         return XferAddEditor.run_save(self, request, *args, **kwargs)
Ejemplo n.º 11
0
 def fillresponse(self):
     if (self.item.id is not None) and self.item.is_protected:
         raise LucteriosException(IMPORTANT, _("This cost accounting is protected by other modules!"))
     XferAddEditor.fillresponse(self)
Ejemplo n.º 12
0
 def _search_model(self):
     if self.getparam("budget_revenue") != None:
         self.field_id = 'budget_revenue'
     if self.getparam("budget_expense") != None:
         self.field_id = 'budget_expense'
     XferAddEditor._search_model(self)
Ejemplo n.º 13
0
 def fillresponse(self):
     if not docshow_modify_condition(self):
         raise LucteriosException(IMPORTANT, _("No allow to write!"))
     XferAddEditor.fillresponse(self)
Ejemplo n.º 14
0
 def fillresponse(self):
     contact_id = self.getparam(self.getparam('pkname'))
     self.params['contact'] = contact_id
     self.item.contact = AbstractContact.objects.get(id=contact_id)
     XferAddEditor.fillresponse(self)
Ejemplo n.º 15
0
 def fillresponse(self):
     if self.item.id is None:
         if Params.getvalue("accounting-system") == '':
             raise LucteriosException(IMPORTANT, _('Account system not defined!'))
         self.item.init_dates()
     XferAddEditor.fillresponse(self)
Ejemplo n.º 16
0
 def fill_simple_fields(self):
     for old_key in ['type_of_account']:
         if old_key in self.params.keys():
             del self.params[old_key]
     return XferAddEditor.fill_simple_fields(self)