From 65faca9947f2542f60505ef7739db52d9f422ae5 Mon Sep 17 00:00:00 2001 From: sergiocorato Date: Thu, 4 Jul 2024 22:13:37 +0200 Subject: [PATCH] [FIX] other dead code --- l10n_it_withholding_tax/models/account.py | 68 ----------------------- 1 file changed, 68 deletions(-) diff --git a/l10n_it_withholding_tax/models/account.py b/l10n_it_withholding_tax/models/account.py index c168bffeae4d..216a97a69158 100644 --- a/l10n_it_withholding_tax/models/account.py +++ b/l10n_it_withholding_tax/models/account.py @@ -289,74 +289,6 @@ class AccountFiscalPosition(models.Model): class AccountMove(models.Model): _inherit = "account.move" - def _prepare_wt_values(self): - self.ensure_one() - partner = False - wt_competence = {} - # First : Partner and WT competence - for line in self.line_id: - if line.partner_id: - partner = line.partner_id - if partner.property_account_position: - for wt in partner.property_account_position.withholding_tax_ids: - wt_competence[wt.id] = { - "withholding_tax_id": wt.id, - "partner_id": partner.id, - "date": self.date, - "account_move_id": self.id, - "wt_account_move_line_id": False, - "base": 0, - "amount": 0, - } - break - # After : Loking for WT lines - wt_amount = 0 - for line in self.line_id: - domain = [] - # WT line - if line.credit: - domain.append(("account_payable_id", "=", line.account_id.id)) - amount = line.credit - else: - domain.append(("account_receivable_id", "=", line.account_id.id)) - amount = line.debit - wt_ids = self.pool["withholding.tax"].search( - self.env.cr, self.env.uid, domain - ) - if wt_ids: - wt_amount += amount - if ( - wt_competence - and wt_competence[wt_ids[0]] - and "amount" in wt_competence[wt_ids[0]] - ): - wt_competence[wt_ids[0]]["wt_account_move_line_id"] = line.id - wt_competence[wt_ids[0]]["amount"] = wt_amount - wt_competence[wt_ids[0]]["base"] = self.pool[ - "withholding.tax" - ].get_base_from_tax(self.env.cr, self.env.uid, wt_ids[0], wt_amount) - - wt_codes = [] - if wt_competence: - for _key, val in wt_competence.items(): - wt_codes.append(val) - res = { - "partner_id": partner and partner.id or False, - "move_id": self.id, - "invoice_id": False, - "date": self.date, - "base": wt_codes and wt_codes[0]["base"] or 0, - "tax": wt_codes and wt_codes[0]["amount"] or 0, - "withholding_tax_id": ( - wt_codes and wt_codes[0]["withholding_tax_id"] or False - ), - "wt_account_move_line_id": ( - wt_codes and wt_codes[0]["wt_account_move_line_id"] or False - ), - "amount": wt_codes[0]["amount"], - } - return res - @api.depends( "invoice_line_ids.price_subtotal", "withholding_tax_line_ids.tax",