示例#1
0
    def delete(self, requisition_id):
        requisition = get(requisition_id)
        requisition.void = True

        with transaction.manager:
            DBSession.merge(requisition)
            transaction.commit()
示例#2
0
 def _update():
     if _is_valid(j_user):
         user = get({"user_id": self.id})
         user = _set_user(user)
         with transaction.manager:
             DBSession.merge(user)
             transaction.commit()
示例#3
0
 def _update():
     with transaction.manager:
         requisition = DBSession.get(requisition.id)
         #requisition = _set_requisition(requisition)
         requisition.department = department_id
         requisition.expected_date = expected_date
         DBSession.merge(requisition)
         transaction.commit()
示例#4
0
        def _update():
            purchase_order_id = self.id
            purchase_order = _set_purchase_order(get({"id":
                                                      purchase_order_id}))

            with transaction.manager:
                DBSession.merge(purchase_order)
                transaction.commit()
示例#5
0
 def delete(self, j_group):
     try:
         name = j_group.pop("group.name")
         self.id = j_group.pop("group.id")
     except KeyError as err:
         print(err)
         raise KeyError()
     with transaction.manager:
         group = DBSession.query(Group).get(self.id)
         #Complete deletion may not be the best option. An alternative -
         #option is to void the instance
         #DBSession.delete(group)
         group.void = True
         DBSession.merge(group)
         transaction.commit()
示例#6
0
        def _update():
            """
            Update an existing Group
            """
            try:
                self.id = j_group.pop("group.id")
                self.name = j_group.pop("group.name")

            except KeyError as err:
                print(err)
                raise KeyError

            with transaction.manager:
                group = DBSession.query(Group).get(self.id)
                if group is None:
                    raise ValueError("Group not found")
                group.name = self.name
                group.modified_by = self.modified_by
                group.modified_date = self.now
                DBSession.merge(group)
                transaction.commit()
示例#7
0
 def _update():
     with transaction.manager:
         item_category = DBSession.query(ItemCategory).get(item_category_id)
         if item_category is None:
             _create()
         
         item_category.name = name
         item_category.notes = notes
         item_category.modified_by = user #user.id
         item_category = DBSession.merge(item_category)
         #region_invalidate(_add)
         return self._to_json(item_category)
示例#8
0
 def _update():
     with transaction.manager:
         item = DBSession.query(Item).get(item_id)
         if item is None:
             _create()
         
         item.name = name
         item.category = category
         item.unit_of_measurement = unit_of_measurement
         item.notes = notes
         item.modified_by = user #user.id
         item = DBSession.merge(item)
         #region_invalidate(_add)
         return self._to_json(item)
示例#9
0
        def _update():
            with transaction.manager:
                supplier = DBSession.query(Supplier).get(supplier_id)
                if supplier is None:
                    _create()

                supplier.name = name
                supplier.tel_1 = tel_1
                supplier.tel_2 = tel_2
                supplier.fax = fax
                supplier.email = email
                supplier.website = website
                supplier.address = address
                supplier.notes = notes
                supplier.modified_by = user  #user.id
                supplier = DBSession.merge(supplier)
                #region_invalidate(_add)
                return self._to_json(supplier)
示例#10
0
 def _update():
     item = DBSession.query(Item).get(item_id)
     _setattr(item)
     with transaction.manager:
         DBSession.merge(item)
         return True
示例#11
0
 def _update():
     branch = DBSession.query(SupplierBranch).get(branch_id)
     branch = _setattr(branch)
     with transaction.manager:
         DBSession.merge(branch)