[IMP]: partner_crm hr_timesheet: Task -225 Improvement in partner_crm module

bzr revid: ksa@tinyerp.co.in-20100506122954-leluf2cvydnl27eu
This commit is contained in:
ksa (Open ERP) 2010-05-06 17:59:54 +05:30
parent d5ae9ca15a
commit 6df236b561
3 changed files with 24 additions and 21 deletions

View File

@ -44,6 +44,7 @@ class hr_analytic_timesheet(osv.osv):
_order = "id desc" _order = "id desc"
_columns = { _columns = {
'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade'), 'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade'),
'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner Id',relation='account.analytic.account',store=True),
} }
def unlink(self, cr, uid, ids, context={}): def unlink(self, cr, uid, ids, context={}):
@ -56,8 +57,7 @@ class hr_analytic_timesheet(osv.osv):
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}): def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}):
res = {} res = {}
# if prod_id and unit_amount: if prod_id and unit_amount:
if prod_id:
# find company # find company
company_id=self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context) company_id=self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context)
res = self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount,company_id,unit, context) res = self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount,company_id,unit, context)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# #
@ -15,7 +15,7 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
@ -24,15 +24,18 @@ from osv import osv, fields
class res_partner(osv.osv): class res_partner(osv.osv):
""" Inherits partner and adds more information in the partner form """ """ Inherits partner and adds more information in the partner form """
_inherit = 'res.partner' _inherit = 'res.partner'
_columns = { _columns = {
'opportunity_ids': fields.one2many('crm.opportunity', 'partner_id', 'Opportunities'), 'opportunity_ids': fields.one2many('crm.opportunity', 'partner_id', 'Opportunities'),
'meeting_ids': fields.one2many('crm.meeting', 'partner_id',\ 'meeting_ids': fields.one2many('crm.meeting', 'partner_id',\
'Meetings'), 'Meetings'),
'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id', 'Phonecalls'), 'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id', 'Phonecalls'),
'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices'), 'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices'),
'contract_ids': fields.one2many('account.analytic.account', \ 'contract_ids': fields.one2many('account.analytic.account', \
'partner_id', 'Contracts'), 'partner_id', 'Contracts'),
'account_line_ids': fields.one2many('hr.analytic.timesheet', \
'partner_id', 'Anaylitic account lines '),
} }
res_partner() res_partner()

View File

@ -11,19 +11,19 @@
<field name="inherit_id" ref="base.view_partner_form"/> <field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<notebook position="inside"> <notebook position="inside">
<page string="Other Info"> <page string="CRM Info">
<group col="2" colspan="4"> <field name="opportunity_ids" colspan="4" nolabel="1" />
<field name="opportunity_ids" colspan="4" nolabel="1" /> <field name="meeting_ids" colspan="4" nolabel="1" />
<field name="meeting_ids" colspan="4" nolabel="1" />
<field name="phonecall_ids" colspan="4" nolabel="1" /> <field name="phonecall_ids" colspan="4" nolabel="1" />
</group>
<group col="2" colspan="4">
<field name="invoice_ids" colspan="4" nolabel="1" context="{'group_by':'product_id'}"/>
</group>
<group col="2" colspan="4">
<field name="contract_ids" colspan="4" nolabel="1" />
</group>
</page> </page>
<page string="Other Info">
<field name="invoice_ids" colspan="4" nolabel="1" context="{'group_by':'product_id'}"/>
<field name="contract_ids" colspan="4" nolabel="1"/>
<field name="account_line_ids" colspan="4" nolabel="1" context="{'group_by':'date'}"/>
</page>
</notebook> </notebook>
</field> </field>
</record> </record>