19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:21 +01:00
parent 7dc55599c6
commit 7f43bbbfcc
650 changed files with 45260 additions and 33436 deletions

View file

@ -1,4 +1,8 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import template_au
from . import account_move
from . import chart_template
from . import res_partner_bank
from . import account_payment
from . import res_partner
from . import res_company

View file

@ -6,6 +6,26 @@ class AccountMove(models.Model):
_inherit = 'account.move'
def _get_name_invoice_report(self):
if self.company_id.account_fiscal_country_id.code == 'AU':
if self.company_id.account_fiscal_country_id.code == 'AU' and self.company_id.l10n_au_is_gst_registered:
return 'l10n_au.report_invoice_document'
return super()._get_name_invoice_report()
def _get_automatic_balancing_account(self):
""" Override to manage the DGST use case.
We want the automatic line to balance the DGST account to itself, as we only want the tax lines to have a real
impact.
"""
# OVERRIDE account
self.ensure_one()
# We only consider moves comprised of a single DGST line. (one invoice line, one tax)
has_single_line = len(self.invoice_line_ids) == 1 and len(self.invoice_line_ids.tax_ids) == 1
if has_single_line and self.move_type == 'entry':
# We identify that it is DGST based on a tag on the account.
# This is the simplest solution to keep it configurable while avoiding a new setting for a niche feature.
# At worse, they don't get the correct account assigned automatically and need manual adjustment.
with_dgst_account = self.invoice_line_ids.account_id.tag_ids == self.env.ref("l10n_au.account_tag_dgst")
if with_dgst_account:
# In this case, we want the balancing line to balance IN THE SAME ACCOUNT.
return self.invoice_line_ids.account_id.id
return super()._get_automatic_balancing_account()

View file

@ -0,0 +1,13 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, api, _
class AccountPayment(models.Model):
_inherit = 'account.payment'
@api.depends('country_code', 'partner_type')
def _compute_payment_receipt_title(self):
# OVERRIDE
super()._compute_payment_receipt_title()
for payment in self.filtered(lambda p: p.country_code == 'AU' and p.partner_type == 'supplier'):
payment.payment_receipt_title = _('Remittance Advice')

View file

@ -1,19 +0,0 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields
class AccountChartTemplate(models.Model):
_inherit = 'account.chart.template'
def _load(self, company):
res = super()._load(company)
if self == self.env.ref("l10n_au.l10n_au_chart_template"):
company.write({
'fiscalyear_last_month': '6',
'fiscalyear_last_day': 30,
# Changing the opening date to the first day of the fiscal year.
# This way the opening entries will be set to the 30th of June.
'account_opening_date': fields.Date.context_today(self).replace(month=7, day=1),
})
return res

View file

@ -0,0 +1,8 @@
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
l10n_au_is_gst_registered = fields.Boolean(string="Australia GST registered", help="Enable if your company is registered for GST.")
l10n_au_trading_name = fields.Char(string="Trading Name", help="The trading name of the company.")

View file

@ -0,0 +1,10 @@
from odoo import models, _
class ResPartner(models.Model):
_inherit = 'res.partner'
def _get_company_registry_labels(self):
labels = super()._get_company_registry_labels()
labels['AU'] = _("ACN")
return labels

View file

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class ResPartnerBank(models.Model):
_inherit = "res.partner.bank"
aba_bsb = fields.Char(string='BSB', help='Bank State Branch code - needed if payment is to be made using ABA files')
@api.model
def _get_supported_account_types(self):
rslt = super(ResPartnerBank, self)._get_supported_account_types()
rslt.append(('aba', _('ABA')))
return rslt
@api.constrains('aba_bsb')
def _validate_aba_bsb(self):
for record in self:
if record.aba_bsb:
test_bsb = re.sub('( |-)', '', record.aba_bsb)
if len(test_bsb) != 6 or not test_bsb.isdigit():
raise ValidationError(_('BSB is not valid (expected format is "NNN-NNN"). Please rectify.'))
@api.depends('acc_number')
def _compute_acc_type(self):
""" Criteria to be an ABA account:
- Spaces, hypens, digits are valid.
- Total length must be 9 or less.
- Cannot be only spaces, zeros or hyphens (must have at least one digit in range 1-9)
"""
super()._compute_acc_type()
for rec in self:
if rec.acc_type == 'bank' and re.match(r"^(?=.*[1-9])[ \-\d]{0,9}$", rec.acc_number or ''):
rec.acc_type = 'aba'

View file

@ -0,0 +1,50 @@
# 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('au')
def _get_au_template_data(self):
return {
'code_digits': '5',
'property_account_receivable_id': 'au_11200',
'property_stock_account_production_cost_id': 'au_11350',
'property_account_payable_id': 'au_21200',
'property_stock_valuation_account_id': 'au_11330',
}
@template('au', 'res.company')
def _get_au_res_company(self):
return {
self.env.company.id: {
'anglo_saxon_accounting': True,
'account_fiscal_country_id': 'base.au',
'bank_account_code_prefix': '1111',
'cash_account_code_prefix': '1113',
'transfer_account_code_prefix': '11170',
'account_default_pos_receivable_account_id': 'au_11201',
'income_currency_exchange_account_id': 'au_61640',
'expense_currency_exchange_account_id': 'au_61630',
'account_journal_early_pay_discount_loss_account_id': 'au_61610',
'account_journal_early_pay_discount_gain_account_id': 'au_61620',
'fiscalyear_last_month': '6',
'fiscalyear_last_day': 30,
'account_sale_tax_id': 'au_tax_sale_10',
'account_purchase_tax_id': 'au_tax_purchase_10_service',
'income_account_id': 'au_41110',
'expense_account_id': 'au_51110',
'account_stock_journal_id': 'inventory_valuation',
'account_stock_valuation_id': 'au_11310',
},
}
@template('au', 'account.account')
def _get_au_account_account(self):
return {
'au_11310': {
'account_stock_variation_id': 'au_51110',
},
}