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,6 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import template_se_K2
from . import template_se_K3
from . import template_se
from . import res_company
from . import account_move
from . import account_journal

View file

@ -8,7 +8,14 @@ from odoo.exceptions import ValidationError
class AccountJournal(models.Model):
_inherit = 'account.journal'
invoice_reference_model = fields.Selection(selection_add=[('se_ocr2', 'Sweden OCR Level 1 & 2'), ('se_ocr3', 'Sweden OCR Level 3'), ('se_ocr4', 'Sweden OCR Level 4')], ondelete={'se_ocr2': 'set default', 'se_ocr3': 'set default', 'se_ocr4': 'set default'})
invoice_reference_model = fields.Selection(
selection_add=[
('se_ocr2', 'Sweden OCR Level 1 & 2 (1255)'),
('se_ocr3', 'Sweden OCR Level 3 (12658)'),
('se_ocr4', 'Sweden OCR Level 4 (001271)'),
],
ondelete={'se_ocr2': 'set default', 'se_ocr3': 'set default', 'se_ocr4': 'set default'}
)
l10n_se_invoice_ocr_length = fields.Integer(string='OCR Number Length', help="Total length of OCR Reference Number including checksum.", default=6)
@api.constrains('l10n_se_invoice_ocr_length')

View file

@ -24,7 +24,7 @@ class AccountMove(models.Model):
ocr_length = self.journal_id.l10n_se_invoice_ocr_length
if len(reference) + 1 > ocr_length:
raise UserError(_("OCR Reference Number length is greater than allowed. Allowed length in invoice journal setting is %s.") % str(ocr_length))
raise UserError(_("OCR Reference Number length is greater than allowed. Allowed length in invoice journal setting is %s.", ocr_length))
reference = reference.rjust(ocr_length - 1, '0')
return reference + luhn.calc_check_digit(reference)

View file

@ -0,0 +1,36 @@
# 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('se')
def _get_se_template_data(self):
return {
'property_account_receivable_id': 'a1510',
'property_account_payable_id': 'a2440',
'property_stock_valuation_account_id': 'a1410',
'code_digits': '4',
}
@template('se', 'res.company')
def _get_se_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.se',
'bank_account_code_prefix': '193',
'cash_account_code_prefix': '191',
'transfer_account_code_prefix': '194',
'account_default_pos_receivable_account_id': 'a1910',
'income_currency_exchange_account_id': 'a3960',
'expense_currency_exchange_account_id': 'a3960',
'account_journal_early_pay_discount_loss_account_id': 'a9993',
'account_journal_early_pay_discount_gain_account_id': 'a9994',
'account_sale_tax_id': 'sale_tax_25_goods',
'account_purchase_tax_id': 'purchase_tax_25_goods',
'expense_account_id': 'a4000',
'income_account_id': 'a30011',
},
}

View file

@ -0,0 +1,26 @@
# 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('se_K2')
def _get_se_K2_template_data(self):
return {
'name': 'Swedish BAS Chart of Account complete K2',
'parent': 'se',
'code_digits': '4',
}
@template('se_K2', 'res.company')
def _get_se_K2_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.se',
'bank_account_code_prefix': '193',
'cash_account_code_prefix': '191',
'transfer_account_code_prefix': '194',
},
}

View file

@ -0,0 +1,26 @@
# 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('se_K3')
def _get_se_K3_template_data(self):
return {
'name': 'Swedish BAS Chart of Account complete K3',
'parent': 'se_K2',
'code_digits': '4',
}
@template('se_K3', 'res.company')
def _get_se_K3_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.se',
'bank_account_code_prefix': '193',
'cash_account_code_prefix': '191',
'transfer_account_code_prefix': '194',
},
}