[MERGE] merged few changes made in sgo branch, related to apr's review

bzr revid: qdp-launchpad@openerp.com-20120625162040-i1956oyhj10wolca
This commit is contained in:
Quentin (OpenERP) 2012-06-25 18:20:40 +02:00
commit aa334dca9a
10 changed files with 54 additions and 17 deletions

View File

@ -19,6 +19,7 @@
<field name="partner_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="type" invisible="1"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
@ -71,6 +72,7 @@
<field name="partner_id" invisible="1"/>
<field name="parent_id" invisible="1"/>
<field name="type"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
@ -170,6 +172,7 @@
<field domain="[('type','=','normal')]" name="account_id"/>
<field name="general_account_id" invisible="context.get('to_invoice', False)"/>
<field name="user_id" invisible="1" />
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>

View File

@ -494,7 +494,6 @@ class account_analytic_account(osv.osv):
res['value']['pricelist_id'] = template.pricelist_id.id
res['value']['description'] = template.description
return res
account_analytic_account()
class account_analytic_account_summary_user(osv.osv):

View File

@ -23,11 +23,10 @@
<xpath expr='//field[@name="type"]' position='after'>
<field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
</xpath>
<xpath expr='//field[@name="date"]' position="after" version="7.0">
<xpath expr='//div[@name="duration"]' position="after" version="7.0">
<label for="quantity_max"/>
<div>
<field name="quantity_max" class="oe_form_inline"/> / Remaining:
<field name="remaining_hours" class="oe_form_inline"/>
<field name="quantity_max" class="oe_form_inline"/> / Remaining: <field name="remaining_hours" class="oe_form_inline"/>
</div>
</xpath>
<xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">

View File

@ -272,7 +272,20 @@ class account_analytic_account(osv.osv):
else:
account = self.search(cr, uid, args, limit=limit, context=context)
return self.name_get(cr, uid, account, context=context)
def create(self, cr, uid, vals, context=None):
contract = super(account_analytic_account, self).create(cr, uid, vals, context=context)
if contract:
self.create_send_note(cr, uid, [contract], context=context)
return contract
# ------------------------------------------------
# OpenChatter methods and notifications
# ------------------------------------------------
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_subscribe(cr, uid, [obj.id], [obj.user_id.id], context=context)
self.message_append_note(cr, uid, [obj.id], body=_("Contract for <em>%s</em> has been <b>created</b>.") % (obj.partner_id.name), context=context)
account_analytic_account()

View File

@ -9,7 +9,7 @@
<field name="arch" type="xml">
<form version="7.0">
<sheet string="Analytic Account">
<label for="name" class="oe_form_readonly_hidden"/>
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name"/>
</h1>
@ -29,8 +29,10 @@
<page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','not in',['contract', 'template'])]}">
<group name="master">
<group string="Validity" name="contract">
<field name="date_start"/>
<field name="date"/>
<label for="date_start" string="Duration"/>
<div name="duration">
<field name="date_start" class="oe_form_inline"/> - <field name="date" class="oe_form_inline"/>
</div>
</group>
<group name="project">
<separator string="Project Management" name="project_sep" invisible="1"/>

View File

@ -123,7 +123,7 @@ class account_analytic_account(osv.osv):
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['charge_expenses'] = template.charge_expenses
res['value']['expense_max'] = template.expense_max
res['value']['est_expenses'] = template.est_expenses
return res
def open_hr_expense(self, cr, uid, ids, context=None):

View File

@ -20,7 +20,7 @@
##############################################################################
{
"name" : "Contract Management In Project",
"name" : "Contract On Project",
"version": "1.1",
"author" : "OpenERP SA",
"website" : "http://www.openerp.com",

View File

@ -70,5 +70,14 @@ class project_project(osv.osv):
'context': view_context,
'nodestroy': True,
}
project_project()
class task(osv.osv):
_inherit = "project.task"
def create(self, cr, uid, vals, context=None):
task_id = super(task, self).create(cr, uid, vals, context=context)
task_browse = self.browse(cr, uid, task_id, context=context)
self.pool.get('account.analytic.account').message_append_note(cr, uid, [task_browse.project_id.analytic_account_id.id], body=_("Task <em>%s</em> has been <b>created</b>.") % (task_browse.name), context=context)
return task_id
task()

View File

@ -69,7 +69,7 @@ class account_analytic_account(osv.osv):
help="Keep empty if this contract is not limited to a total fixed price."),
'amount_invoiced': fields.function(_invoiced_calc, string='Invoiced Amount',
help="Total invoiced"),
'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Timesheet Invocing Ratio',
'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Timesheet Invoicing Ratio',
help="Fill this field if you plan to automatically generate invoices based " \
"on the costs in this analytic account: timesheets, expenses, ..." \
"You can configure an automatic invoice rate on analytic accounts."),
@ -94,16 +94,28 @@ class account_analytic_account(osv.osv):
return res
def set_close(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state':'close'}, context=context)
self.write(cr, uid, ids, {'state':'close'}, context=context)
message = _("Contract has been <b>closed</b>.")
self.message_append_note(cr, uid, ids, body=message, context=context)
return True
def set_cancel(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
message = _("Contract has been <b>cancelled</b>.")
self.message_append_note(cr, uid, ids, body=message, context=context)
return True
def set_open(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state':'open'}, context=context)
self.write(cr, uid, ids, {'state':'open'}, context=context)
message = _("Contract has been <b>opened</b>.")
self.message_append_note(cr, uid, ids, body=message, context=context)
return True
def set_pending(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state':'pending'}, context=context)
self.write(cr, uid, ids, {'state':'pending'}, context=context)
message = _("Contract has been set as <b>pending</b>.")
self.message_append_note(cr, uid, ids, body=message, context=context)
return True
account_analytic_account()

View File

@ -1219,7 +1219,7 @@ class account_analytic_account(osv.osv):
_inherit = 'account.analytic.account'
_description = 'Analytic Account'
_columns = {
'use_tasks': fields.boolean('Tasks Management'),
'use_tasks': fields.boolean('Tasks Management',help="If check,this contract will be available in the project menu and you will be able to manage tasks or track issues"),
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
}