Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base contact by function #20

Merged
merged 7 commits into from
Dec 19, 2014

Conversation

bwrsandman
Copy link
Contributor

  • [ADD] added base_contact_function module: It allow to manage contacts by function"
  • [ADD] Added base_contact_function_partner_firstname module: It allows to add firstname before name.Name is considered like the lastname and we have firstname and lastname on partner view and contact view."
    The base_contact_function_partner_firstname module depends on partner_firstname and base_contact_function module.

Previous reviews:

@StefanRijnhart

I have a hard time trying to find out what this module actually does. The manifest description is very terse. The name of the module reminds me of base_contact, which allowed multiple connections between the same person and a company. Is this module similar? The description should at least explain what 'institutions' are (a concept that this module introduces).

Terminology is off at times, it seems. l.130: 'acronym': is this abbreviation, or maybe stick to the standard 'code' field name and label?

Organism: I'm guessing you mean organization. But in any case, changing the 'company' terminology should be split off as a separate module.

The translations seem to contain obsolete terms, e.g. l.241 and other occurrences of 'passport'.

@bwrsandman

This is for cases where one partner (Mike Fletcher President of Agrolait) can be part of another company (Mike Fletcher VP of AsusTEK) in a different function.

The module helps track these functions.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.79%) when pulling ae90448 on savoirfairelinux:partner_contact_management into 664a53a on OCA:7.0.

from . import functions
from . import res_institutions

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vim line

@coveralls
Copy link

Coverage Status

Coverage increased (+2.79%) when pulling bd9314b on savoirfairelinux:partner_contact_management into 664a53a on OCA:7.0.

@nbessi
Copy link
Contributor

nbessi commented Aug 29, 2014

👍


class functions(orm.Model):
_description = 'Functions'
_name = 'functions'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned this may be a bit too generic and confusing (function fields...). Also the convention nowadays is to use a singular form for Model _name.

I suggest "res.partner.function" for _name.

@bwrsandman bwrsandman force-pushed the partner_contact_management branch 3 times, most recently from b1ed151 to 8ad1ae5 Compare September 2, 2014 15:04
@coveralls
Copy link

Coverage Status

Coverage increased (+2.79%) when pulling 8ad1ae5 on savoirfairelinux:partner_contact_management into 664a53a on OCA:7.0.

Sandy Carter and others added 2 commits October 31, 2014 18:37
Allow to manage contacts by function
Add firstname before name.
Name is considered like the lastname and we have firstname and lastname on
partner view and contact view.
@bwrsandman
Copy link
Contributor Author

@hbrunn addon's description provided by @giotta

@coveralls
Copy link

Coverage Status

Coverage increased (+3.07%) when pulling 8fbcb1f on savoirfairelinux:partner_contact_management into 74927c5 on OCA:7.0.

@bwrsandman
Copy link
Contributor Author

Inconsistent fail between Odoo and OCB

Sandy Carter and others added 2 commits November 24, 2014 16:54
Functions for contacts of companies should be created in the Functions
Tab. Functions created straight in the Contact form will not end up in the
Functions Tab.

Does not change behaviour on systems without web_m2x_options
name = name.split(' / ')[-1]
ids = self.search(cr, user, [('name', operator, name)] + args,
limit=limit, context=context)
if ids:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole section doesn't respect the limit parameter, that will yield too many results when there are a lot of subcategories

@coveralls
Copy link

Coverage Status

Coverage increased (+2.47%) when pulling 20d2472 on savoirfairelinux:partner_contact_management into 74927c5 on OCA:7.0.

cr, user, [('parent_id', 'child_of', ids)],
context=context)
if child_ids:
ids.extend(child_ids)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the childof operator also returns the id itself, so add them only if not included already

@hbrunn
Copy link
Member

hbrunn commented Dec 8, 2014

@bwrsandman the difference is caused by ocb using browse() in name_get and odoo using read(). The latter discards double ids and gives a random(?) order, the former delivers all ids in the order of the id list.

So to fix the test, we shouldn't pass double ids to name_get as pointed out in my comment above, and we should only check for set equality (= no order)

@bwrsandman
Copy link
Contributor Author

@hbrunn I have fixed the limits and the duplicates problem.

I don't understand this issue with id order, though. In this implementation, I used set to remove duplicates, this, however is unordered. Is this good?

@hbrunn
Copy link
Member

hbrunn commented Dec 17, 2014

I personally think that every name_get should return its list sorted alphabetically, but not all name_gets do that.

As for the issue at hand: The test fails because it checks for list equality (https://github.com/OCA/partner-contact/pull/20/files#diff-482719082e50caa32544883db16a8259R156) and there, order matters. Given that I don't think we care about the lists' orders, I think you'd better use assertItemsEqual: https://docs.python.org/2/library/unittest.html#unittest.TestCase.assertItemsEqual

@bwrsandman
Copy link
Contributor Author

Thanks @hbrunn.

As for the order, I thought odoo relied on the defined _order.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.51%) when pulling bff4fbe on savoirfairelinux:partner_contact_management into 74927c5 on OCA:7.0.

@bwrsandman
Copy link
Contributor Author

The Travis CI build passed

🙌

@hbrunn
Copy link
Member

hbrunn commented Dec 17, 2014

yay! Concerning _order: search() uses it, and browse() returns records in the order it got in the id list, but read() returns the records as they come from the database.

Anyway: 👍

@nbessi
Copy link
Contributor

nbessi commented Dec 19, 2014

👍

nbessi added a commit that referenced this pull request Dec 19, 2014
@nbessi nbessi merged commit a120d6e into OCA:7.0 Dec 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants