def delete(self, requisition_id): requisition = get(requisition_id) requisition.void = True with transaction.manager: DBSession.merge(requisition) transaction.commit()
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()
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()
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()
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()
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()
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)
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)
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)
def _update(): item = DBSession.query(Item).get(item_id) _setattr(item) with transaction.manager: DBSession.merge(item) return True
def _update(): branch = DBSession.query(SupplierBranch).get(branch_id) branch = _setattr(branch) with transaction.manager: DBSession.merge(branch)