mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-27 19:42:00 +02:00
Initial commit: L10N_Europe packages
This commit is contained in:
commit
9803722600
2377 changed files with 380711 additions and 0 deletions
22
odoo-bringout-oca-ocb-l10n_se/l10n_se/models/res_company.py
Normal file
22
odoo-bringout-oca-ocb-l10n_se/l10n_se/models/res_company.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
import re
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
org_number = fields.Char(compute='_compute_org_number')
|
||||
|
||||
@api.depends('vat')
|
||||
def _compute_org_number(self):
|
||||
for company in self:
|
||||
if company.account_fiscal_country_id.code == "SE" and company.vat:
|
||||
org_number = re.sub(r'\D', '', company.vat)[:-2]
|
||||
org_number = org_number[:6] + '-' + org_number[6:]
|
||||
|
||||
company.org_number = org_number
|
||||
else:
|
||||
company.org_number = ''
|
||||
Loading…
Add table
Add a link
Reference in a new issue