Skip to content

Instantly share code, notes, and snippets.

@winzard
Created January 23, 2018 14:50
Show Gist options
  • Save winzard/0f1792ab7b17b8d07ac1935581f7a463 to your computer and use it in GitHub Desktop.
Save winzard/0f1792ab7b17b8d07ac1935581f7a463 to your computer and use it in GitHub Desktop.

Revisions

  1. winzard created this gist Jan 23, 2018.
    22 changes: 22 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    def change_line_product(line_id, product_id):
    pass
    if changed:
    self.calculate_total()

    def change_line_quantity(line_id, qty):
    pass
    if changed:
    self.calculate_total()

    def change_line_price(line_id, price):
    pass
    if changed:
    self.calculate_total()

    # vs

    def change_line(line_id, product_id, qty, price):
    self.change_product(line_id, product_id)
    self.change_quanity(line_id, qty)
    self.change_line_price(line_id, price)