mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-27 00:22:03 +02:00
19.0 vanilla
This commit is contained in:
parent
ff721d030e
commit
7721452493
1826 changed files with 124775 additions and 274114 deletions
5
odoo-bringout-oca-ocb-l10n_cz/l10n_cz/models/__init__.py
Normal file
5
odoo-bringout-oca-ocb-l10n_cz/l10n_cz/models/__init__.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import l10n_cz_tax_office
|
||||
from . import template_cz
|
||||
from . import res_company
|
||||
from . import account_move
|
||||
30
odoo-bringout-oca-ocb-l10n_cz/l10n_cz/models/account_move.py
Normal file
30
odoo-bringout-oca-ocb-l10n_cz/l10n_cz/models/account_move.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
@api.depends('country_code')
|
||||
def _compute_taxable_supply_date(self):
|
||||
super()._compute_taxable_supply_date()
|
||||
for move in self.filtered(lambda m: m.country_code == 'CZ' and not m.taxable_supply_date):
|
||||
move.taxable_supply_date = fields.Date.context_today(move)
|
||||
|
||||
@api.depends('country_code')
|
||||
def _compute_show_taxable_supply_date(self):
|
||||
super()._compute_show_taxable_supply_date()
|
||||
for move in self.filtered(lambda m: m.country_code == 'CZ' and m.move_type != 'entry'):
|
||||
move.show_taxable_supply_date = True
|
||||
|
||||
def _compute_date(self):
|
||||
super()._compute_date()
|
||||
for move in self:
|
||||
if move.country_code == 'CZ' and move.taxable_supply_date and move.state == 'draft' and not move.statement_line_id:
|
||||
move.date = move.taxable_supply_date
|
||||
|
||||
def _get_invoice_currency_rate_date(self):
|
||||
self.ensure_one()
|
||||
if self.country_code == 'CZ' and self.taxable_supply_date:
|
||||
return self.taxable_supply_date
|
||||
return super()._get_invoice_currency_rate_date()
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
from odoo import fields, models
|
||||
|
||||
|
||||
class L10nCzTaxOffice(models.Model):
|
||||
_name = 'l10n_cz.tax_office'
|
||||
_description = 'Tax office in Czech Republic'
|
||||
_order = 'workplace_code ASC'
|
||||
_rec_names_search = ['workplace_code', 'name']
|
||||
|
||||
workplace_code = fields.Integer(string="Territorial Office", required=True, aggregator=False)
|
||||
code = fields.Integer(string="Code", required=True, aggregator=False)
|
||||
name = fields.Char(string="Name", translate=True)
|
||||
region = fields.Char(string="Region", required=True, translate=True)
|
||||
|
||||
_workplace_code_unique = models.Constraint(
|
||||
'UNIQUE (workplace_code)',
|
||||
"The territorial workplace code must be unique",
|
||||
)
|
||||
20
odoo-bringout-oca-ocb-l10n_cz/l10n_cz/models/res_company.py
Normal file
20
odoo-bringout-oca-ocb-l10n_cz/l10n_cz/models/res_company.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = "res.company"
|
||||
|
||||
trade_registry = fields.Char()
|
||||
l10n_cz_tax_office_id = fields.Many2one(
|
||||
string="Tax Office (CZ)",
|
||||
comodel_name='l10n_cz.tax_office',
|
||||
)
|
||||
|
||||
|
||||
class BaseDocumentLayout(models.TransientModel):
|
||||
_inherit = 'base.document.layout'
|
||||
|
||||
account_fiscal_country_id = fields.Many2one(related="company_id.account_fiscal_country_id")
|
||||
company_registry = fields.Char(related='company_id.company_registry')
|
||||
78
odoo-bringout-oca-ocb-l10n_cz/l10n_cz/models/template_cz.py
Normal file
78
odoo-bringout-oca-ocb-l10n_cz/l10n_cz/models/template_cz.py
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import api, models
|
||||
from odoo.addons.account.models.chart_template import template
|
||||
|
||||
|
||||
class AccountChartTemplate(models.AbstractModel):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
@template('cz')
|
||||
def _get_cz_template_data(self):
|
||||
return {
|
||||
'code_digits': '6',
|
||||
'use_storno_accounting': True,
|
||||
'property_account_receivable_id': 'chart_cz_311000',
|
||||
'property_account_payable_id': 'chart_cz_321000',
|
||||
'property_stock_valuation_account_id': 'chart_cz_132000',
|
||||
}
|
||||
|
||||
@template('cz', 'res.company')
|
||||
def _get_cz_res_company(self):
|
||||
return {
|
||||
self.env.company.id: {
|
||||
'account_fiscal_country_id': 'base.cz',
|
||||
'bank_account_code_prefix': '221',
|
||||
'cash_account_code_prefix': '211',
|
||||
'transfer_account_code_prefix': '261',
|
||||
'income_currency_exchange_account_id': 'chart_cz_663000',
|
||||
'expense_currency_exchange_account_id': 'chart_cz_563000',
|
||||
'account_journal_suspense_account_id': 'chart_cz_261000',
|
||||
'default_cash_difference_income_account_id': 'chart_cz_668000',
|
||||
'default_cash_difference_expense_account_id': 'chart_cz_568000',
|
||||
'account_default_pos_receivable_account_id': 'chart_cz_311001',
|
||||
'account_sale_tax_id': 'l10n_cz_21_domestic_supplies',
|
||||
'account_purchase_tax_id': 'l10n_cz_21_receipt_domestic_supplies',
|
||||
'expense_account_id': 'chart_cz_504000',
|
||||
'income_account_id': 'chart_cz_604000',
|
||||
'account_stock_journal_id': 'inventory_valuation',
|
||||
'account_stock_valuation_id': 'chart_cz_131000',
|
||||
},
|
||||
}
|
||||
|
||||
@api.model
|
||||
def _get_demo_data_move(self, company=False):
|
||||
data = super()._get_demo_data_move(company)
|
||||
if company and company.account_fiscal_country_id.code == 'CZ':
|
||||
for key in (
|
||||
'demo_invoice_1',
|
||||
'demo_invoice_2',
|
||||
'demo_invoice_3',
|
||||
'demo_invoice_followup',
|
||||
'demo_invoice_5',
|
||||
'demo_invoice_6',
|
||||
'demo_invoice_7',
|
||||
'demo_invoice_8',
|
||||
'demo_invoice_equipment_purchase',
|
||||
'demo_invoice_9',
|
||||
'demo_invoice_10',
|
||||
'demo_move_auto_reconcile_1',
|
||||
'demo_move_auto_reconcile_2',
|
||||
'demo_move_auto_reconcile_3',
|
||||
'demo_move_auto_reconcile_4',
|
||||
'demo_move_auto_reconcile_5',
|
||||
'demo_move_auto_reconcile_6',
|
||||
'demo_move_auto_reconcile_7',
|
||||
):
|
||||
vals = data[self.company_xmlid(key)]
|
||||
if invoice_date := vals.get('invoice_date'):
|
||||
vals['taxable_supply_date'] = invoice_date
|
||||
return data
|
||||
|
||||
@template('cz', 'account.account')
|
||||
def _get_cz_account_account(self):
|
||||
return {
|
||||
'chart_cz_131000': {
|
||||
'account_stock_expense_id': 'chart_cz_504000',
|
||||
'account_stock_variation_id': 'chart_cz_583000',
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue