Exemple #1
0
    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()
Exemple #2
0
    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()
Exemple #3
0
 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()
Exemple #4
0
 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()
Exemple #5
0
    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
Exemple #6
0
    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
Exemple #7
0
 def set_parts(self, parts):
     ServicePart.objects.filter(repair=self).delete()
     for p in parts:
         part = ServicePart.from_soi(self, p)
         part.save()