mirror of
https://github.com/bringout/oca-ocb-accounting.git
synced 2026-04-23 21:22:03 +02:00
[16.1] Add lock date migration and settings UI
This commit is contained in:
parent
64fdc5b0df
commit
c7d2961320
6 changed files with 186 additions and 14 deletions
|
|
@ -38,6 +38,13 @@ class AccountAccount(models.Model):
|
|||
currency_id = fields.Many2one('res.currency', string='Account Currency', tracking=True,
|
||||
help="Forces all journal items in this account to have a specific currency (i.e. bank journals). If no currency is set, entries can use any currency.")
|
||||
company_currency_id = fields.Many2one(related='company_id.currency_id')
|
||||
company_ids = fields.Many2many(
|
||||
'res.company',
|
||||
compute='_compute_company_ids',
|
||||
search='_search_company_ids',
|
||||
string='Companies',
|
||||
compute_sudo=True,
|
||||
)
|
||||
code = fields.Char(size=64, required=True, tracking=True, unaccent=False)
|
||||
deprecated = fields.Boolean(default=False, tracking=True)
|
||||
used = fields.Boolean(compute='_compute_used', search='_search_used')
|
||||
|
|
@ -344,6 +351,23 @@ class AccountAccount(models.Model):
|
|||
for record in self:
|
||||
record.used = record.id in ids
|
||||
|
||||
def _compute_company_ids(self):
|
||||
for account in self:
|
||||
account.company_ids = account.company_id
|
||||
|
||||
def _search_company_ids(self, operator, value):
|
||||
if operator in ('in', 'not in'):
|
||||
if isinstance(value, (list, tuple, set)):
|
||||
values = list(value)
|
||||
elif hasattr(value, 'ids'):
|
||||
values = value.ids
|
||||
else:
|
||||
values = [value]
|
||||
return [('company_id', operator, values)]
|
||||
if hasattr(value, 'id'):
|
||||
value = value.id
|
||||
return [('company_id', operator, value)]
|
||||
|
||||
@api.model
|
||||
def _search_new_account_code(self, company, digits, prefix):
|
||||
for num in range(1, 10000):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue