venmo/business-rules

How to pass parameters into variables?

chenyusheng opened this issue · 1 comments

hi, i got a problem in using busuness-rules.
i need to pass some parameters into variables so that the variables fun can query data from my database.
just like the actions can config some parm

@rule_action(params={"number_to_order": FIELD_NUMERIC})
 def order_more(self, number_to_order):
        ProductOrder.objects.create(product_id=self.product.id,quantity=number_to_order)

but it seems impossible to achieve.
what can i do?

Instead of this action working on self.product, why not a self.order that contains the product id and the quantity?

def order_more(self):
        ProductOrder.objects.create(product_id=self.order.product_id,quantity=self.order.quantity)