mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-27 15:02:00 +02:00
Initial commit: L10N_Europe packages
This commit is contained in:
commit
9803722600
2377 changed files with 380711 additions and 0 deletions
7
odoo-bringout-oca-ocb-l10n_no/l10n_no/models/__init__.py
Normal file
7
odoo-bringout-oca-ocb-l10n_no/l10n_no/models/__init__.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import account_journal
|
||||
from . import account_move
|
||||
from . import res_partner
|
||||
from . import res_company
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountJournal(models.Model):
|
||||
_inherit = 'account.journal'
|
||||
|
||||
invoice_reference_model = fields.Selection(selection_add=[
|
||||
('no', 'Norway')
|
||||
], ondelete={'no': lambda recs: recs.write({'invoice_reference_model': 'odoo'})})
|
||||
29
odoo-bringout-oca-ocb-l10n_no/l10n_no/models/account_move.py
Normal file
29
odoo-bringout-oca-ocb-l10n_no/l10n_no/models/account_move.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
from stdnum import luhn
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
def _get_invoice_reference_no_invoice(self):
|
||||
""" This computes the reference based on the Odoo format.
|
||||
We calculat reference using invoice number and
|
||||
partner id and added control digit at last.
|
||||
"""
|
||||
return self._get_kid_number()
|
||||
|
||||
def _get_invoice_reference_no_partner(self):
|
||||
""" This computes the reference based on the Odoo format.
|
||||
We calculat reference using invoice number and
|
||||
partner id and added control digit at last.
|
||||
"""
|
||||
return self._get_kid_number()
|
||||
|
||||
def _get_kid_number(self):
|
||||
self.ensure_one()
|
||||
invoice_name = ''.join([i for i in self.name if i.isdigit()]).zfill(7)
|
||||
ref = (str(self.partner_id.id).zfill(7)[-7:] + invoice_name[-7:])
|
||||
return ref + luhn.calc_check_digit(ref)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# coding: utf-8
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
l10n_no_bronnoysund_number = fields.Char(related='partner_id.l10n_no_bronnoysund_number', readonly=False)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# coding: utf-8
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
l10n_no_bronnoysund_number = fields.Char(string='Register of Legal Entities (Brønnøysund Register Center)', size=9)
|
||||
Loading…
Add table
Add a link
Reference in a new issue