SlideShare a Scribd company logo
1 of 39
Download to read offline
What is wrong with
contacts management in
OpenERP v7?
(as of April 2013, 4 months after the release, hopefully
we may have fixed it when you will read that later)
v 1.1
by Raphaël Valyi
reminder: conceptual change
in v7
now res.partner and res.partner.address (contacts or
addresses) records all live in the res.partner table.
Only spec published about this was:
http://v6.openerp.com/node/1169/2012/06
Terms that we will use:
● company: what was a res.partner is 6.1 (customer or
supplier commercial entity),
● contacts: addresses or contacts of these commercial
entities.
reminder: conceptual change
in v7
The main idea of putting everything in the same table was:
● to make B2C easier
● simplify menus and view definitions
● be able to use both companies and contacts with the
same field/key when we can: ex to send a mail, select
the contact of an invoice etc...
Moving things in the same table was certainly good, the
problem is not the intent, but the execution that was only
half anticipated...
to simplify, we won't talk about physical persons for which
there is little problem in v7 and focus on the issues with
companies.
so what's the problem?
the mistake originated because OpenERP SA thought that
because things are now in the same table, then only a
contact field on business documents would be enough.
so several many2one fields that were previously pointing to
a company in 6.1 now accept a company OR a contact in
7.
For instance: partner_id on:
an exhaustive list is being made here https://docs.google.
com/spreadsheet/ccc?
key=0AlrjP6ETn3tJdC1CUEw2bGQ1RkhDR0lmS2dGT1E4eWc&usp=sharing
● invoice
● purchase order
● stock picking
● crm claim
● crm opportunity
● project task...
1) The problem of the contact
record information
But when you invoice a contact (on purpose or because
OpenERP does it for you as when you use the CRM), the
account module code will try to read fiscal position, partner
payment term, credit limit and other such fields all from the
contact.
This information is not expected to be maintained on every
contacts of a company of course!
This problem also happens when writing data.
This problem happens in many more modules/localizations
etc...
1) proposed solution by
OpenERP SA
automatically hard copy these data from the company to
its contacts records with an insane duplication method.
https://code.launchpad.net/~openerp-dev/openobject-server/7.0-fix-contact-company-handling/+merge/157577
PROBLEMS:
● data duplication is never a good thing
● even properties (like invoice account) are duplicated,
that means even DUPLICATING these property
records...
● this is totally incompatible with extensions like
base_contact where a single contact could belong to
SEVERAL companies
● OpenERP SA claims that it's expected you have to fill
pricelist and some other fields right on every contacts so
you have an idea what to expect "it's user fault"...
2) Reporting is dead
wanted to compare
● total invoiced by customer?
● total purchased by supplier?
● compare supplier product prices?
● do your "intrastat" reports to declare where you sold
your goods?
PROBLEMS:
All these reports that were doing group_by and join over
partner_id as a company will now do it on mere contacts
instead. Unless you add a second company key and
change all these reports definitions, you cannot have such
reports in V7.
2) proposed solution by
OpenERP SA
unf*ck just the invoice reporting by effectively adding a new
"commercial_entity_id" key pointing again to the the
companies, in a new module.
PROBLEMS:
● As for the other objects, dream on.
● modules needing such a key may add their own and
hack reports definitions/filters in overlapping
incompatible ways.
● hell we already had such a key before and it was called
partner_id!
3) the SQL cardinality
nightmare
everywhere we have some foreign key pointing to res.
partner, it may be wrong! Fear not...
3) a) domains nightmare
nightmare
search with ('partner_id', '=', some_id)
some_id may now be the contact on a company while the
code was expecting to find a company
3) a) domains nightmare
search with ('partner_id', '=', some_id)
for instance the code may create a new invoice if no invoice
is found for record with partner_id == some_id.
PROBLEMS:
● In fact an invoice may already exist for that company
but not with the same contact as some_id...
● To fix that, we would need a NEW KEY to the
company and then use a child_of operator.
● shocking: we already had that company key and it was
called partner_id
3) a) domains nightmare
PROBLEMS
● that forces us to change the code in all official and
community addons to change such domains and use
child_of instead
● and to use the parent company of the contact if some_id
is a contact.
● That also means slower code when the code had only
some_id without browsing the object, like in an
on_change function for instance.
3) b) one2many and
many2many nightmare
a code doing
for record in partner.related_records_ids:
do_something_critical(...)
PROBLEM:
well, now some records that would have been included in
the loop in 6.1 will unexpectedly be missing in 7 if
● their partner_id was set to a different contact of the
same company
● OR if they point to the company while the partner is a
contact of it.
3) b) one2many and
many2many nightmare
unf*cking that would imply getting partner parent
company (ideally using a field pointing to it) and
iterating over each of the records related to each of its
contacts and also the ones related to the company...
Not really making the code any simpler...
And it also means changing all the official and community
addons code.
shocking: as for a field pointing to the company of a
contact, we had it already, it was called partner_id.
3) c) many2one nightmare
suppose you deal with Return Material Authorization
(RMA) in OpenERP user interface.
You create a new return picking. You now want to relate
that picking to a possibly existing claim ticket of that
partner or else create a new one.
Typically, the ticket_id field will have a domain such as
('partner_id', '=', partner_id) in order to filter only the
possible tickets to relate.
3) c) many2one nightmare
PROBLEM:
a claim ticket may already exist for the company but not the
contact you selected in your picking in partner_id.
To fix it we would need a stored key to the company
and filter with a 'child_of'
shocking: we already had such a key called partner_id
OpenERP SA's answer to that is generally: the contact is the
right "granularity"! Oh is it? Tell me, for what granularity
was the module built before when partner_id was a
company?
3) d) unexpected: more
complex access rules
imagine a rule like:
sales users will see only the opportunities and orders of
their own portfolio?
PROBLEM:
Well now you will need to make sure that every time a new
contact of customer is created, it will be related to the right
salesman or else write much more complex rules.
That is, it's more complex to set up or else they will miss
documents unexpectedly
"we still need to make a few adjustments, but
hey, look how gorgeous is our revolutionary
model!"
CONCLUSION 1
1. ERP documents CANNOT make it without an
SQL key pointing to the company. Despite one can
usually infer the company from the contact, only the
contact isn't enough in practise.
2. to be able to filter with that key before saving a record, it
needs to be set with an on_change, that is solution
invades even view definitions.
3. it cannot be a fields.related because it would be set only
when document is saved and isn't compatible with the
case where a contact could belong to several companies.
CONCLUSION 2
1. They aren't telling you the truth when they deny
documents need a key to the company
2. They aren't telling you the truth if they finally admit
some documents like invoice may in fact need such key,
but may be not all kind of documents.
3. We already had that key: it was called
partner_id
4. During 8 years, hundreds of developers used partner_id
as a key to the company, this is exactly what hundreds of
modules are expecting.
CONCLUSION 4
1. It's not acceptable that we should live test in production
all modules designed for companies which now can
receive contacts randomly.
2. It's not acceptable we should change all the semantic of
partner_id everywhere when bugs will be discovered
and make it a pointer to a contact and then
progressively adding a new key again pointing to the
company again (that is swaping the semantic)
??!??!??
3. how many years will it take to fix all these hidden
functional bugs when it usually takes months to get a
trivial regression fix on the official branches even when
a patch is provided?
CONCLUSION 5
what kind of chaos will we have with hundreds of modules:
1. adding their own new keys to a company in overlapping
incompatible on_changes (incompatibles view
definitions)
2. missing the change and doing buggy things
3. rejecting the change and assuming partner_id is still a
company and that the contact is carried by another key
?
CONCLUSION 6
A SOLUTION EXISTS!
1. It consists in automatically adding a new field
contact_id to objects having a partner_id. Then
partner_id is also automatically hidden in forms and
only contact_id is shown.
2. User cannot see any visual difference with current v7
3. When contact_id is set, an on_change properly sets
partner_id to the right company or physical person id.
So partner_id is exactly what the code has always been
made for.
4. optionally or if user belongs to "advanced contact
group", the user may edit both contact_id and
partner_id fields so that he can pick a company that
isn't the usual company of the contact, when a contact
belongs to several companies.
CONCLUSION 7
BUT
over the last month, OpenERP SA repeatedly rejected that
idea, even after 130 messages from the most experienced
OpenERP integrators in the world ALL rejecting OpenERP
SA model and ALL agreeing on having two keys partner_id
and contact_id instead.
https://bugs.launchpad.net/openobject-
addons/+bug/1160365
Update: it's now around an insurrection of around 200
posts...
CONCLUSION 8
Yeah, I think they actually f*~k her!
But eventually we work out an unf*ck solution.
See these links:
● goo.gl/aYG3S
● https://docs.google.com/a/akretion.com.
br/document/d/1CvPz-BZnZ-
waQZoFpdIM6aNjjcbdLadGQqTZFL3lw7A/edit#heading
=h.19sozwzfx45i
● https://bugs.launchpad.net/openobject-
addons/+bug/1160365/comments/27
CONCLUSION 9
"Wait, after 130+ posts, we got the message, in fact we
might need a second field on an invoice":
'commercial_entity_id' well, this would give us:
* #sorrysap
invoice object contact company
v6.1 address_invoice_id partner_id
v7 partner_id commercial_entity_id
ô rage, ô desespoir...
I tell you, "we simplified everything!"
and oh, fear not! the same
code is going to make it!
our code, your code... Fear not, feel the
presence...
EPILOGUE
It took us ~130 posts to convince them the invoice needed
two fields, may be they also understand in a few years we
also need that second field to the company on:
● purchase orders
● picking
● analytic accounts
● CRM opportunities
● CRM claims
● project tasks
● purchase requisitions...
So we may enjoy the field inversion for lot's of business
objects and all official and third party code using them...
But hey, don't worry, we will make a script...
And who said our offshore forces cannot do in a few months,
what hundreds of experts did in 8 years...
"Raging Bull" - 1980
Robert de Niro
director: Martin Scorsese
http://www.youtube.com/watch?v=_fEIn_5OkoY

