Commit 60a51a54 by 夏超

[fix] 玖姿问题

parent 822a15b7
...@@ -20,7 +20,7 @@ class ProductIncomeExpense(models.Model): ...@@ -20,7 +20,7 @@ class ProductIncomeExpense(models.Model):
@api.depends("income", "expenditure") @api.depends("income", "expenditure")
def _compute_balance(self): def _compute_balance(self):
data = self.search([("id", "in", self.ids)], order="business_date asc, create_date asc") data = self.search([], order="business_date asc, create_date asc")
for v in data: for v in data:
last_data = self.search([ last_data = self.search([
"|", "|",
...@@ -31,6 +31,6 @@ class ProductIncomeExpense(models.Model): ...@@ -31,6 +31,6 @@ class ProductIncomeExpense(models.Model):
("id", "!=", v.id) ("id", "!=", v.id)
], limit=1, order="business_date desc, create_date desc") ], limit=1, order="business_date desc, create_date desc")
if not last_data: if not last_data:
v.balance = 0 + v.income - v.expenditure v.balance = round(0 + v.income - v.expenditure, 2)
else: else:
v.balance = last_data.balance + v.income - v.expenditure v.balance = round(last_data.balance + v.income - v.expenditure, 2)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment