This commit is contained in:
esam 2025-10-03 21:07:25 -04:00
parent 39474a5608
commit b99aebd729
1 changed files with 1 additions and 4 deletions

View File

@ -164,7 +164,6 @@ class CtpDatabaseCleanUp(models.TransientModel):
] ]
return self.remove_data(to_removes, seqs) return self.remove_data(to_removes, seqs)
# VVVVVVVVVVV قم باستبدال الدالة التالية VVVVVVVVVVV
def remove_account(self): def remove_account(self):
to_removes = [ to_removes = [
'payment.transaction', 'payment.transaction',
@ -178,7 +177,6 @@ class CtpDatabaseCleanUp(models.TransientModel):
'account.move', 'account.move',
] ]
res = self.remove_data(to_removes, []) res = self.remove_data(to_removes, [])
# FIX: The domain syntax was incorrect (extra '|' at the end)
domain = [ domain = [
('company_id', '=', self.env.company.id), ('company_id', '=', self.env.company.id),
'|', ('code', '=ilike', 'account.%'), '|', ('code', '=ilike', 'account.%'),
@ -196,7 +194,7 @@ class CtpDatabaseCleanUp(models.TransientModel):
}) })
except Exception as e: except Exception as e:
_logger.error('Reset Sequence Data error: %s,%s', domain, e) _logger.error('Reset Sequence Data error: %s,%s', domain, e)
self._cr.rollback() # Rollback on error self._cr.rollback()
return res return res
def remove_account_chart(self): def remove_account_chart(self):
@ -230,7 +228,6 @@ class CtpDatabaseCleanUp(models.TransientModel):
'property_account_expense_id': False, 'property_account_expense_id': False,
}) })
# FIX: Check if 'stock.location' model exists before trying to access it
if self.env['ir.model']._get('stock.location'): if self.env['ir.model']._get('stock.location'):
self.env['stock.location'].search([]).write({ self.env['stock.location'].search([]).write({
'valuation_in_account_id': False, 'valuation_out_account_id': False, 'valuation_in_account_id': False, 'valuation_out_account_id': False,