More Related Content

Similar to Open erp v7 contacts issue

Push Notification - Part 1 - Transcript.pdf
Push Notification - Part 1 - Transcript.pdfPush Notification - Part 1 - Transcript.pdf
Push Notification - Part 1 - Transcript.pdfShaiAlmog1
 
A Detailed Explanation On The Marking Criteria For Ielts Writing Task 1 ...
A Detailed Explanation On The Marking Criteria For Ielts Writing Task 1 ...A Detailed Explanation On The Marking Criteria For Ielts Writing Task 1 ...
A Detailed Explanation On The Marking Criteria For Ielts Writing Task 1 ...Shannon Olsen
 
Implementing_S1000D_Best_Business_Practices_Means_Understanding_Your
Implementing_S1000D_Best_Business_Practices_Means_Understanding_YourImplementing_S1000D_Best_Business_Practices_Means_Understanding_Your
Implementing_S1000D_Best_Business_Practices_Means_Understanding_YourMichael Cook
 
Open ERP Version 7 Functional & Technical Overview
Open ERP Version 7 Functional & Technical OverviewOpen ERP Version 7 Functional & Technical Overview
Open ERP Version 7 Functional & Technical OverviewPragmatic Techsoft
 
Unit 8 powerpoint complete
Unit 8 powerpoint completeUnit 8 powerpoint complete
Unit 8 powerpoint completedannypriceslides
 
Push Notification - Part 3 - Transcript.pdf
Push Notification - Part 3 - Transcript.pdfPush Notification - Part 3 - Transcript.pdf
Push Notification - Part 3 - Transcript.pdfShaiAlmog1
 
George McGeachie's Favourite PowerDesigner features
George McGeachie's Favourite PowerDesigner featuresGeorge McGeachie's Favourite PowerDesigner features
George McGeachie's Favourite PowerDesigner featuresGeorge McGeachie
 
Accenture fico interview-questions
Accenture fico interview-questionsAccenture fico interview-questions
Accenture fico interview-questionsprabhakar vanam
 
SAP FICO Interview Questions
SAP FICO Interview QuestionsSAP FICO Interview Questions
SAP FICO Interview QuestionsAjeesh Sudevan
 
Cell Phone–Based System Could Improve HIV/AIDS Drug Tracking
 Cell Phone–Based System Could Improve HIV/AIDS Drug Tracking Cell Phone–Based System Could Improve HIV/AIDS Drug Tracking
Cell Phone–Based System Could Improve HIV/AIDS Drug Trackingpleasure16
 
Accentute quest for freshers SAP
Accentute quest for freshers SAPAccentute quest for freshers SAP
Accentute quest for freshers SAPajaysir3
 
How Custom is your Org? CEER at Dreamforce 2019
How Custom is your Org?  CEER at Dreamforce 2019How Custom is your Org?  CEER at Dreamforce 2019
How Custom is your Org? CEER at Dreamforce 2019Steven Herod
 
Qalcwise designer application kp is - unit 120 v20160314
Qalcwise designer   application kp is - unit 120 v20160314Qalcwise designer   application kp is - unit 120 v20160314
Qalcwise designer application kp is - unit 120 v20160314qalcwise
 
Data Modeling 101: How to make Data model
Data Modeling 101: How to make Data modelData Modeling 101: How to make Data model
Data Modeling 101: How to make Data modelAbdul Ahad
 
54145899 sap-sd-int-tips
54145899 sap-sd-int-tips54145899 sap-sd-int-tips
54145899 sap-sd-int-tipsNitesh Mahajan
 
There are only 3 operations in a web app
There are only 3 operations in a web appThere are only 3 operations in a web app
There are only 3 operations in a web appSimon Smith
 
Applying the Serverless Mindset to Any Tech Stack
Applying the Serverless Mindset to Any Tech StackApplying the Serverless Mindset to Any Tech Stack
Applying the Serverless Mindset to Any Tech StackBen Kehoe
 

Similar to Open erp v7 contacts issue (20)

Push Notification - Part 1 - Transcript.pdf
Push Notification - Part 1 - Transcript.pdfPush Notification - Part 1 - Transcript.pdf
Push Notification - Part 1 - Transcript.pdf
 
A Detailed Explanation On The Marking Criteria For Ielts Writing Task 1 ...
A Detailed Explanation On The Marking Criteria For Ielts Writing Task 1 ...A Detailed Explanation On The Marking Criteria For Ielts Writing Task 1 ...
A Detailed Explanation On The Marking Criteria For Ielts Writing Task 1 ...
 
Implementing_S1000D_Best_Business_Practices_Means_Understanding_Your
Implementing_S1000D_Best_Business_Practices_Means_Understanding_YourImplementing_S1000D_Best_Business_Practices_Means_Understanding_Your
Implementing_S1000D_Best_Business_Practices_Means_Understanding_Your
 
Open ERP Version 7 Functional & Technical Overview
Open ERP Version 7 Functional & Technical OverviewOpen ERP Version 7 Functional & Technical Overview
Open ERP Version 7 Functional & Technical Overview
 
Unit 8 powerpoint complete
Unit 8 powerpoint completeUnit 8 powerpoint complete
Unit 8 powerpoint complete
 
Push Notification - Part 3 - Transcript.pdf
Push Notification - Part 3 - Transcript.pdfPush Notification - Part 3 - Transcript.pdf
Push Notification - Part 3 - Transcript.pdf
 
Fico
FicoFico
Fico
 
George McGeachie's Favourite PowerDesigner features
George McGeachie's Favourite PowerDesigner featuresGeorge McGeachie's Favourite PowerDesigner features
George McGeachie's Favourite PowerDesigner features
 
Accenture fico interview-questions
Accenture fico interview-questionsAccenture fico interview-questions
Accenture fico interview-questions
 
SAP FICO Interview Questions
SAP FICO Interview QuestionsSAP FICO Interview Questions
SAP FICO Interview Questions
 
