Beispiel #1
0
def sale_product(dbsession):
    from autonomie.models.sale_product import SaleProduct
    s = SaleProduct(
        value=1.5,
        tva=2000,
        label=u"Produit du catalogue",
        description=u"Description du produit du catalogue",
        unity="m",
    )
    dbsession.add(s)
    dbsession.flush()
    return s
Beispiel #2
0
    def post_load_lines_from_catalog_view(self):
        """
        View handling product to line loading

        expects sale_product_ids: [id1, id2] as POST params
        """
        logger.debug("post_load_from_catalog_view")
        sale_product_ids = self.request.json_body.get('sale_product_ids', [])
        logger.debug("sale_product_ids : %s", sale_product_ids)

        lines = []
        for id_ in sale_product_ids:
            sale_product = SaleProduct.get(id_)
            line = TaskLine.from_sale_product(sale_product)
            self.context.lines.append(line)
            lines.append(line)
        self.request.dbsession.merge(self.context)
        return lines
    def post_load_lines_from_catalog_view(self):
        """
        View handling product to line loading

        expects sale_product_ids: [id1, id2] as POST params
        """
        logger.debug("post_load_from_catalog_view")
        sale_product_ids = self.request.json_body.get('sale_product_ids', [])
        logger.debug("sale_product_ids : %s", sale_product_ids)

        lines = []
        for id_ in sale_product_ids:
            sale_product = SaleProduct.get(id_)
            line = TaskLine.from_sale_product(sale_product)
            self.context.lines.append(line)
            lines.append(line)
        self.request.dbsession.merge(self.context)
        return lines