[IMP] analytic contracts

bzr revid: fp@tinyerp.com-20120829190831-f6n1ruzsca2bo8xc
This commit is contained in:
Fabien Pinckaers 2012-08-29 21:08:31 +02:00
parent d0261477f8
commit 254489e168
13 changed files with 133 additions and 69 deletions

View File

@ -40,6 +40,9 @@ Adds menu to show relevant information to each manager.You can also view the rep
'account_analytic_analysis_menu.xml',
'account_analytic_analysis_cron.xml',
],
'css': [
'static/src/css/analytic.css'
],
'demo': [],
'installable': True,
'auto_install': False,

View File

@ -451,8 +451,8 @@ class account_analytic_account(osv.osv):
'real_margin_rate': fields.function(_real_margin_rate_calc, type='float', string='Real Margin Rate (%)',
help="Computes using the formula: (Real Margin / Total Costs) * 100.",
digits_compute=dp.get_precision('Account')),
'fix_price_invoices' : fields.boolean('Fix Price Invoices'),
'invoice_on_timesheets' : fields.boolean("Invoice On Timesheets"),
'fix_price_invoices' : fields.boolean('Fixed Price'),
'invoice_on_timesheets' : fields.boolean("On Timesheets"),
'month_ids': fields.function(_analysis_all, multi='analytic_analysis', type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
'user_ids': fields.function(_analysis_all, multi='analytic_analysis', type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
'hours_qtt_est': fields.float('Estimation of Hours to Invoice'),

View File

@ -22,30 +22,27 @@
<xpath expr='//div[@name="duration"]' position="after" version="7.0">
<label for="quantity_max"/>
<div>
<field name="quantity_max" class="oe_inline"/> / Remaining: <field name="remaining_hours" class="oe_inline"/>
<field name="quantity_max" class="oe_inline"/>
</div>
</xpath>
<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="master"]' position='after'>
<xpath expr='//separator[@name="description"]' position='before'>
<separator name="toinvoice" string="Invoicing"/>
<table width="100%%">
<table class="oe_form_analytic_account">
<tr>
<th></th>
<th></th>
<th><label string="Est.Tot"/></th>
<th><label string="Invoiced"/></th>
<th><label string="Remaining"/></th>
<th><label string="To Invoice"/></th>
<th class="oe_grey" width="160px"></th>
<th class="oe_grey" width="25px"></th>
<th class="oe_grey" width="100px"><label string="Expected"/></th>
<th class="oe_grey" width="100px"><label string="Invoiced"/></th>
<th class="oe_grey" width="100px"><label string="Remaining"/></th>
<th class="oe_grey" width="100px"><label string="To Invoice"/></th>
<th width="30px"></th>
<th></th>
</tr><tr>
<td>
<td class="oe_grey">
<label for="fix_price_invoices"/>
</td><td>
</td><td class="oe_grey">
<field name="fix_price_invoices" class="oe_inline"/>
</td><td>
<field class="oe_inline" name="amount_max" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
@ -56,13 +53,22 @@
</td><td>
<field class="oe_inline" name="fix_price_to_invoice" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<button name="%(action_sales_order)d" string="All Sales" type="action" context="{'default_partner_id': [partner_id], 'search_default_partner_id': [partner_id],'search_default_project_id': [active_id],'default_project_id': [active_id]}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
<button name="open_sale_order_lines" string="Lines To Invoice" type="object" context="{'default_partner_id': [partner_id],'default_project_id': active_id,'search_default_uninvoiced': 1,'search_default_project_id': active_id,'search_default_partner_id': [partner_id]}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td>
</tr><tr attrs="{'invisible':[('use_timesheets','=',False)]}">
<td>
<label for="invoice_on_timesheets"/>
<button name="open_sale_order_lines"
class="oe_link oe_e"
string="/" type="object"
context="{'default_partner_id': [partner_id],'default_project_id': active_id,'search_default_uninvoiced': 1,'search_default_project_id': active_id,'search_default_partner_id': [partner_id]}"
attrs="{'invisible': [('fix_price_to_invoice','=',0)]}"/>
</td><td>
<button name="%(action_sales_order)d" string="Sale Orders"
type="action"
class="oe_link"
context="{'default_partner_id': [partner_id], 'search_default_partner_id': [partner_id],'search_default_project_id': [active_id],'default_project_id': [active_id]}"
attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td>
</tr><tr>
<td class="oe_grey">
<label for="invoice_on_timesheets"/>
</td><td class="oe_grey">
<field name="invoice_on_timesheets"/>
</td><td>
<field class="oe_inline" name="hours_qtt_est" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
@ -73,25 +79,44 @@
</td><td>
<field class="oe_inline" name="ca_to_invoice" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<button name="%(hr_timesheet.act_hr_timesheet_line_evry1_all_form)d" string="All Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}" context="{'default_account_id': active_id,'search_default_account_id': active_id}"/>
<button name="%(hr_timesheet_invoice.act_acc_analytic_acc_2_report_acc_analytic_line_to_invoice)d" string="Timesheets to Invoice" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
<button name="%(hr_timesheet_invoice.act_acc_analytic_acc_2_report_acc_analytic_line_to_invoice)d"
type="action"
class="oe_link oe_e"
string="/"
attrs="{'invisible': [('ca_to_invoice','=',0.0)]}"/>
</td><td>
<button name="%(hr_timesheet.act_hr_timesheet_line_evry1_all_form)d"
string="Timesheets" type="action"
class="oe_link"
attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"
context="{'default_account_id': active_id,'search_default_account_id': active_id}"/>
</td>
</tr><tr name='total'>
<th>
<th class="oe_grey">
<label string="Total"/>
</th><td>
</td><td>
</th><td class="oe_grey">
</td><td class="oe_grey">
<field name="est_total" class="oe_inline" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
</td><td class="oe_grey">
<field name="invoiced_total" class="oe_inline"/>
</td><td>
</td><td class="oe_grey">
<field name="remaining_total" class="oe_inline"/>
</td><td>
</td><td class="oe_grey">
<field name="toinvoice_total" class="oe_inline"/>
</td><td>
</td>
</tr>
</table>
<group name='invoice_on_timesheets' attrs="{'invisible': [('invoice_on_timesheets','=',False)]}">
<field name="pricelist_id"
class="oe_inline"
attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
<field name="to_invoice"
class="oe_inline"
widget="selection"
attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
</group>
</xpath>
</field>
</record>

View File

@ -0,0 +1,3 @@
analytic.css: analytic.sass
sass -t expanded analytic.sass analytic.css

View File

@ -0,0 +1,15 @@
@charset "utf-8";
.openerp .oe_form table.oe_form_analytic_account tr {
height: 28px;
}
.openerp .oe_form table.oe_form_analytic_account tr td, .openerp .oe_form table.oe_form_analytic_account tr th {
vertical-align: middle;
}
.openerp .oe_form table.oe_form_analytic_account tr td .oe_form_field_float, .openerp .oe_form table.oe_form_analytic_account tr th .oe_form_field_float {
float: right;
width: auto !important;
}
.openerp .oe_form table.oe_form_analytic_account .oe_grey {
background-color: #eeeeee;
color: #404040;
}

View File

@ -0,0 +1,15 @@
@charset "utf-8"
.openerp .oe_form
table.oe_form_analytic_account
tr
height: 28px
td,th
vertical-align: middle
.oe_form_field_float
float: right
width: auto !important
.oe_grey
background-color: #eeeeee
color: #404040

View File

@ -153,9 +153,9 @@ class account_analytic_account(osv.osv):
return result
_columns = {
'name': fields.char('Account Name', size=128, required=True),
'name': fields.char('Account/Contract Name', size=128, required=True),
'complete_name': fields.function(_complete_name_calc, type='char', string='Full Account Name'),
'code': fields.char('Code/Reference', size=24, select=True),
'code': fields.char('Reference', size=24, select=True),
'type': fields.selection([('view','Analytic View'), ('normal','Analytic Account'),('contract','Contract or Project'),('template','Template of Project')], 'Type of Account', required=True,
help="If you select the View Type, it means you won\'t allow to create journal entries using that account.\n"\
"The type 'Analytic account' stands for usual accounts that you only want to use in accounting.\n"\
@ -171,7 +171,7 @@ class account_analytic_account(osv.osv):
'debit': fields.function(_debit_credit_bal_qtty, type='float', string='Debit', multi='debit_credit_bal_qtty', digits_compute=dp.get_precision('Account')),
'credit': fields.function(_debit_credit_bal_qtty, type='float', string='Credit', multi='debit_credit_bal_qtty', digits_compute=dp.get_precision('Account')),
'quantity': fields.function(_debit_credit_bal_qtty, type='float', string='Quantity', multi='debit_credit_bal_qtty'),
'quantity_max': fields.float('Maximum Time', help='Sets the higher limit of time to work on the contract.'),
'quantity_max': fields.float('Prepaid Units', help='Sets the higher limit of time to work on the contract.'),
'partner_id': fields.many2one('res.partner', 'Customer'),
'user_id': fields.many2one('res.users', 'Project Manager'),
'manager_id': fields.many2one('res.users', 'Account Manager'),

View File

@ -10,33 +10,35 @@
<sheet string="Analytic Account">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name"/>
<field name="name" class="oe_inline"/>
</h1>
<div name="project"/>
<group>
<group>
<field name="partner_id" on_change="on_change_partner_id(partner_id, name)" attrs="{'required':[('type','=','contract')]}"/>
<field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract','template'])]}"/>
<field name="type"/>
<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'}"/>
<field name="manager_id"/>
<field name="code"/>
</group>
<group>
<field name="code"/>
<field name="manager_id"/>
<field name="type"/>
<field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract','template'])]}"/>
<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'}"/>
<field name="company_id" on_change="on_change_company(company_id)" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','&lt;&gt;','view')]}"/>
</group>
</group>
<notebook>
<page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','not in',['contract', 'template'])]}">
<group name="master">
<group string="Validity" name="contract">
<label for="date_start" string="Duration"/>
<div name="duration">
<field name="date_start" class="oe_inline"/> - <field name="date" class="oe_inline"/>
</div>
</group>
<group name="project">
<separator string="Project Management" name="project_sep" invisible="1"/>
</group>
<group string="Renewal" name="contract">
<p colspan="2" class="oe_grey oe_edit_only">
Once the end date of the contract is
passed or the maximum number of service
units is reached, the account manager
is warned by email to renew the contract.
</p>
<label for="date" string="End Date"/>
<div name="duration">
<field name="date" class="oe_inline"/>
</div>
</group>
<separator string="Terms and Conditions" name="description"/>
<field name="description"/>

View File

@ -5,12 +5,13 @@
<field name="name">account.analytic.account.form.expense.inherit</field>
<field name="model">account.analytic.account</field>
<field eval="60" name="priority"/>
<field name="inherit_id" ref="account_analytic_analysis.account_analytic_account_form_form"/>
<field name="arch" type="xml">
<xpath expr='//tr[@name="total"]' position='before'>
<tr>
<td>
<td class="oe_grey">
<label for="charge_expenses"/>
</td><td>
</td><td class="oe_grey">
<field name="charge_expenses"/>
</td><td>
<field class="oe_form_inline" name="est_expenses" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
@ -21,10 +22,16 @@
</td><td>
<field class="oe_form_inline" name="expense_to_invoice" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<group>
<button name="open_hr_expense" string="All Expenses" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
<button name="hr_to_invoice_expense" string="Expenses to Invoice" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</group>
<button
name="hr_to_invoice_expense"
class="oe_link oe_e"
string="/" type="object"
attrs="{'invisible': [('expense_to_invoice','=',0)]}"/>
</td><td>
<button
name="open_hr_expense"
class="oe_link"
string="Expenses" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td>
</tr>
</xpath>

View File

@ -118,7 +118,7 @@
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="priority">50</field>
<field name="arch" type="xml">
<xpath expr='//field[@name="remaining_hours"]' position='after'>
<xpath expr='//field[@name="quantity_max"]' position='after'>
<field name="company_uom_id" readonly="1" class="oe_inline"/>
</xpath>
</field>

View File

@ -83,11 +83,9 @@
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="arch" type="xml">
<xpath expr='//separator[@name="project_sep"]' position='replace'>
<separator name="project_sep" string="Project Management" colspan="4"/> <!-- removal of invisible attribute -->
</xpath>
<xpath expr='//separator[@name="project_sep"]' position='after'>
<xpath expr='//div[@name="project"]' position='inside'>
<field name="use_timesheets"/>
<label for="use_timesheets"/>
</xpath>
</field>
</record>

View File

@ -688,11 +688,9 @@
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//separator[@name="project_sep"]' position='replace'>
<separator colspan="4" string="Project Management" name="project_sep"/> <!-- removal of invisible attribute -->
</xpath>
<xpath expr='//separator[@name="project_sep"]' position='after'>
<xpath expr='//div[@name="project"]' position='inside'>
<field name="use_tasks"/>
<label for="use_tasks"/>
</xpath>
</field>
</record>

View File

@ -393,11 +393,9 @@
<field name="inherit_id" ref="project.analytic_account_inherited_form"/>
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//separator[@name="project_sep"]' position='replace'>
<separator colspan="4" string="Project Management" name="project_sep"/> <!-- removal of invisible attribute -->
</xpath>
<xpath expr='//separator[@name="project_sep"]' position='after'>
<xpath expr='//div[@name="project"]' position='inside'>
<field name="use_issues"/>
<label for="use_issues"/>
</xpath>
</field>
</record>