Skip to content

Commit

Permalink
Merge pull request #236 from NoeBerdoz/14-clean-delete-and-precommit
Browse files Browse the repository at this point in the history
Clean deletion of analytic_tag_id setting parameter and pre-commit cleanings
  • Loading branch information
NoeBerdoz authored Jul 11, 2024
2 parents 3192f94 + 12dabff commit c4430b9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 32 deletions.
1 change: 0 additions & 1 deletion account_analytic_compassion/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
],
"data": [
"views/product_view.xml",
"views/res_config_setting_view.xml",
"views/account_asset_view.xml",
],
"demo": ["analytic_account_data.xml"],
Expand Down
23 changes: 0 additions & 23 deletions account_analytic_compassion/views/res_config_setting_view.xml

This file was deleted.

21 changes: 13 additions & 8 deletions account_offbalance_sponsorship/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,22 @@ def get_account_offbalance(self, company):
)

def reconcile(self):
# check if there is a currency diff and relaod the invoice with the rate received
# check if there is a currency diff
# and reload the invoice with the rate received
filtered_item = self.filtered(
lambda l: l.journal_id != self.company_id.currency_exchange_journal_id
lambda line: line.journal_id != self.company_id.currency_exchange_journal_id
)
total = total_curr = 0
for l in filtered_item:
total = l.debit - l.credit + total
total_curr = l.amount_currency + total_curr
for line in filtered_item:
total = line.debit - line.credit + total
total_curr = line.amount_currency + total_curr
if total != 0 and total_curr == 0:
inv_to_refresh = filtered_item.filtered(
lambda l: l.move_id.journal_id.type == "sale"
lambda line: line.move_id.journal_id.type == "sale"
).move_id
nr = filtered_item.filtered(lambda l: l.move_id.journal_id.type != "sale")
nr = filtered_item.filtered(
lambda line: line.move_id.journal_id.type != "sale"
)
new_rate = sum(n.amount_currency for n in nr) / sum(
n.debit - n.credit for n in nr
)
Expand Down Expand Up @@ -96,7 +99,9 @@ def remove_off_balance_lines(self, inv_move, pmt_move):
ids_to_unlink = self.env["account.move.line"]
for move_name in inv_move.mapped("name"):
ids_to_unlink += rec_lines.filtered(
lambda l: l.account_id.id != off_rec and l.name == move_name
lambda line, current_name=move_name: line.account_id.id
!= off_rec
and line.name == current_name
)
pmt.line_ids -= ids_to_unlink
pmt.write({"state": "posted"})
Expand Down

0 comments on commit c4430b9

Please sign in to comment.