Calculation Formula


I want to create a server script that will Multiply qty*Rate to give Amount and the to populate the Total Qty and the Total Amount field as seen in the screenshot above. Please help.

The following script may help you

  def before_save(self):
        print(self.raw_materials)
        for item in self.raw_materials:
            print(item.issu_qty_entry)
            print(item.issued_qty)
            if (item.issu_qty_entry):
                issu_qty_entry_minus = -1 * item.issu_qty_entry
                if (issu_qty_entry_minus != item.issued_qty):
                    item.issued_qty = issu_qty_entry_minus
                    print(item.issued_qty)
1 Like