Cell Phone–Based System Could Improve HIV/AIDS Drug Tracking
 Cell Phone–Based System Could Improve HIV/AIDS Drug Tracking Cell Phone–Based System Could Improve HIV/AIDS Drug Tracking
Cell Phone–Based System Could Improve HIV/AIDS Drug Tracking
 
Accentute quest for freshers SAP
Accentute quest for freshers SAPAccentute quest for freshers SAP
Accentute quest for freshers SAP
 
How Custom is your Org? CEER at Dreamforce 2019
How Custom is your Org?  CEER at Dreamforce 2019How Custom is your Org?  CEER at Dreamforce 2019
How Custom is your Org? CEER at Dreamforce 2019
 
Designing Modules in Python
Designing Modules in PythonDesigning Modules in Python
Designing Modules in Python
 
Thoughtful Software Design
Thoughtful Software DesignThoughtful Software Design
Thoughtful Software Design
 
Qalcwise designer application kp is - unit 120 v20160314
Qalcwise designer   application kp is - unit 120 v20160314Qalcwise designer   application kp is - unit 120 v20160314
Qalcwise designer application kp is - unit 120 v20160314
 
Data Modeling 101: How to make Data model
Data Modeling 101: How to make Data modelData Modeling 101: How to make Data model
Data Modeling 101: How to make Data model
 
54145899 sap-sd-int-tips
54145899 sap-sd-int-tips54145899 sap-sd-int-tips
54145899 sap-sd-int-tips
 
There are only 3 operations in a web app
There are only 3 operations in a web appThere are only 3 operations in a web app
There are only 3 operations in a web app
 
Applying the Serverless Mindset to Any Tech Stack
Applying the Serverless Mindset to Any Tech StackApplying the Serverless Mindset to Any Tech Stack
Applying the Serverless Mindset to Any Tech Stack
 

Recently uploaded

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 

