parent
ed47d40ae4
commit
94fd910f3c
|
@ -28,8 +28,8 @@ from osv import osv
|
|||
class account_analytic_journal(osv.osv):
|
||||
_name = 'account.analytic.journal'
|
||||
_columns = {
|
||||
'name' : fields.char('Journal name', size=64, required=True),
|
||||
'code' : fields.char('Journal code', size=8),
|
||||
'name' : fields.char('Journal Name', size=64, required=True),
|
||||
'code' : fields.char('Journal Code', size=8),
|
||||
'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the analytic journal without removing it."),
|
||||
'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True, help="Gives the type of the analytic journal. When it needs for a document (eg: an invoice) to create analytic entries, OpenERP will look for a matching journal of the same type."),
|
||||
'line_ids' : fields.one2many('account.analytic.line', 'journal_id', 'Lines'),
|
||||
|
|
|
@ -172,19 +172,16 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="top" string="Analytic Entries">
|
||||
<field name="date" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
|
||||
<field name="date"/>
|
||||
<field name="ref" invisible="context.get('to_invoice', False)"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id"/>
|
||||
<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_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)"/>
|
||||
<field domain="[('type','=','normal')]" name="account_id" groups="base.group_extended"/>
|
||||
<field invisible="True" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
|
||||
<field name="amount" sum="Total amount"/>
|
||||
<field name="general_account_id"/>
|
||||
<field name="ref"/>
|
||||
<field name="currency_id" />
|
||||
<field name="amount_currency" />
|
||||
<field name="company_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" groups="base.group_multi_company"/>
|
||||
<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, 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" invisible="not context.get('to_invoice', False)"/>
|
||||
<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)"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -195,22 +192,24 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Search Analytic Lines">
|
||||
<group col='6' colspan='4'>
|
||||
<filter string="Sales" domain="[('journal_id.type','=','sale')]" icon="terp-sale" help="Analytic Journal Items related to a sale journal."/>
|
||||
<filter string="Purchases" domain="[('journal_id.type','=','purchase')]" icon="terp-purchase" help="Analytic Journal Items related to a purchase journal."/>
|
||||
<filter name="sales" string="Sales" domain="[('journal_id.type','=','sale')]" icon="terp-sale" help="Analytic Journal Items related to a sale journal."/>
|
||||
<filter name="purchases" string="Purchases" domain="[('journal_id.type','=','purchase')]" icon="terp-purchase" help="Analytic Journal Items related to a purchase journal."/>
|
||||
<filter name="others" string="Others" domain="[('journal_id.type','in',('cash','general','situation')]" icon="terp-folder-orange"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-go-today" string="Overdue Accounts" domain="[('account_id.date','<',time.strftime('%%Y-%%m-%%d'))]" help="Analytic Journal Items related to accounts having a past deadline."/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="account_id" select="1"/>
|
||||
<field name="user_id" widget="selection"/>
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="account_id"/>
|
||||
<field name="user_id">
|
||||
<filter string="My Entries" domain="[('user_id','=',uid)]" icon="terp-personal"/>
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group string="Group By..." expand="0">
|
||||
<filter string="Analytic Account" context="{'group_by':'account_id'}" groups="base.group_extended" icon="terp-folder-blue"/>
|
||||
<filter string="Analytic Journal" context="{'group_by':'journal_id'}" icon="terp-folder-orange"/>
|
||||
<filter string="Account" context="{'group_by':'account_id'}" groups="base.group_extended" icon="terp-folder-blue"/>
|
||||
<filter string="Journal" context="{'group_by':'journal_id'}" icon="terp-folder-orange"/>
|
||||
<filter string="User" context="{'group_by':'user_id'}" icon="terp-personal"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="General Account" context="{'group_by':'general_account_id'}" icon="terp-folder-green"/>
|
||||
<filter string="Fin.Account" context="{'group_by':'general_account_id'}" icon="terp-folder-green"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Product" context="{'group_by':'product_id'}" icon="terp-accessories-archiver"/>
|
||||
</group>
|
||||
|
|
|
@ -99,7 +99,7 @@ class hr_analytic_timesheet(osv.osv):
|
|||
(r.product_id.name, r.product_id.id,))
|
||||
# Compute based on pricetype
|
||||
amount_unit = self.on_change_unit_amount(cr, uid, ids,
|
||||
r.product_id.id, unit_amount, r.product_id.uom_id.id)['value']['amount']
|
||||
r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount']
|
||||
|
||||
amount = unit_amount * amount_unit
|
||||
res ['value']['amount']= - round(amount, 2)
|
||||
|
@ -134,7 +134,7 @@ class hr_analytic_timesheet(osv.osv):
|
|||
(r.product_id.name, r.product_id.id,))
|
||||
# Compute based on pricetype
|
||||
amount_unit = self.on_change_unit_amount(cr, uid, ids,
|
||||
r.product_id.id, unit_amount, r.product_id.uom_id.id)['value']['amount']
|
||||
r.product_id.id, unit_amount, False, r.product_id.uom_id.id)['value']['amount']
|
||||
|
||||
amount = unit_amount * amount_unit
|
||||
res ['value']['amount']= - round(amount, 2)
|
||||
|
|
|
@ -57,7 +57,7 @@ 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, unit, context=None):
|
||||
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, company_id, unit, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {'value':{}}
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom" string="Timesheet Lines">
|
||||
<field name="user_id" on_change="on_change_user_id(user_id)" required="1"/>
|
||||
<field name="date" on_change="on_change_date(date)"/>
|
||||
<field domain="[('type','=','normal'),('state', '<>', 'close')]" name="account_id"/>
|
||||
<field name="user_id" on_change="on_change_user_id(user_id)" required="1"/>
|
||||
<field name="name"/>
|
||||
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" required="1" domain="[('type','=','service')]"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" sum="Total time"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
|
||||
<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"/>
|
||||
|
@ -40,9 +40,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, product_uom_id)" required="1" domain="[('type','=','service')]"/>
|
||||
<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, product_uom_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="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)"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Accounting" colspan="2"/>
|
||||
|
|
|
@ -81,7 +81,7 @@ class hr_so_project(osv.osv_memory):
|
|||
|
||||
if not res['product_uom_id']:
|
||||
raise osv.except_osv(_('UserError'), _('No cost unit defined for this employee !'))
|
||||
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
|
||||
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour,False, res['product_uom_id'])['value']
|
||||
|
||||
res['name'] = data['info']
|
||||
res['account_id'] = data['account_id'].id
|
||||
|
|
|
@ -21,17 +21,6 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!--record id="view_account_analytic_account_form" model="ir.ui.view">
|
||||
<field name="name">account.analytic.account.form</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="inherit_id" ref="account.view_account_analytic_account_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="company_currency_id" position="replace">
|
||||
<field name="currency_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record-->
|
||||
<record id="hr_timesheet_line_form" model="ir.ui.view">
|
||||
<field name="name">hr.analytic.timesheet.form</field>
|
||||
<field name="model">hr.analytic.timesheet</field>
|
||||
|
@ -83,13 +72,26 @@
|
|||
</record>
|
||||
|
||||
<!-- Inherits for account analytic lines -->
|
||||
<record id="view_account_analytic_line_search_inherit" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.search.to_invoice</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="type">search</field>
|
||||
<field name="inherit_id" ref="account.view_account_analytic_line_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<filter name="others" position="after">
|
||||
<separator orientation="vertical"/>
|
||||
<filter name="to_invoice" string="To Invoice" context="{'to_invoice': 1}" domain="[('invoice_id','=',False),('to_invoice','<>',False)]" icon="terp-sale"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_analytic_line_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.tree.to_invoice</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="journal_id" position="after">
|
||||
<field name="account_id" position="after">
|
||||
<field name="to_invoice"/>
|
||||
</field>
|
||||
</field>
|
||||
|
@ -103,18 +105,19 @@
|
|||
<field name="arch" type="xml">
|
||||
<field name="product_uom_id" position="after">
|
||||
<field name="to_invoice"/>
|
||||
<field name="invoice_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Menus -->
|
||||
<record id="action_hr_analytic_timesheet_open_tree" model="ir.actions.act_window">
|
||||
<field name="name">Entries to invoice</field>
|
||||
<field name="name">Costs to Invoice</field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('to_invoice','<>',False)]</field>
|
||||
<field name="context">{"search_default_user_id":uid}</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="context">{'search_default_to_invoice': 1}</field>
|
||||
<field name="help">OpenERP automatically group the entries to be invoiced so you can keep an eye on them on real time in one glance.</field>
|
||||
</record>
|
||||
<menuitem
|
||||
|
@ -123,31 +126,6 @@
|
|||
parent="account.menu_finance_periodical_processing_billing"
|
||||
sequence="1"/>
|
||||
|
||||
<record id="action_hr_analytic_timesheet_tree_invoiced" model="ir.actions.act_window">
|
||||
<field name="name">Uninvoiced Entries</field>
|
||||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('invoice_id','=',False),('to_invoice','!=',False)]</field>
|
||||
<field name="filter" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record id="action_open_analytic_accounts" model="ir.actions.act_window">
|
||||
<field name="name">Open Analytic Accounts</field>
|
||||
<field name="res_model">account.analytic.account</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','<>','close'),('type','<>','view')]</field>
|
||||
</record>
|
||||
|
||||
<record id="action_open_invoice_analytic_accounts" model="ir.actions.act_window">
|
||||
<field name="name">Unclosed Invoiceable Accounts</field>
|
||||
<field name="res_model">account.analytic.account</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','<>','close'),('type','<>','view'),('pricelist_id','<>',False)]</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_invoice_factor_form" model="ir.ui.view">
|
||||
<field name="name">hr_timesheet_invoice.factor.form</field>
|
||||
<field name="model">hr_timesheet_invoice.factor</field>
|
||||
|
|
|
@ -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, product_uom_id)" widget="float_time"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_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, product_uom_id)"/>
|
||||
<field invisible="1" name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, 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)"/>
|
||||
<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="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, product_uom_id)" widget="float_time"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_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, product_uom_id)"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_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="amount"/>
|
||||
<field name="general_account_id"/>
|
||||
<field name="user_id" required="1"/>
|
||||
|
|
|
@ -190,7 +190,6 @@ class project(osv.osv):
|
|||
'active': True,
|
||||
'priority': 1,
|
||||
'sequence': 10,
|
||||
'warn_manager': True,
|
||||
}
|
||||
|
||||
def _check_dates(self, cr, uid, ids):
|
||||
|
|
|
@ -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, product_uom_id)" widget="float_time"/>
|
||||
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_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, 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="amount"/>
|
||||
<field invisible="1" name="general_account_id"/>
|
||||
</tree>
|
||||
|
|
|
@ -98,7 +98,7 @@ class project_work(osv.osv):
|
|||
|
||||
# Compute based on pricetype
|
||||
amount_unit = obj_timesheet.on_change_unit_amount(cr, uid, timeline_id,
|
||||
prod_id, amount, unit, context=context)
|
||||
prod_id, amount, False, unit, context=context)
|
||||
if amount_unit and 'amount' in amount_unit.get('value',{}):
|
||||
updv = { 'amount': amount_unit['value']['amount'] }
|
||||
obj_timesheet.write(cr, uid, [timeline_id], updv, context=context)
|
||||
|
@ -146,7 +146,7 @@ class project_work(osv.osv):
|
|||
# Compute based on pricetype
|
||||
amount_unit = obj.on_change_unit_amount(cr, uid, line_id.id,
|
||||
prod_id=prod_id,
|
||||
unit_amount=vals_line['unit_amount'], unit=False, context=context)
|
||||
quantity=vals_line['unit_amount'], unit=False, context=context)
|
||||
|
||||
if amount_unit and 'amount' in amount_unit.get('value',{}):
|
||||
vals_line['amount'] = amount_unit['value']['amount']
|
||||
|
|
|
@ -31,5 +31,10 @@
|
|||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_project_billing" name="Billing"
|
||||
parent="base.menu_main_pm" sequence="5"/>
|
||||
<menuitem id="menu_project_billing_line" name="Bill Tasks Work"
|
||||
parent="menu_project_billing" action="hr_timesheet_invoice.action_hr_analytic_timesheet_open_tree"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue