mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-26 16:42:03 +02:00
19.0 vanilla
This commit is contained in:
parent
ff721d030e
commit
7721452493
1826 changed files with 124775 additions and 274114 deletions
3
odoo-bringout-oca-ocb-l10n_pt/l10n_pt/models/__init__.py
Normal file
3
odoo-bringout-oca-ocb-l10n_pt/l10n_pt/models/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from . import template_pt
|
||||
from . import account_account
|
||||
from . import account_tax
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountAccount(models.Model):
|
||||
_inherit = "account.account"
|
||||
|
||||
l10n_pt_taxonomy_code = fields.Integer(string="Taxonomy code")
|
||||
21
odoo-bringout-oca-ocb-l10n_pt/l10n_pt/models/account_tax.py
Normal file
21
odoo-bringout-oca-ocb-l10n_pt/l10n_pt/models/account_tax.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from odoo import api, models
|
||||
|
||||
|
||||
class AccountTax(models.Model):
|
||||
_inherit = 'account.tax'
|
||||
|
||||
@api.model
|
||||
def _round_tax_details_tax_amounts(self, base_lines, company, mode='mixed'):
|
||||
# EXTENDS 'account'
|
||||
country_code = company.account_fiscal_country_id.code
|
||||
if country_code == 'PT':
|
||||
mode = 'included'
|
||||
super()._round_tax_details_tax_amounts(base_lines, company, mode=mode)
|
||||
|
||||
@api.model
|
||||
def _round_tax_details_base_lines(self, base_lines, company, mode='mixed'):
|
||||
# EXTENDS 'account'
|
||||
country_code = company.account_fiscal_country_id.code
|
||||
if country_code == 'PT':
|
||||
mode = 'included'
|
||||
super()._round_tax_details_base_lines(base_lines, company, mode=mode)
|
||||
56
odoo-bringout-oca-ocb-l10n_pt/l10n_pt/models/template_pt.py
Normal file
56
odoo-bringout-oca-ocb-l10n_pt/l10n_pt/models/template_pt.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# 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('pt')
|
||||
def _get_pt_template_data(self):
|
||||
return {
|
||||
'property_account_receivable_id': 'chart_2111',
|
||||
'property_account_payable_id': 'chart_2211',
|
||||
}
|
||||
|
||||
@template('pt', 'res.company')
|
||||
def _get_pt_res_company(self):
|
||||
return {
|
||||
self.env.company.id: {
|
||||
'account_fiscal_country_id': 'base.pt',
|
||||
'bank_account_code_prefix': '12',
|
||||
'cash_account_code_prefix': '11',
|
||||
'transfer_account_code_prefix': '1431',
|
||||
'account_default_pos_receivable_account_id': 'chart_2117',
|
||||
'income_currency_exchange_account_id': 'chart_7861',
|
||||
'expense_currency_exchange_account_id': 'chart_6863',
|
||||
'tax_calculation_rounding_method': 'round_globally',
|
||||
'account_journal_early_pay_discount_loss_account_id': 'chart_682',
|
||||
'account_journal_early_pay_discount_gain_account_id': 'chart_728',
|
||||
'account_sale_tax_id': 'iva_pt_sale_normal',
|
||||
'account_purchase_tax_id': 'iva_pt_purchase_normal',
|
||||
'income_account_id': 'chart_711',
|
||||
'expense_account_id': 'chart_311',
|
||||
'account_stock_journal_id': 'inventory_valuation',
|
||||
'account_stock_valuation_id': 'chart_331',
|
||||
},
|
||||
}
|
||||
|
||||
@template(model='account.journal')
|
||||
def _get_account_journal(self, template_code):
|
||||
vals = super()._get_account_journal(template_code)
|
||||
if template_code == 'pt':
|
||||
if 'cash' in vals:
|
||||
vals['cash']['default_account_id'] = 'chart_11'
|
||||
if 'bank' in vals:
|
||||
vals['bank']['default_account_id'] = 'chart_12'
|
||||
return vals
|
||||
|
||||
@template('pt', 'account.account')
|
||||
def _get_pt_account_account(self):
|
||||
return {
|
||||
'chart_331': {
|
||||
'account_stock_expense_id': 'chart_612',
|
||||
'account_stock_variation_id': 'chart_6228',
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue