← Back to team overview

openerp-community team mailing list archive

Re: Novice question; Add field to 6.1 Employee form?

 

Wow Ray;

I you are right on target about my skill level and your answer is scholarly
and looks like what I need; THANK YOU! And your README.pdf is charmed!

After my preliminary review I wonder about the add-ons directories you
mention in "Step One: Download, unzip and copy the module folder and files
to one of the add-ons directories." My Ubuntu installation has two
different locations for OpenERP
add-ons: /usr/lib/pymodules/python2.7/openerp/addons/ (which has symlinks
to the real files) and /usr/share/pyshared/openerp/addons/ (which contains
the real files.) Should I put my module with the real files in /usr/share
then create symlinks to the real files at /usr/lib? If this is right; would
you suggest a convenient way to create the symlinks for my new module?

I really appreciate your time,
DaleEMoore@xxxxxxxxx


On Wed, Dec 19, 2012 at 6:19 PM, Ray Carnes <rcarnes@xxxxxxxxxxxxxxxxxxx>wrote:

> 1) You should not change core python modules, you should create your own
> models that inherit OpenERP’s models
>
> 2) You should not change core XML files, you should create your own views
> that inherit OpenERP’s views
>
> 3) You should never create database fields in pgadmin – all fields are
> created by OpenERP
>
>
>
> If you are ‘learning’ you can break rules 1 and 2 for a while.  You can
> NEVER break rule 3) – you are bypassing ORM
>
>
>
> 4) When you change python code, you need to restart the server for it to
> see it.  You also need to update the module to have it add fields to the
> database.
>
> 5) When you change XML, you need to update the module to have OpenERP
> bring the XML into the database.
>
>
>
> I know you say you did this but I can tell from your skill level you may
> not have done what you think you did!
>
>
>
> Since you didn’t make the changes the right way you should start the
> entire process again the right way before trying to troubleshoot.
>
>
>
> You need to read the documentation and research some examples of modules
> written by others that use best practices.
>
>
>
> To add fields to a model and to a view, you can follow my example at
> https://launchpad.net/openerp-add-user-sales-order
>
>
> Ray.
>
>
>
> *From:* openerp-community-bounces+rcarnes=
> ursainfosystems.com@xxxxxxxxxxxxxxxxxxx [mailto:
> openerp-community-bounces+rcarnes=ursainfosystems.com@xxxxxxxxxxxxxxxxxxx]
> *On Behalf Of *Dale E. Moore
> *Sent:* Wednesday, December 19, 2012 4:10 PM
> *To:* openerp-community@xxxxxxxxxxxxxxxxxxx
> *Subject:* [Openerp-community] Novice question; Add field to 6.1 Employee
> form?
>
>
>
> Please pardon my novice question!
>
>
>
> I hope to add some fields to the Miscellaneous tab of the Employee form.
> I've gotten the fields into the DB and Developper mode, view fields says
> the fields are there, but; they don't appear.
>
>
>
> In /usr/share/pyshared/openerp/addons/hr_contract/hr_contract.py after
>
>
>
>         'contract_id':fields.function(_get_latest_contract,
> string='Contract', type='many2one', relation="hr.contract", help='Latest
> contract of the employee'),
>
>
>
> I added
>
>
>
>         'drivers_license': fields.char('Drivers License', size=30),
>
>         'drivers_license_expires': fields.date('Drivers License Expires
> Date'),
>
>         'auto_insurance': fields.char('Auto Insurance Policy', size=30),
>
>         'auto_insurance_expires': fields.date('Auto Insurance Expires
> Date'),
>
>
>
> I used pgadmin to add the fields to hr_employee. In
> /usr/share/pyshared/openerp/addons/hr_contract/hr_contract_view.xml after
>
>
>
>                         <field name="children"/>
>
>
>
> I added
>
>
>
>                         <field name="drivers_license"/>
>
>                         <field name="drivers_license_expires"/>
>
>                         <field name="auto_insurance"/>
>
>                         <field name="auto_insurance_expires"/>
>
>
>
> Then I Updated Modules. But Human Resources, Employees, pick an employee,
> Miscellaneous tab does not have the 4 new fields.
>
>
>
> Thanks for any help you can provide,
>
> DaleEMoore@xxxxxxxxx
>

Follow ups

References