mirror of
https://github.com/bringout/oca-ocb-l10n_asia-pacific.git
synced 2026-04-27 12:02:01 +02:00
Initial commit: L10N_Asia Pacific packages
This commit is contained in:
commit
54c86b612c
828 changed files with 58224 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import base_document_layout
|
||||
from . import account_move
|
||||
from . import hr_timesheet
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
from odoo import models, fields, _
|
||||
from odoo.tools import format_date
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
l10n_din5008_template_data = fields.Binary(compute='_compute_l10n_din5008_template_data')
|
||||
l10n_din5008_document_title = fields.Char(compute='_compute_l10n_din5008_document_title')
|
||||
l10n_din5008_addresses = fields.Binary(compute='_compute_l10n_din5008_addresses', exportable=False)
|
||||
|
||||
def _compute_l10n_din5008_template_data(self):
|
||||
for record in self:
|
||||
record.l10n_din5008_template_data = data = []
|
||||
if record.name:
|
||||
data.append((_("Invoice No."), record.name))
|
||||
if record.invoice_date:
|
||||
data.append((_("Invoice Date"), format_date(self.env, record.invoice_date)))
|
||||
if record.invoice_date_due:
|
||||
data.append((_("Due Date"), format_date(self.env, record.invoice_date_due)))
|
||||
if record.invoice_origin:
|
||||
data.append((_("Source"), record.invoice_origin))
|
||||
if record.ref:
|
||||
data.append((_("Reference"), record.ref))
|
||||
|
||||
def _compute_l10n_din5008_document_title(self):
|
||||
for record in self:
|
||||
record.l10n_din5008_document_title = ''
|
||||
if record.move_type == 'out_invoice':
|
||||
if record.state == 'posted':
|
||||
record.l10n_din5008_document_title = _('Invoice')
|
||||
elif record.state == 'draft':
|
||||
record.l10n_din5008_document_title = _('Draft Invoice')
|
||||
elif record.state == 'cancel':
|
||||
record.l10n_din5008_document_title = _('Cancelled Invoice')
|
||||
elif record.move_type == 'out_refund':
|
||||
record.l10n_din5008_document_title = _('Credit Note')
|
||||
elif record.move_type == 'in_refund':
|
||||
record.l10n_din5008_document_title = _('Vendor Credit Note')
|
||||
elif record.move_type == 'in_invoice':
|
||||
record.l10n_din5008_document_title = _('Vendor Bill')
|
||||
|
||||
def _compute_l10n_din5008_addresses(self):
|
||||
for record in self:
|
||||
record.l10n_din5008_addresses = data = []
|
||||
if record.partner_shipping_id == record.partner_id:
|
||||
data.append((_("Invoicing and Shipping Address:"), record.partner_shipping_id))
|
||||
elif record.move_type in ("in_invoice", "in_refund") or not record.partner_shipping_id:
|
||||
data.append((_("Invoicing and Shipping Address:"), record.partner_id))
|
||||
else:
|
||||
data.append((_("Shipping Address:"), record.partner_shipping_id))
|
||||
data.append((_("Invoicing Address:"), record.partner_id))
|
||||
|
||||
def check_field_access_rights(self, operation, field_names):
|
||||
field_names = super().check_field_access_rights(operation, field_names)
|
||||
return [field_name for field_name in field_names if field_name not in {
|
||||
'l10n_din5008_addresses',
|
||||
}]
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
from odoo import models, fields, _
|
||||
from odoo.tools import format_date
|
||||
|
||||
|
||||
class BaseDocumentLayout(models.TransientModel):
|
||||
_inherit = 'base.document.layout'
|
||||
|
||||
street = fields.Char(related='company_id.street', readonly=True)
|
||||
street2 = fields.Char(related='company_id.street2', readonly=True)
|
||||
zip = fields.Char(related='company_id.zip', readonly=True)
|
||||
city = fields.Char(related='company_id.city', readonly=True)
|
||||
company_registry = fields.Char(related='company_id.company_registry', readonly=True)
|
||||
bank_ids = fields.One2many(related='company_id.partner_id.bank_ids', readonly=True)
|
||||
account_fiscal_country_id = fields.Many2one(related='company_id.account_fiscal_country_id', readonly=True)
|
||||
l10n_din5008_template_data = fields.Binary(compute='_compute_l10n_din5008_template_data')
|
||||
l10n_din5008_document_title = fields.Char(compute='_compute_l10n_din5008_document_title')
|
||||
|
||||
def _compute_l10n_din5008_template_data(self):
|
||||
self.l10n_din5008_template_data = [
|
||||
(_("Invoice No."), 'INV/2021/12345'),
|
||||
(_("Invoice Date"), format_date(self.env, fields.Date.today())),
|
||||
(_("Due Date"), format_date(self.env, fields.Date.add(fields.Date.today(), days=7))),
|
||||
(_("Reference"), 'SO/2021/45678'),
|
||||
]
|
||||
|
||||
def _compute_l10n_din5008_document_title(self):
|
||||
self.l10n_din5008_document_title = _('Invoice')
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
from odoo import models, fields
|
||||
|
||||
class AccountAnalyticLine(models.Model):
|
||||
_inherit = 'account.analytic.line'
|
||||
|
||||
l10n_din5008_template_data = fields.Binary(compute='_compute_l10n_din5008_template_data')
|
||||
l10n_din5008_document_title = fields.Char(compute='_compute_l10n_din5008_document_title')
|
||||
|
||||
def _compute_l10n_din5008_template_data(self):
|
||||
for record in self:
|
||||
record.l10n_din5008_template_data = []
|
||||
|
||||
def _compute_l10n_din5008_document_title(self):
|
||||
for record in self:
|
||||
record.l10n_din5008_document_title = ''
|
||||
Loading…
Add table
Add a link
Reference in a new issue