19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:34 +01:00
parent c5006a6999
commit 80293571e7
420 changed files with 21812 additions and 44297 deletions

View file

@ -0,0 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import base_document_layout
from . import template_ma
from . import res_partner

View file

@ -0,0 +1,18 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from markupsafe import Markup
from odoo import api, fields, models
class BaseDocumentLayout(models.TransientModel):
_inherit = 'base.document.layout'
@api.model
def _default_company_details(self):
# OVERRIDE web/models/base_document_layout
company_details = super()._default_company_details()
if self.env.company.country_code == 'MA':
company_details += Markup('<br> ICE: %s') % self.env.company.company_registry
return company_details
company_details = fields.Html(default=_default_company_details)

View file

@ -0,0 +1,17 @@
from odoo import api, models, _
from odoo.exceptions import ValidationError
class ResPartner(models.Model):
_inherit = 'res.partner'
@api.constrains('company_registry', 'country_id')
def _check_company_registry_ma(self):
for record in self:
if record.country_code == 'MA' and record.company_registry and (len(record.company_registry) != 15 or not record.company_registry.isdigit()):
raise ValidationError(_("ICE number should have exactly 15 digits."))
def _get_company_registry_labels(self):
labels = super()._get_company_registry_labels()
labels['MA'] = _("ICE")
return labels

View file

@ -0,0 +1,51 @@
# 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('ma')
def _get_ma_template_data(self):
return {
'code_digits': '6',
'property_account_receivable_id': 'pcg_34211',
'property_account_payable_id': 'pcg_44111',
'display_invoice_amount_total_words': True,
}
@template('ma', 'res.company')
def _get_ma_res_company(self):
return {
self.env.company.id: {
'account_fiscal_country_id': 'base.ma',
'bank_account_code_prefix': '5141',
'cash_account_code_prefix': '51611',
'transfer_account_code_prefix': '5115',
'account_default_pos_receivable_account_id': 'pcg_34218',
'income_currency_exchange_account_id': 'pcg_7331',
'expense_currency_exchange_account_id': 'pcg_6331',
'account_journal_suspense_account_id': 'pcg_3497',
'default_cash_difference_income_account_id': 'pcg_73861',
'default_cash_difference_expense_account_id': 'pcg_63861',
'account_journal_early_pay_discount_gain_account_id': 'pcg_73862',
'account_journal_early_pay_discount_loss_account_id': 'pcg_63862',
'account_sale_tax_id': 'vat_out_20_80',
'account_purchase_tax_id': 'vat_in_20_146',
'income_account_id': 'pcg_7111',
'expense_account_id': 'pcg_6111',
'tax_exigibility': 'True',
'account_stock_journal_id': 'inventory_valuation',
'account_stock_valuation_id': 'pcg_31211',
},
}
@template('ma', 'account.account')
def _get_ma_account_account(self):
return {
'pcg_31211': {
'account_stock_expense_id': 'pcg_61211',
'account_stock_variation_id': 'pcg_61241',
},
}