}
res_partner_address()
-class res_partner_job(osv.osv):
+class res_partner_location(osv.osv):
+ _name = 'res.partner.location'
+ _inherit = 'res.partner.address'
+ _table = 'res_partner_address'
+
+res_partner_location()
+
+class res_partner_address(osv.osv):
+ _name = 'res.partner.address'
+ _inherits = { 'res.partner.location' : 'address_id' }
+ _table = 'res_partner_job'
+
+ _columns = {
+ 'address_id' : fields.many2one('res.partner.location', 'Location'),
+ 'contact_id' : fields.many2one('res.partner.contact', 'Contact'),
+ 'function': fields.char('Partner Function', size=64, help="Function of this contact with this partner"),
+ 'date_start': fields.date('Date Start',help="Start date of job(Joining Date)"),
+ 'date_stop': fields.date('Date Stop', help="Last date of job"),
+ 'state': fields.selection([('past', 'Past'),('current', 'Current')], \
+ 'State', required=True, help="Status of Address"),
+ }
+
+ _description ='Contact Partner Function'
+
+ _defaults = {
+ 'state': 'current',
+ }
+
def name_get(self, cr, uid, ids, context=None):
"""
@param self: The object pointer
jobs = self.browse(cr, uid, ids, context=context)
- contact_ids = [rec.contact_id.id for rec in jobs]
+ contact_ids = [rec.contact_id.id for rec in jobs if rec.contact_id]
contact_names = dict(self.pool.get('res.partner.contact').name_get(cr, uid, contact_ids, context=context))
for r in jobs:
return res
- _name = 'res.partner.job'
- _description ='Contact Partner Function'
- _order = 'sequence_contact'
-
- _columns = {
- 'name': fields.related('address_id', 'partner_id', type='many2one',\
- relation='res.partner', string='Partner', help="You may\
- enter Address first,Partner will be linked automatically if any."),
- 'address_id': fields.many2one('res.partner.address', 'Address', \
- help='Address which is linked to the Partner'), # TO Correct: domain=[('partner_id', '=', name)]
- 'contact_id': fields.many2one('res.partner.contact','Contact', required=True, ondelete='cascade'),
- 'function': fields.char('Partner Function', size=64, help="Function of this contact with this partner"),
- 'sequence_contact': fields.integer('Contact Seq.',help='Order of\
- importance of this address in the list of addresses of the linked contact'),
- 'sequence_partner': fields.integer('Partner Seq.',help='Order of importance\
- of this job title in the list of job title of the linked partner'),
- 'email': fields.char('E-Mail', size=240, help="Job E-Mail"),
- 'phone': fields.char('Phone', size=64, help="Job Phone no."),
- 'fax': fields.char('Fax', size=64, help="Job FAX no."),
- 'extension': fields.char('Extension', size=64, help='Internal/External extension phone number'),
- 'other': fields.char('Other', size=64, help='Additional phone field'),
- 'date_start': fields.date('Date Start',help="Start date of job(Joining Date)"),
- 'date_stop': fields.date('Date Stop', help="Last date of job"),
- 'state': fields.selection([('past', 'Past'),('current', 'Current')], \
- 'State', required=True, help="Status of Address"),
- }
-
- _defaults = {
- 'sequence_contact' : lambda *a: 0,
- 'state': lambda *a: 'current',
- }
-
def onchange_name(self, cr, uid, ids, address_id='', name='', context=None):
return {'value': {'address_id': address_id}, 'domain':{'partner_id':'name'}}
.browse(cr, uid, address_id, context=context)
partner_id = address.partner_id.id
return {'value': {'name': partner_id}}
-
-res_partner_job()
+res_partner_address()
+
+class res_partner_job(osv.osv):
+ _name = 'res.partner.job'
+ _inherit = 'res.partner.address'
+res_partner_job()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
<field name="job_ids" colspan="4" nolabel="1" mode="tree,form">
<form string="Functions and Addresses">
<group colspan="4" col="4">
- <field name="sequence_contact" />
<field name="function"/>
<field name="name" on_change="onchange_name(name,address_id)"/>
<field name="address_id"/>
<field name="phone"/>
<field name="fax"/>
<field name="email" widget="email"/>
- <field name="extension"/>
- <field name="other"/>
</group>
</form>
<tree string="Functions and Addresses">
- <field name="sequence_contact" string="Seq."/>
<field name="function"/>
<field name="name" on_change="onchange_partner(name)"/>
<field name="address_id" attrs="{'required': [('name', '!=', False)]}" on_change="onchange_address(address_id)"/>
<field name="phone"/>
<field name="fax"/>
- <field name="extension"/>
- <field name="other"/>
<field name="email"/>
<field name="state" />
</tree>
</group>
<field name="job_ids" mode="tree,form" nolabel="1" colspan="4">
<tree string="Contacts" editable="top">
- <field name="sequence_partner"/>
<field name="contact_id"/>
<field name="function"/>
<field name="phone"/>
<field name="fax"/>
- <field name="extension"/>
- <field name="other"/>
<field name="email"/>
</tree>
<form string="Contacts">
<group colspan="4" col="4">
- <field name="sequence_partner"/>
<field name="contact_id"/>
<field name="function"/>
</group>
<group colspan="4" col="4">
<field name="phone"/>
<field name="fax"/>
- <field name="extension"/>
- <field name="other"/>
<field name="email" widget="email"/>
</group>
</form>
<field name="email"/>
<field name="phone"/>
<field name="fax"/>
- <field name="extension"/>
<field name="state" />
</tree>
</field>
<field name="email" widget="email"/>
<field name="phone"/>
<field name="fax"/>
- <field name="extension"/>
- <field name="sequence_contact" groups="base.group_user"/>
- <field name="sequence_partner" groups="base.group_user"/>
<field name="date_start" groups="base.group_user"/>
<field name="date_stop" groups="base.group_user"/>
<field name="state" />
'event_id': fields.many2one('event.event', 'Event', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'partner_id': fields.many2one('res.partner', 'Partner', states={'done': [('readonly', True)]}),
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}),
- "contact_id": fields.many2one('res.partner.contact', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id
+ "contact_id": fields.many2one('res.partner.address', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id
"unit_price": fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}),
'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute=dp.get_precision('Sale Price'), store=True),
"badge_ids": fields.one2many('event.registration.badge', 'registration_id', 'Badges', readonly=False, states={'done': [('readonly', True)]}),
inv_lines_pool = self.pool.get('account.invoice.line')
inv_pool = self.pool.get('account.invoice')
product_pool = self.pool.get('product.product')
- contact_pool = self.pool.get('res.partner.contact')
+ contact_pool = self.pool.get('res.partner.address')
if context is None:
context = {}
# If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the