[MERGE]merge with parent branch

bzr revid: sgo@tinyerp.com-20120626060858-7ef6rratc7s4pvov
This commit is contained in:
Sanjay Gohel (Open ERP)
2012-06-26 11:38:58 +05:30
12 changed files with 55 additions and 56 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ class account_analytic_line(osv.osv):
# Compute the cost based on the price type define into company
# property_valuation_price_type property
def on_change_unit_amount(self, cr, uid, id, prod_id, quantity,
def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id,
unit=False, journal_id=False, context=None):
if context==None:
context={}
+11 -8
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>
@@ -164,12 +166,13 @@
<field name="name"/>
<field name="journal_id" invisible="context.get('to_invoice', False)"/>
<field name="amount" sum="Total" invisible="context.get('to_invoice', False)"/>
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount,product_uom_id, journal_id)" invisible="not context.get('to_invoice', False)"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount,product_uom_id)" sum="Total Quantity"/>
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount,product_uom_id)" invisible="not context.get('to_invoice', False)"/>
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)" invisible="not context.get('to_invoice', False)"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" sum="Total Quantity"/>
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" invisible="not context.get('to_invoice', False)"/>
<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>
@@ -241,16 +244,16 @@
<group col="4">
<field name="name"/>
<field name="account_id"/>
<field name="date" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
<field name="date" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
<field name="journal_id"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id, journal_id)"/>
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)"/>
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
<field invisible="True" name="general_account_id"/>
<field name="amount"/>
<field name="currency_id" />
<field name="amount_currency" />
<field name="company_id" groups="base.group_multi_company"/>
<field name="company_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
</group>
</form>
</field>
@@ -26,25 +26,17 @@
<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="//field[@name='use_timesheets']" position="replace">
<group colspan="2" col="4">
<field name="use_timesheets" on_change="on_change_use_timesheets(use_timesheets, context)"/>
<field name="to_invoice" attrs="{'required': [('invoice_on_timesheets', '=', True)],'invisible': [('invoice_on_timesheets','=',False)]}"/>
<xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">
<group name='invoice_on_timesheets' string="Invoice on Timesheets Options" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}" col="4">
<field name="pricelist_id" attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
<field name="to_invoice" widget="selection" attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
</group>
</xpath>
<xpath expr="//group[@name='invoice_on_timesheets']" position="replace"/>
<xpath expr='//group[@name="master"]' position='after'>
<separator name="toinvoice" string="Invoicing"/>
<group>
<group>
<field name="pricelist_id" attrs="{'required': [('invoice_on_timesheets', '=', True)],'invisible': [('invoice_on_timesheets','=',False)]}"/>
</group>
<group></group>
</group>
<table width="100%%">
<tr>
<th></th>
+2 -2
View File
@@ -29,9 +29,9 @@
<page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','not in',['contract', 'template'])]}">
<group name="master">
<group string="Validity" name="contract">
<label string="Duration"/>
<label for="date_start" string="Duration"/>
<div name="duration">
<field name="date_start"/> - <field name="date"/>
<field name="date_start" class="oe_form_inline"/> - <field name="date" class="oe_form_inline"/>
</div>
</group>
<group name="project">
@@ -21,7 +21,7 @@
{
'name': 'Contract on Hr expense with Project',
'name': 'Projects Management: hr_expense link',
'version': '1.1',
'category': 'Sales Management',
'description': """
@@ -21,7 +21,7 @@
{
'name': 'Contracts on Hr expense',
'name': 'Contracts Management: hr_expense link',
'version': '1.1',
'category': 'Sales Management',
'description': """
@@ -77,7 +77,7 @@ class task(osv.osv):
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)
self.pool.get('account.analytic.account').message_append_note(cr, uid, [task_browse.project_id.analytic_account_id.id], body=_("Task has been <b>created</b>."), 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()
@@ -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', '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."),
@@ -95,39 +95,27 @@ class account_analytic_account(osv.osv):
def set_close(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'close'}, context=context)
self.set_close_send_note(cr, uid, ids, 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):
self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
self.set_cancel_send_note(cr, uid, ids, 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):
self.write(cr, uid, ids, {'state':'open'}, context=context)
self.set_open_send_note(cr, uid, ids, 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):
self.write(cr, uid, ids, {'state':'pending'}, context=context)
self.set_pending_send_note(cr, uid, ids, context)
message = _("Contract has been set as <b>pending</b>.")
self.message_append_note(cr, uid, ids, body=message, context=context)
return True
def set_open_send_note(self, cr, uid, ids, context=None):
message = _("Contract has been <b>opened</b>.")
return self.message_append_note(cr, uid, ids, body=message, context=context)
def set_close_send_note(self, cr, uid, ids, context=None):
message = _("Contract has been <b>closed</b>.")
return self.message_append_note(cr, uid, ids, body=message, context=context)
def set_cancel_send_note(self, cr, uid, ids, context=None):
message = _("Contract has been <b>cancelled</b>.")
return self.message_append_note(cr, uid, ids, body=message, context=context)
def set_pending_send_note(self, cr, uid, ids, context=None):
message = _("Contract has been <b>pending</b>.")
return self.message_append_note(cr, uid, ids, body=message, context=context)
account_analytic_account()
+7 -1
View File
@@ -36,7 +36,13 @@ the Timesheet line entries for particular date and particular user with the eff
'images': ['images/invoice_task_work.jpeg', 'images/my_timesheet.jpeg', 'images/working_hour.jpeg'],
'depends': ['project', 'hr_timesheet_sheet', 'hr_timesheet_invoice', 'account_analytic_analysis'],
'init_xml': ['project_timesheet_data.xml'],
'update_xml': ["security/ir.model.access.csv","process/project_timesheet_process.xml", "report/task_report_view.xml", "project_timesheet_view.xml"],
'update_xml': [
"security/ir.model.access.csv",
"security/project_timesheet_security.xml",
"process/project_timesheet_process.xml",
"report/task_report_view.xml",
"project_timesheet_view.xml",
],
'demo_xml': ["project_timesheet_demo.xml"],
'test': [
'test/worktask_entry_to_timesheetline_entry.yml',
@@ -105,7 +105,7 @@ class project_work(osv.osv):
project_obj = self.pool.get('project.project')
task_obj = self.pool.get('project.task')
uom_obj = self.pool.get('product.uom')
vals_line = {}
context = kwargs.get('context', {})
if not context.get('no_analytic_entry',False):
@@ -115,7 +115,7 @@ class project_work(osv.osv):
vals_line['user_id'] = vals['user_id']
vals_line['product_id'] = result['product_id']
vals_line['date'] = vals['date'][:10]
#calculate quantity based on employee's product's uom
vals_line['unit_amount'] = vals['hours']
@@ -153,7 +153,7 @@ class project_work(osv.osv):
project_obj = self.pool.get('project.project')
uom_obj = self.pool.get('product.uom')
result = {}
if isinstance(ids, (long, int)):
ids = [ids,]
@@ -172,7 +172,7 @@ class project_work(osv.osv):
for fld in ('product_id', 'general_account_id', 'journal_id', 'product_uom_id'):
if result.get(fld, False):
vals_line[fld] = result[fld]
if 'date' in vals:
vals_line['date'] = vals['date'][:10]
if 'hours' in vals:
@@ -182,7 +182,7 @@ class project_work(osv.osv):
if result.get('product_uom_id',False) and (not result['product_uom_id'] == default_uom):
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
# Compute based on pricetype
amount_unit = timesheet_obj.on_change_unit_amount(cr, uid, line_id.id,
prod_id=prod_id, company_id=False,
@@ -192,7 +192,7 @@ class project_work(osv.osv):
vals_line['amount'] = amount_unit['value']['amount']
self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context)
return super(project_work,self).write(cr, uid, ids, vals, context)
def unlink(self, cr, uid, ids, *args, **kwargs):
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<record model="res.groups" id="base.group_user">
<field name="implied_ids" eval="[(4, ref('project.group_tasks_work_on_tasks'))]"/>
</record>
</data>
</openerp>
+1
View File
@@ -142,6 +142,7 @@
<field name="date_order"/>
<field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="stock.group_locations"/>
<field name="client_order_ref"/>
<field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
</group>
</group>
<notebook>