19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:28 +01:00
parent ff721d030e
commit 7721452493
1826 changed files with 124775 additions and 274114 deletions

View file

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_chart_template
from . import template_be
from . import template_be_comp
from . import template_be_asso
from . import account_journal
from . import account_move
from . import account_tax
from . import res_partner

View file

@ -1,17 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountChartTemplate(models.Model):
_inherit = 'account.chart.template'
@api.model
def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
journal_data = super(AccountChartTemplate, self)._prepare_all_journals(
acc_template_ref, company, journals_dict)
for journal in journal_data:
if journal['type'] in ('sale', 'purchase') and company.country_id.code == "BE":
journal.update({'refund_sequence': True})
return journal_data

View file

@ -7,5 +7,5 @@ class AccountJournal(models.Model):
_inherit = 'account.journal'
invoice_reference_model = fields.Selection(selection_add=[
('be', 'Belgium')
('be', 'Belgium (+++000/2024/00182+++)')
], ondelete={'be': lambda recs: recs.write({'invoice_reference_model': 'odoo'})})

View file

@ -0,0 +1,9 @@
from odoo import fields, models
class AccountTax(models.Model):
_inherit = 'account.tax'
tax_scope = fields.Selection(
selection_add=[('merch', 'Merchandise'), ('invest', 'Investment')],
)

View file

@ -12,9 +12,9 @@ class ResPartner(models.Model):
@api.depends('vat', 'country_id')
def _compute_company_registry(self):
# OVERRIDE
# If a belgian company has a VAT number then it's company registry is it's VAT Number (without country code).
# If a belgian company has a VAT number then its company registry is its VAT Number (without country code).
super()._compute_company_registry()
for partner in self.filtered(lambda p: p.country_id.code == 'BE' and p.vat):
for partner in self.filtered(lambda p: p._deduce_country_code() == 'BE' and p.vat):
vat_country, vat_number = self._split_vat(partner.vat)
if vat_country == 'be' and self.simple_vat_check(vat_country, vat_number):
if vat_country in ('BE', '') and self._check_vat_number('BE', vat_number):
partner.company_registry = vat_number

View file

@ -0,0 +1,94 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import Command, _, models
from odoo.addons.account.models.chart_template import template
class AccountChartTemplate(models.AbstractModel):
_inherit = 'account.chart.template'
@template('be')
def _get_be_template_data(self):
return {
'name': _('Base'),
'visible': False,
'code_digits': '6',
'property_account_receivable_id': 'a400',
'property_account_payable_id': 'a440',
'downpayment_account_id': 'a46',
}
@template('be', 'res.company')
def _get_be_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.be',
'bank_account_code_prefix': '550',
'cash_account_code_prefix': '570',
'transfer_account_code_prefix': '580',
'account_default_pos_receivable_account_id': 'a4001',
'income_currency_exchange_account_id': 'a754',
'expense_currency_exchange_account_id': 'a654',
'account_journal_suspense_account_id': 'a499',
'account_journal_early_pay_discount_loss_account_id': 'a657000',
'account_journal_early_pay_discount_gain_account_id': 'a757000',
'account_sale_tax_id': 'attn_VAT-OUT-21-L',
'account_purchase_tax_id': 'attn_VAT-IN-V81-21',
'account_purchase_receipt_fiscal_position_id': 'fiscal_position_template_6',
'default_cash_difference_income_account_id': 'a757100',
'default_cash_difference_expense_account_id': 'a657100',
'transfer_account_id': 'a58',
'expense_account_id': 'a600',
'income_account_id': 'a7000',
'account_stock_journal_id': 'inventory_valuation',
'account_stock_valuation_id': 'a300',
},
}
@template('be', 'account.journal')
def _get_be_account_journal(self):
return {
'sale': {'refund_sequence': True},
'purchase': {'refund_sequence': True},
}
@template('be', 'account.reconcile.model')
def _get_be_reconcile_model(self):
return {
'escompte_template': {
'name': 'Cash Discount',
'line_ids': [
Command.create({
'account_id': 'a653',
'amount_type': 'percentage',
'amount_string': '100',
'label': 'Cash Discount Granted',
}),
],
'name@fr': 'Escompte',
'name@nl': 'Betalingskorting',
'name@de': 'Skonto',
},
}
def _get_bank_fees_reco_account(self, company):
# Belgian account for the bank fees reco model. We need to be as precise
# as possible in case it's modified so it's missing and not replaced.
be_account = self.with_company(company).ref('a6560', raise_if_not_found=False)
return be_account or super()._get_bank_fees_reco_account(company)
def _post_load_data(self, template_code, company, template_data):
super()._post_load_data(template_code, company, template_data)
if template_code in ('be_comp', 'be_asso') and \
(purchase_journal := self.ref('purchase', raise_if_not_found=False)) and \
(non_deductible_account := self.ref('a416', raise_if_not_found=False)):
purchase_journal.non_deductible_account_id = non_deductible_account
@template('be', 'account.account')
def _get_be_account_account(self):
return {
'a300': {
'account_stock_expense_id': 'a600',
'account_stock_variation_id': 'a6090',
},
}

View file

@ -0,0 +1,27 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import _, models
from odoo.addons.account.models.chart_template import template
class AccountChartTemplate(models.AbstractModel):
_inherit = 'account.chart.template'
@template('be_asso')
def _get_be_asso_template_data(self):
return {
'name': _('Associations and Foundations'),
'parent': 'be',
'code_digits': '6',
}
@template('be_asso', 'res.company')
def _get_be_asso_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.be',
'bank_account_code_prefix': '550',
'cash_account_code_prefix': '570',
'transfer_account_code_prefix': '580',
},
}

View file

@ -0,0 +1,28 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import _, models
from odoo.addons.account.models.chart_template import template
class AccountChartTemplate(models.AbstractModel):
_inherit = 'account.chart.template'
@template('be_comp')
def _get_be_comp_template_data(self):
return {
'name': _('Companies'),
'parent': 'be',
'code_digits': '6',
'sequence': 0,
}
@template('be_comp', 'res.company')
def _get_be_comp_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.be',
'bank_account_code_prefix': '550',
'cash_account_code_prefix': '570',
'transfer_account_code_prefix': '580',
},
}