Skip to content

Commit

Permalink
Haciendo que cuadre
Browse files Browse the repository at this point in the history
  • Loading branch information
Lopsanz committed Jun 11, 2024
1 parent 23faeca commit 83d559f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions mis_report_por_grupo/models/account_move_line_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def init(self):
acc2.name AS acc2_name,
acc.code AS original_code,
acc.name AS original_name,
aml.id AS move_line_id,
aml.id AS move_line_id,

Check failure on line 53 in mis_report_por_grupo/models/account_move_line_group.py

View workflow job for this annotation

GitHub Actions / flake8_py3

mis_report_por_grupo/models/account_move_line_group.py#L53

[W291] trailing whitespace
aml.id AS id,
aml.date AS date,
aml.debit AS debit,
aml.credit AS credit,
Expand All @@ -75,19 +76,25 @@ def init(self):
aa.group_id, aa.company_id, aa.id, aa.code, aa.name
) AS acc2 ON acc2.group_id = acc.group_id
AND acc2.company_id = aml.company_id
WHERE aml.parent_state != 'cancel'
)
""")
self.recreate_accounts()

def recreate_accounts(self):
accounts = self.env['account.account']
for acc in self.env['account.account'].search([
('user_type_id', '!=', 'Current Year Earnings'),
('group_id', '!=', False),]):
if not accounts.search([
('company_id', '=', acc.company_id.id),
('code', '=', acc.group_id.code_prefix_start)]):
acc.copy({
values = {
'company_id': acc.company_id.id,
'name': acc.group_id.name or '',
'code': acc.group_id.code_prefix_start,
'deprecated': True,
'asset_profile_id': False,
})
}
if 'asset_profile_id' in acc._fields:
values['asset_profile_id'] = False
acc.copy(values)

0 comments on commit 83d559f

Please sign in to comment.