[IMP] billing project hours useable
bzr revid: fp@tinyerp.com-20101004232308-pvzlua2cyra2kvqp
This commit is contained in:
parent
94fd910f3c
commit
67999a7e4e
|
@ -75,6 +75,9 @@ class account_analytic_line(osv.osv):
|
|||
unit=False, journal_id=False, context=None):
|
||||
if context==None:
|
||||
context={}
|
||||
if not journal_id:
|
||||
j_ids = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=','purchase')])
|
||||
j_id = j_ids and j_ids[0] or False
|
||||
if not journal_id or not prod_id:
|
||||
return {}
|
||||
product_obj = self.pool.get('product.product')
|
||||
|
@ -86,7 +89,7 @@ class account_analytic_line(osv.osv):
|
|||
result = 0.0
|
||||
is_purchase = False
|
||||
|
||||
if j_id.type == 'purchase':
|
||||
if j_id.type <> 'sale':
|
||||
a = prod.product_tmpl_id.property_account_expense.id
|
||||
if not a:
|
||||
a = prod.categ_id.property_account_expense_categ.id
|
||||
|
|
|
@ -57,14 +57,14 @@ class hr_analytic_timesheet(osv.osv):
|
|||
return super(hr_analytic_timesheet, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
|
||||
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit, context=None):
|
||||
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit=False, journal_id=False, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {'value':{}}
|
||||
if prod_id and unit_amount:
|
||||
# find company
|
||||
company_id = self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=context)
|
||||
res.update(self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount, company_id, unit, context=context))
|
||||
res.update(self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount, company_id, unit, journal_id, context=context))
|
||||
# update unit of measurement
|
||||
if prod_id:
|
||||
uom = self.pool.get('product.product').browse(cr, uid, prod_id, context=context)
|
||||
|
|
|
@ -14,14 +14,15 @@
|
|||
<tree editable="bottom" string="Timesheet Lines">
|
||||
<field name="date" on_change="on_change_date(date)"/>
|
||||
<field name="user_id" on_change="on_change_user_id(user_id)" required="1"/>
|
||||
<field name="journal_id" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field domain="[('type','=','normal')]" name="account_id"/>
|
||||
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)" required="1" domain="[('type','=','service')]"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)" sum="Total time"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)"/>
|
||||
<field name="amount" sum="Total cost"/>
|
||||
<field name="general_account_id"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" required="1" domain="[('type','=','service')]" invisible="1"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" sum="Total time"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" invisible="1"/>
|
||||
<field name="amount" sum="Total cost" invisible="1"/>
|
||||
<field name="general_account_id" invisible="1"/>
|
||||
<field name="journal_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -40,9 +41,9 @@
|
|||
<page string="Information">
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Product" colspan="2"/>
|
||||
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)" required="1" domain="[('type','=','service')]"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)"/>
|
||||
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" required="1" domain="[('type','=','service')]"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Accounting" colspan="2"/>
|
||||
|
@ -67,7 +68,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Timesheet">
|
||||
<group col='8' colspan='4'>
|
||||
<filter icon="terp-go-today" domain="[('date', '=', time.strftime('%%Y-%%m-%%d'))]" string="Today"/>
|
||||
<filter name="today" icon="terp-go-today" domain="[('date', '=', time.strftime('%%Y-%%m-%%d'))]" string="Today"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="user_id"/>
|
||||
<field name="account_id" select="1" widget="selection"/>
|
||||
|
@ -81,32 +82,20 @@
|
|||
<filter string="Anlytic account" icon="terp-folder-green" domain="[]" context="{'group_by':'account_id'}"/>
|
||||
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
|
||||
</group>
|
||||
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
||||
</record>
|
||||
|
||||
<record id="act_hr_timesheet_line_me_all_form" model="ir.actions.act_window">
|
||||
<field name="name">My Working Hours</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr.analytic.timesheet</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('user_id','=',uid)]</field>
|
||||
<field name="filter" eval="True"/>
|
||||
<field name="context">{"search_default_user_id":uid, "search_default_my": 1}</field>
|
||||
<field name="search_view_id" ref="hr_timesheet_line_search"/>
|
||||
</record>
|
||||
|
||||
<record id="act_hr_timesheet_line_evry1_all_form" model="ir.actions.act_window">
|
||||
<field name="name">Working Hours</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr.analytic.timesheet</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{"search_default_user_id":uid}</field>
|
||||
<field name="context">{"search_default_user_id":uid, "search_default_today":1}</field>
|
||||
<field name="search_view_id" ref="hr_timesheet_line_search"/>
|
||||
<field name="help">This functionality gives you a list of work done by user, product and analytic account (or project). A search tool allows you to make fine-grained analysis.</field>
|
||||
</record>
|
||||
|
|
|
@ -38,7 +38,7 @@ class hr_timesheet_invoice_create(osv.osv_memory):
|
|||
'accounts': fields.many2many('account.analytic.account', 'invoice_id', 'account_id', 'Analytic Accounts', required=True),
|
||||
'date': fields.boolean('Date', help='The real date of each work will be displayed on the invoice'),
|
||||
'time': fields.boolean('Time spent', help='The time of each work done will be displayed on the invoice'),
|
||||
'name': fields.boolean('Name of entry', help='The detail of each work done will be displayed on the invoice'),
|
||||
'name': fields.boolean('Description', help='The detail of each work done will be displayed on the invoice'),
|
||||
'price': fields.boolean('Cost', help='The cost of each work done will be displayed on the invoice. You probably don\'t want to check this'),
|
||||
'product': fields.many2one('product.product', 'Product', help='Complete this field only if you want to force to use a specific product. Keep empty to use the real product that comes from the cost.'),
|
||||
}
|
||||
|
@ -59,8 +59,10 @@ class hr_timesheet_invoice_create(osv.osv_memory):
|
|||
return [x[0] for x in account_ids]
|
||||
|
||||
_defaults = {
|
||||
'accounts': _get_accounts
|
||||
}
|
||||
'accounts': _get_accounts,
|
||||
'date': lambda *args: 1,
|
||||
'name': lambda *args: 1
|
||||
}
|
||||
|
||||
def do_create(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
|
|
|
@ -2,37 +2,33 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_hr_timesheet_invoice_create" model="ir.ui.view">
|
||||
<record id="view_hr_timesheet_invoice_create" model="ir.ui.view">
|
||||
<field name="name">hr.timesheet.invoice.create.form</field>
|
||||
<field name="model">hr.timesheet.invoice.create</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Invoice analytic lines">
|
||||
<group height="280" width="450">
|
||||
<group col="4" colspan="6">
|
||||
<notebook>
|
||||
<page string="Billing Data">
|
||||
<separator string="Do you want to show details of work in invoice ?" colspan="4"/>
|
||||
<field name="date"/>
|
||||
<field name="time"/>
|
||||
<field name="name"/>
|
||||
<field name="price"/>
|
||||
<separator string="Force to use a specific product" colspan="4"/>
|
||||
<field name="product"/>
|
||||
</page>
|
||||
<page string="Filter on Accounts" groups="base.group_extended">
|
||||
<separator string="Choose accounts you want to invoice" colspan="4"/>
|
||||
<field name="accounts" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="do_create" string="Create Invoices" colspan="1" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
<form string="Invoice analytic lines">
|
||||
<notebook colspan="4">
|
||||
<page string="Billing Data">
|
||||
<separator string="Do you want to show details of work in invoice ?" colspan="4"/>
|
||||
<field name="date"/>
|
||||
<field name="time"/>
|
||||
<field name="name"/>
|
||||
<field name="price"/>
|
||||
<separator string="Force to use a specific product" colspan="4"/>
|
||||
<field name="product"/>
|
||||
</page>
|
||||
<page string="Filter on Accounts" groups="base.group_extended">
|
||||
<separator string="Choose accounts you want to invoice" colspan="4"/>
|
||||
<field name="accounts" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="do_create" string="Create Invoices" colspan="1" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
@ -45,7 +41,7 @@
|
|||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="hr_timesheet_invoice_create_values">
|
||||
<record model="ir.values" id="hr_timesheet_invoice_create_values">
|
||||
<field name="model_id" ref="model_account_analytic_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Invoice analytic lines</field>
|
||||
|
@ -55,5 +51,5 @@
|
|||
<field name="model">account.analytic.line</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -104,11 +104,11 @@
|
|||
<field invisible="1" name="date"/>
|
||||
<field domain="[('type','=','normal'), ('state', '<>', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
|
||||
<field name="name"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)" widget="float_time"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
|
||||
<field name="to_invoice"/>
|
||||
<field invisible="1" name="journal_id"/>
|
||||
<field invisible="1" name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)"/>
|
||||
<field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)"/>
|
||||
<field invisible="1" name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
|
||||
<field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
|
||||
<field invisible="1" name="amount"/>
|
||||
<field invisible="1" name="general_account_id"/>
|
||||
<field invisible="1" name="user_id" required="1"/>
|
||||
|
@ -117,11 +117,11 @@
|
|||
<field name="date"/>
|
||||
<field domain="[('type','=','normal'), ('state', '<>', 'close')]" name="account_id" on_change="on_change_account_id(account_id)"/>
|
||||
<field name="name"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)" widget="float_time"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
|
||||
<field name="to_invoice"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)"/>
|
||||
<field name="product_id" domain="[('type','=','service')]" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
|
||||
<field name="amount"/>
|
||||
<field name="general_account_id"/>
|
||||
<field name="user_id" required="1"/>
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
<field name="timesheet_ids" colspan="4" nolabel="1" context="{'default_user_id' : user_id, 'default_account_id' : analytic_account_id}">
|
||||
<tree editable="top" string="Timesheet">
|
||||
<field name="name"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)" widget="float_time"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
|
||||
<field name="account_id" invisible="0" domain="[('partner_id', '=', parent.partner_id)]" on_change="on_change_account_id(account_id)"/>
|
||||
<field name="date"/>
|
||||
<field name="user_id"/>
|
||||
<field invisible="1" name="journal_id"/>
|
||||
<field invisible="1" name="product_id"/>
|
||||
<field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id)"/>
|
||||
<field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)"/>
|
||||
<field invisible="1" name="amount"/>
|
||||
<field invisible="1" name="general_account_id"/>
|
||||
</tree>
|
||||
|
|
Loading…
Reference in New Issue