fix issue with accounting singleton
This commit is contained in:
parent
f644f2f61f
commit
288435b0b7
|
|
@ -134,19 +134,20 @@ class AccountMove(models.Model):
|
|||
|
||||
def button_draft(self):
|
||||
res = super(AccountMove, self).button_draft()
|
||||
if self.is_check:
|
||||
date = fields.Date.from_string(self.date)
|
||||
for line in self.invoice_line_ids:
|
||||
analytic_account_id = line.analytic_account_id
|
||||
budget_post = self.env['account.budget.post'].search([]).filtered(
|
||||
lambda x: line.account_id in x.account_ids)
|
||||
budget_lines = analytic_account_id.crossovered_budget_line.filtered(
|
||||
lambda x: x.general_budget_id in budget_post and
|
||||
x.crossovered_budget_id.state == 'done' and
|
||||
fields.Date.from_string(x.date_from) <= date <= fields.Date.from_string(x.date_to))
|
||||
amount = budget_lines.confirm
|
||||
amount -= (line.price_subtotal + line.price_tax)
|
||||
budget_lines.write({'confirm': amount})
|
||||
for rec in self:
|
||||
if rec.is_check:
|
||||
date = fields.Date.from_string(rec.date)
|
||||
for line in rec.invoice_line_ids:
|
||||
analytic_account_id = line.analytic_account_id
|
||||
budget_post = self.env['account.budget.post'].search([]).filtered(
|
||||
lambda x: line.account_id in x.account_ids)
|
||||
budget_lines = analytic_account_id.crossovered_budget_line.filtered(
|
||||
lambda x: x.general_budget_id in budget_post and
|
||||
x.crossovered_budget_id.state == 'done' and
|
||||
fields.Date.from_string(x.date_from) <= date <= fields.Date.from_string(x.date_to))
|
||||
amount = budget_lines.confirm
|
||||
amount -= (line.price_subtotal + line.price_tax)
|
||||
budget_lines.write({'confirm': amount})
|
||||
return res
|
||||
|
||||
def action_budget(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue