Skip to content

Commit

Permalink
[MIG] account_multic_fix: Migration to 15.0
Browse files Browse the repository at this point in the history
closes #102

Signed-off-by: Juan José Scarafía <jjs@adhoc.com.ar>
  • Loading branch information
nicomacr committed May 9, 2022
1 parent 85f0e5d commit 03c58d8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 190 deletions.
4 changes: 2 additions & 2 deletions account_multic_fix/__manifest__.py
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Account Multi Company Fixes',
'version': '13.0.1.1.0',
'version': "15.0.1.0.0",
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
Expand All @@ -29,5 +29,5 @@
'views/account_bank_statement_line_views.xml',
],
'demo': [],
'installable': False,
'installable': True,
}
2 changes: 0 additions & 2 deletions account_multic_fix/models/__init__.py
Expand Up @@ -3,5 +3,3 @@
# directory
##############################################################################
from . import account_move
from . import account_move_line
from . import account_master_port
161 changes: 0 additions & 161 deletions account_multic_fix/models/account_master_port.py

This file was deleted.

23 changes: 12 additions & 11 deletions account_multic_fix/models/account_move.py
Expand Up @@ -15,7 +15,7 @@ def _onchange_journal(self):
company_changed = self.company_id != self._origin.company_id
if self.line_ids:
company_changed = self.company_id != self.line_ids[0].account_id.company_id
elif self.invoice_partner_bank_id.company_id and self.invoice_partner_bank_id.company_id != self.company_id:
elif self.partner_bank_id.company_id and self.partner_bank_id.company_id != self.company_id:
company_changed = True
elif self.invoice_payment_term_id.company_id and self.invoice_payment_term_id.company_id != self.company_id:
company_changed = True
Expand Down Expand Up @@ -57,21 +57,22 @@ def _onchange_journal(self):
if self.currency_id != self.company_id.currency_id:
self._onchange_currency()
# si bien onchange partner llama _recompute_dynamic_lines no manda el recompute_all_taxes, este refrezca
# lineas de impuestos
# lineas de impuestos+
self._recompute_dynamic_lines(recompute_all_taxes=True)
return super()._onchange_journal()

@api.onchange('partner_id')
def _onchange_partner_id(self):
if not self._context.get('force_company'):
self = self.with_context(force_company=self.company_id.id)
res = super(AccountMove, self)._onchange_partner_id()
res = super()._onchange_partner_id()
partner_banks = self.bank_partner_id.bank_ids.filtered(lambda x: x.company_id == self.company_id)
self.invoice_partner_bank_id = partner_banks and partner_banks[0]
self.partner_bank_id = partner_banks and partner_banks[0]
return res

def _recompute_payment_terms_lines(self):
''' Compute the dynamic payment term lines of the journal entry.'''
if not self._context.get('force_company'):
self = self.with_context(force_company=self.company_id.id)
return super(AccountMove, self)._recompute_payment_terms_lines()
@api.depends('company_id', 'invoice_filter_type_domain')
def _compute_suitable_journal_ids(self):
# we override this method to add filter by companies in the env instead of the company of the user
for m in self:
journal_type = m.invoice_filter_type_domain or 'general'
company_ids = self.env.companies.ids
domain = [('company_id', 'in', company_ids), ('type', '=', journal_type)]
m.suitable_journal_ids = self.env['account.journal'].search(domain)
14 changes: 0 additions & 14 deletions account_multic_fix/models/account_move_line.py

This file was deleted.

0 comments on commit 03c58d8

Please sign in to comment.