flectra/addons/l10n_ro/models/res_partner.py

34 lines
1.4 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2018-01-16 11:34:37 +01:00
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
# @author - Fekete Mihai <feketemihai@gmail.com>
# Copyright (C) 2015 Forest and Biomass Services Romania (http://www.forbiom.eu).
# Copyright (C) 2011 TOTAL PC SYSTEMS (http://www.erpsystems.ro).
# Copyright (C) 2009 (<http://www.filsystem.ro>)
2018-01-16 11:34:37 +01:00
from flectra import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
@api.model
def _auto_init(self):
res = super(ResPartner, self)._auto_init()
# Remove constrains for vat, nrc on "commercial entities" because is not mandatory by legislation
# Even that VAT numbers are unique, the NRC field is not unique, and there are certain entities that
# doesn't have a NRC number plus the formatting was changed few times, so we cannot have a base rule for
# checking if available and emmited by the Ministry of Finance, only online on their website.
self.env.cr.execute("""
DROP INDEX IF EXISTS res_partner_vat_uniq_for_companies;
DROP INDEX IF EXISTS res_partner_nrc_uniq_for_companies;
""")
return res
@api.model
def _commercial_fields(self):
return super(ResPartner, self)._commercial_fields() + ['nrc']
nrc = fields.Char(string='NRC', help='Registration number at the Registry of Commerce')