Recently uploaded (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 

Open erp v7 contacts issue

  • 1. What is wrong with contacts management in OpenERP v7? (as of April 2013, 4 months after the release, hopefully we may have fixed it when you will read that later) v 1.1 by Raphaël Valyi
  • 2. reminder: conceptual change in v7 now res.partner and res.partner.address (contacts or addresses) records all live in the res.partner table. Only spec published about this was: http://v6.openerp.com/node/1169/2012/06 Terms that we will use: ● company: what was a res.partner is 6.1 (customer or supplier commercial entity), ● contacts: addresses or contacts of these commercial entities.
  • 3. reminder: conceptual change in v7 The main idea of putting everything in the same table was: ● to make B2C easier ● simplify menus and view definitions ● be able to use both companies and contacts with the same field/key when we can: ex to send a mail, select the contact of an invoice etc... Moving things in the same table was certainly good, the problem is not the intent, but the execution that was only half anticipated... to simplify, we won't talk about physical persons for which there is little problem in v7 and focus on the issues with companies.
  • 4. so what's the problem? the mistake originated because OpenERP SA thought that because things are now in the same table, then only a contact field on business documents would be enough. so several many2one fields that were previously pointing to a company in 6.1 now accept a company OR a contact in 7. For instance: partner_id on: an exhaustive list is being made here https://docs.google. com/spreadsheet/ccc? key=0AlrjP6ETn3tJdC1CUEw2bGQ1RkhDR0lmS2dGT1E4eWc&usp=sharing ● invoice ● purchase order ● stock picking ● crm claim ● crm opportunity ● project task...
  • 5.
  • 6. 1) The problem of the contact record information But when you invoice a contact (on purpose or because OpenERP does it for you as when you use the CRM), the account module code will try to read fiscal position, partner payment term, credit limit and other such fields all from the contact. This information is not expected to be maintained on every contacts of a company of course! This problem also happens when writing data. This problem happens in many more modules/localizations etc...
  • 7. 1) proposed solution by OpenERP SA automatically hard copy these data from the company to its contacts records with an insane duplication method. https://code.launchpad.net/~openerp-dev/openobject-server/7.0-fix-contact-company-handling/+merge/157577 PROBLEMS: ● data duplication is never a good thing ● even properties (like invoice account) are duplicated, that means even DUPLICATING these property records... ● this is totally incompatible with extensions like base_contact where a single contact could belong to SEVERAL companies ● OpenERP SA claims that it's expected you have to fill pricelist and some other fields right on every contacts so you have an idea what to expect "it's user fault"...
  • 8.
  • 9. 2) Reporting is dead wanted to compare ● total invoiced by customer? ● total purchased by supplier? ● compare supplier product prices? ● do your "intrastat" reports to declare where you sold your goods? PROBLEMS: All these reports that were doing group_by and join over partner_id as a company will now do it on mere contacts instead. Unless you add a second company key and change all these reports definitions, you cannot have such reports in V7.
  • 10. 2) proposed solution by OpenERP SA unf*ck just the invoice reporting by effectively adding a new "commercial_entity_id" key pointing again to the the companies, in a new module. PROBLEMS: ● As for the other objects, dream on. ● modules needing such a key may add their own and hack reports definitions/filters in overlapping incompatible ways. ● hell we already had such a key before and it was called partner_id!
  • 11.
  • 12.
  • 13. 3) the SQL cardinality nightmare everywhere we have some foreign key pointing to res. partner, it may be wrong! Fear not... 3) a) domains nightmare nightmare search with ('partner_id', '=', some_id) some_id may now be the contact on a company while the code was expecting to find a company
  • 14. 3) a) domains nightmare search with ('partner_id', '=', some_id) for instance the code may create a new invoice if no invoice is found for record with partner_id == some_id. PROBLEMS: ● In fact an invoice may already exist for that company but not with the same contact as some_id... ● To fix that, we would need a NEW KEY to the company and then use a child_of operator. ● shocking: we already had that company key and it was called partner_id
  • 15. 3) a) domains nightmare PROBLEMS ● that forces us to change the code in all official and community addons to change such domains and use child_of instead ● and to use the parent company of the contact if some_id is a contact. ● That also means slower code when the code had only some_id without browsing the object, like in an on_change function for instance.
  • 16.
  • 17. 3) b) one2many and many2many nightmare a code doing for record in partner.related_records_ids: do_something_critical(...) PROBLEM: well, now some records that would have been included in the loop in 6.1 will unexpectedly be missing in 7 if ● their partner_id was set to a different contact of the same company ● OR if they point to the company while the partner is a contact of it.
  • 18. 3) b) one2many and many2many nightmare unf*cking that would imply getting partner parent company (ideally using a field pointing to it) and iterating over each of the records related to each of its contacts and also the ones related to the company... Not really making the code any simpler... And it also means changing all the official and community addons code. shocking: as for a field pointing to the company of a contact, we had it already, it was called partner_id.
  • 19.
  • 20. 3) c) many2one nightmare suppose you deal with Return Material Authorization (RMA) in OpenERP user interface. You create a new return picking. You now want to relate that picking to a possibly existing claim ticket of that partner or else create a new one. Typically, the ticket_id field will have a domain such as ('partner_id', '=', partner_id) in order to filter only the possible tickets to relate.
  • 21. 3) c) many2one nightmare PROBLEM: a claim ticket may already exist for the company but not the contact you selected in your picking in partner_id. To fix it we would need a stored key to the company and filter with a 'child_of' shocking: we already had such a key called partner_id OpenERP SA's answer to that is generally: the contact is the right "granularity"! Oh is it? Tell me, for what granularity was the module built before when partner_id was a company?
  • 22. 3) d) unexpected: more complex access rules imagine a rule like: sales users will see only the opportunities and orders of their own portfolio? PROBLEM: Well now you will need to make sure that every time a new contact of customer is created, it will be related to the right salesman or else write much more complex rules. That is, it's more complex to set up or else they will miss documents unexpectedly
  • 23. "we still need to make a few adjustments, but hey, look how gorgeous is our revolutionary model!"
  • 24. CONCLUSION 1 1. ERP documents CANNOT make it without an SQL key pointing to the company. Despite one can usually infer the company from the contact, only the contact isn't enough in practise. 2. to be able to filter with that key before saving a record, it needs to be set with an on_change, that is solution invades even view definitions. 3. it cannot be a fields.related because it would be set only when document is saved and isn't compatible with the case where a contact could belong to several companies.
  • 25. CONCLUSION 2 1. They aren't telling you the truth when they deny documents need a key to the company 2. They aren't telling you the truth if they finally admit some documents like invoice may in fact need such key, but may be not all kind of documents. 3. We already had that key: it was called partner_id 4. During 8 years, hundreds of developers used partner_id as a key to the company, this is exactly what hundreds of modules are expecting.
  • 26. CONCLUSION 4 1. It's not acceptable that we should live test in production all modules designed for companies which now can receive contacts randomly. 2. It's not acceptable we should change all the semantic of partner_id everywhere when bugs will be discovered and make it a pointer to a contact and then progressively adding a new key again pointing to the company again (that is swaping the semantic) ??!??!?? 3. how many years will it take to fix all these hidden functional bugs when it usually takes months to get a trivial regression fix on the official branches even when a patch is provided?
  • 27. CONCLUSION 5 what kind of chaos will we have with hundreds of modules: 1. adding their own new keys to a company in overlapping incompatible on_changes (incompatibles view definitions) 2. missing the change and doing buggy things 3. rejecting the change and assuming partner_id is still a company and that the contact is carried by another key ?
  • 28. CONCLUSION 6 A SOLUTION EXISTS! 1. It consists in automatically adding a new field contact_id to objects having a partner_id. Then partner_id is also automatically hidden in forms and only contact_id is shown. 2. User cannot see any visual difference with current v7 3. When contact_id is set, an on_change properly sets partner_id to the right company or physical person id. So partner_id is exactly what the code has always been made for. 4. optionally or if user belongs to "advanced contact group", the user may edit both contact_id and partner_id fields so that he can pick a company that isn't the usual company of the contact, when a contact belongs to several companies.
  • 29. CONCLUSION 7 BUT over the last month, OpenERP SA repeatedly rejected that idea, even after 130 messages from the most experienced OpenERP integrators in the world ALL rejecting OpenERP SA model and ALL agreeing on having two keys partner_id and contact_id instead. https://bugs.launchpad.net/openobject- addons/+bug/1160365 Update: it's now around an insurrection of around 200 posts...
  • 30. CONCLUSION 8 Yeah, I think they actually f*~k her! But eventually we work out an unf*ck solution. See these links: ● goo.gl/aYG3S ● https://docs.google.com/a/akretion.com. br/document/d/1CvPz-BZnZ- waQZoFpdIM6aNjjcbdLadGQqTZFL3lw7A/edit#heading =h.19sozwzfx45i ● https://bugs.launchpad.net/openobject- addons/+bug/1160365/comments/27
  • 31. CONCLUSION 9 "Wait, after 130+ posts, we got the message, in fact we might need a second field on an invoice": 'commercial_entity_id' well, this would give us: * #sorrysap invoice object contact company v6.1 address_invoice_id partner_id v7 partner_id commercial_entity_id
  • 32. ô rage, ô desespoir...
  • 33.
  • 34. I tell you, "we simplified everything!"
  • 35. and oh, fear not! the same code is going to make it! our code, your code... Fear not, feel the presence...
  • 36. EPILOGUE It took us ~130 posts to convince them the invoice needed two fields, may be they also understand in a few years we also need that second field to the company on: ● purchase orders ● picking ● analytic accounts ● CRM opportunities ● CRM claims ● project tasks ● purchase requisitions... So we may enjoy the field inversion for lot's of business objects and all official and third party code using them...
  • 37. But hey, don't worry, we will make a script...
  • 38. And who said our offshore forces cannot do in a few months, what hundreds of experts did in 8 years...
  • 39. "Raging Bull" - 1980 Robert de Niro director: Martin Scorsese http://www.youtube.com/watch?v=_fEIn_5OkoY