def add_gsx_part(self, part): """ Adds a part that has been added manually in GSX web UI """ # part has been added to the order, but not the GSX repair try: oi = self.order.products.get(code=part.partNumber) except ServiceOrderItem.DoesNotExist: new_part = ServicePart(part_number=part.partNumber) try: p = Product.objects.get(code=part.partNumber) except Product.DoesNotExist: p = Product.from_gsx(new_part.lookup()) p.save() oi = self.order.add_product(p, 1, self.created_by) oi.comptia_code = part.comptiaCode or "" oi.comptia_modifier = part.comptiaModifier or "" oi.save() sp = ServicePart.from_soi(self, oi) sp.set_part_details(part) sp.order(self.created_by) sp.save()
def add_gsx_part(self, part): """ Adds a part that has been added manually in GSX web UI """ # part has been added to the order, but not the GSX repair try: oi = self.order.products.get(code=part.partNumber) except ServiceOrderItem.DoesNotExist: new_part = ServicePart(part_number=part.partNumber) try: p = Product.objects.get(code=part.partNumber) except Product.DoesNotExist: p = Product.from_gsx(new_part.lookup()) p.save() oi = self.order.add_product(p, 1, self.created_by) oi.comptia_code = part.comptiaCode or '' oi.comptia_modifier = part.comptiaModifier or '' oi.save() sp = ServicePart.from_soi(self, oi) sp.set_part_details(part) sp.order(self.created_by) sp.save()
def set_parts(self, parts): """ Resets this Repair's part listing """ ServicePart.objects.filter(repair=self).delete() for p in parts: part = ServicePart.from_soi(self, p) part.save()
def add_part(self, order_item, user): """ Adds this Order Item as a part to this GSX repair """ self.connect_gsx(user) gsx_rep = self.get_gsx_repair() part = ServicePart.from_soi(self, order_item) order_line = part.get_repair_order_line() gsx_rep.update({'orderLines': [order_line]}) part.order(user) return part
def add_part(self, order_item, user): """ Adds this Order Item as a part to this GSX repair """ self.connect_gsx(user) gsx_rep = self.get_gsx_repair() part = ServicePart.from_soi(self, order_item) order_line = part.get_repair_order_line() gsx_rep.update({"orderLines": [order_line]}) part.order(user) return part
def set_parts(self, parts): ServicePart.objects.filter(repair=self).delete() for p in parts: part = ServicePart.from_soi(self, p) part.save()