mirror of
https://github.com/bringout/oca-ocb-l10n_asia-pacific.git
synced 2026-04-26 14:42:02 +02:00
Initial commit: L10N_Asia Pacific packages
This commit is contained in:
commit
54c86b612c
828 changed files with 58224 additions and 0 deletions
5
odoo-bringout-oca-ocb-l10n_th/l10n_th/models/__init__.py
Normal file
5
odoo-bringout-oca-ocb-l10n_th/l10n_th/models/__init__.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import res_partner
|
||||
from . import account_move
|
||||
from . import ir_actions_report
|
||||
10
odoo-bringout-oca-ocb-l10n_th/l10n_th/models/account_move.py
Normal file
10
odoo-bringout-oca-ocb-l10n_th/l10n_th/models/account_move.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from odoo import models
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
def _get_name_invoice_report(self):
|
||||
self.ensure_one()
|
||||
if self.company_id.account_fiscal_country_id.code == 'TH':
|
||||
return 'l10n_th.report_invoice_document'
|
||||
return super()._get_name_invoice_report()
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class IrActionsReport(models.Model):
|
||||
_inherit = 'ir.actions.report'
|
||||
|
||||
def _render_qweb_pdf(self, report_ref, res_ids=None, data=None):
|
||||
# Check for reports only available for invoices.
|
||||
if self._get_report(report_ref).report_name == 'l10n_th.report_commercial_invoice':
|
||||
invoices = self.env['account.move'].browse(res_ids)
|
||||
if any(not x.is_invoice(include_receipts=True) for x in invoices):
|
||||
raise UserError(_("Only invoices could be printed."))
|
||||
|
||||
return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)
|
||||
16
odoo-bringout-oca-ocb-l10n_th/l10n_th/models/res_partner.py
Normal file
16
odoo-bringout-oca-ocb-l10n_th/l10n_th/models/res_partner.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models, fields
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = "res.partner"
|
||||
|
||||
l10n_th_branch_name = fields.Char(compute="_l10n_th_get_branch_name")
|
||||
|
||||
def _l10n_th_get_branch_name(self):
|
||||
for partner in self:
|
||||
if not partner.is_company or partner.country_code != 'TH':
|
||||
partner.l10n_th_branch_name = ""
|
||||
else:
|
||||
code = partner.company_registry
|
||||
partner.l10n_th_branch_name = f"Branch {code}" if code else "Headquarter"
|
||||
Loading…
Add table
Add a link
Reference in a new issue