mirror of
https://github.com/bringout/oca-ocb-l10n_asia-pacific.git
synced 2026-04-26 23:22:03 +02:00
Initial commit: L10N_Asia Pacific packages
This commit is contained in:
commit
54c86b612c
828 changed files with 58224 additions and 0 deletions
7
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/__init__.py
Normal file
7
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/__init__.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import res_partner
|
||||
from . import account_move
|
||||
from . import account_payment
|
||||
from . import account_tax
|
||||
from . import account_tax_template
|
||||
19
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/account_move.py
Normal file
19
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/account_move.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
def action_open_l10n_ph_2307_wizard(self):
|
||||
vendor_bills = self.filtered_domain([('move_type', '=', 'in_invoice')])
|
||||
if vendor_bills:
|
||||
wizard_action = self.env["ir.actions.act_window"]._for_xml_id("l10n_ph.view_l10n_ph_2307_wizard_act_window")
|
||||
wizard_action.update({
|
||||
'context': {'default_moves_to_export': vendor_bills.ids}
|
||||
})
|
||||
return wizard_action
|
||||
else:
|
||||
raise UserError(_('Only Vendor Bills are available.'))
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
_inherit = "account.payment"
|
||||
|
||||
def action_open_l10n_ph_2307_wizard(self):
|
||||
self.ensure_one()
|
||||
if self.payment_type == 'outbound':
|
||||
wizard_action = self.env["ir.actions.act_window"]._for_xml_id("l10n_ph.view_l10n_ph_2307_wizard_act_window")
|
||||
wizard_action.update({
|
||||
'context': {'default_moves_to_export': self.reconciled_bill_ids.ids}
|
||||
})
|
||||
return wizard_action
|
||||
else:
|
||||
raise UserError(_('Only Outbound Payment is available.'))
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountTax(models.Model):
|
||||
_inherit = "account.tax"
|
||||
|
||||
l10n_ph_atc = fields.Char("Philippines ATC")
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountTaxTemplate(models.Model):
|
||||
_inherit = "account.tax.template"
|
||||
|
||||
l10n_ph_atc = fields.Char("Philippines ATC")
|
||||
|
||||
def _get_tax_vals(self, company, tax_template_to_tax):
|
||||
val = super()._get_tax_vals(company, tax_template_to_tax)
|
||||
val.update({"l10n_ph_atc": self.l10n_ph_atc})
|
||||
return val
|
||||
25
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/res_partner.py
Normal file
25
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/res_partner.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, api, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = "res.partner"
|
||||
|
||||
branch_code = fields.Char("Branch Code", default='000', compute='_compute_branch_code', store=True)
|
||||
first_name = fields.Char("First Name")
|
||||
middle_name = fields.Char("Middle Name")
|
||||
last_name = fields.Char("Last Name")
|
||||
|
||||
@api.model
|
||||
def _commercial_fields(self):
|
||||
return super()._commercial_fields() + ['branch_code']
|
||||
|
||||
@api.depends('vat', 'country_id')
|
||||
def _compute_branch_code(self):
|
||||
for partner in self:
|
||||
branch_code = '000'
|
||||
if partner.country_id.code == 'PH' and partner.vat:
|
||||
match = partner.__check_vat_ph_re.match(partner.vat)
|
||||
branch_code = match and match.group(1) and match.group(1)[1:] or branch_code
|
||||
partner.branch_code = branch_code
|
||||
Loading…
Add table
Add a link
Reference in a new issue