Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
5f9682c3
Commit
5f9682c3
authored
10 years ago
by
Fekete Mihai
Committed by
Denis Ledoux
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] l10n_ro: backport of fix done in res_partner.py from
aa768850
PR #720
parent
875d7ed3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
addons/l10n_ro/res_partner.py
+4
-15
4 additions, 15 deletions
addons/l10n_ro/res_partner.py
with
4 additions
and
15 deletions
addons/l10n_ro/res_partner.py
+
4
−
15
View file @
5f9682c3
...
...
@@ -28,26 +28,15 @@ class res_partner(osv.osv):
'
nrc
'
:
fields
.
char
(
'
NRC
'
,
size
=
16
,
help
=
'
Registration number at the Registry of Commerce
'
),
}
# The SQL constraints are no-ops but present only to display the right error message to the
# user when the partial unique indexes defined below raise errors/
# The real constraints need to be implemented with PARTIAL UNIQUE INDEXES (see auto_init),
# due to the way accounting data is delegated by contacts to their companies in OpenERP 7.0.
_sql_constraints
=
[
(
'
vat_uniq
'
,
'
unique (id)
'
,
'
The vat of the partner must be unique !
'
),
(
'
nrc_uniq
'
,
'
unique (id)
'
,
'
The code of the partner must be unique !
'
)
]
def
_auto_init
(
self
,
cr
,
context
=
None
):
result
=
super
(
res_partner
,
self
).
_auto_init
(
cr
,
context
=
context
)
# Re
al implementation of the vat/nrc constraints:
on
ly
"commercial entities"
need to have
#
unique
numbers
,
a
nd the condition for being a commercial entity is "is_company or parent_id IS NULL".
#
Contacts inside a company automatically have a copy of the company's commercial fields
#
(see _commercial_fields()), so they are automatical
ly
c
on
sistent
.
# Re
move constrains for vat, nrc
on "commercial entities"
because is not mandatory by legislation
#
Even that VAT
numbers a
re 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, on
ly on
line on their website
.
cr
.
execute
(
"""
DROP INDEX IF EXISTS res_partner_vat_uniq_for_companies;
DROP INDEX IF EXISTS res_partner_nrc_uniq_for_companies;
CREATE UNIQUE INDEX res_partner_vat_uniq_for_companies ON res_partner (vat) WHERE is_company OR parent_id IS NULL;
CREATE UNIQUE INDEX res_partner_nrc_uniq_for_companies ON res_partner (nrc) WHERE is_company OR parent_id IS NULL;
"""
)
return
result
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment