[IMP] change related button into stat for account,project
bzr revid: rma@tinyerp.com-20140325124531-kkwm1v8bhndzs846
This commit is contained in:
parent
96ea9392aa
commit
3caf591550
|
@ -1532,7 +1532,9 @@
|
||||||
<field name="lines_id" widget="one2many_list"/>
|
<field name="lines_id" widget="one2many_list"/>
|
||||||
<separator string="Legend"/>
|
<separator string="Legend"/>
|
||||||
<field name="legend"/>
|
<field name="legend"/>
|
||||||
<button name="%(action_account_use_model_create_entry)d" string="Create entries" type="action" icon="gtk-execute"/>
|
<div class="oe_button_box">
|
||||||
|
<button class="oe_inline oe_button_box oe_stat_button" name="%(action_account_use_model_create_entry)d" string="Create entries" type="action" icon="fa-cogs" widget="statinfo"/>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -237,9 +237,17 @@ class account_asset_asset(osv.osv):
|
||||||
if salvage_value:
|
if salvage_value:
|
||||||
val['value_residual'] = purchase_value - salvage_value
|
val['value_residual'] = purchase_value - salvage_value
|
||||||
return {'value': val}
|
return {'value': val}
|
||||||
|
def _entry_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
|
res = dict(map(lambda x: (x,0), ids))
|
||||||
|
try:
|
||||||
|
for entry in self.browse(cr, uid, ids, context=context):
|
||||||
|
res[entry.id] = len(entry.account_move_line_ids)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return res
|
||||||
_columns = {
|
_columns = {
|
||||||
'account_move_line_ids': fields.one2many('account.move.line', 'asset_id', 'Entries', readonly=True, states={'draft':[('readonly',False)]}),
|
'account_move_line_ids': fields.one2many('account.move.line', 'asset_id', 'Entries', readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
|
'entry_count': fields.function(_entry_count, string='# Asset Entries', type='integer'),
|
||||||
'name': fields.char('Asset Name', size=64, required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
'name': fields.char('Asset Name', size=64, required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
'code': fields.char('Reference', size=32, readonly=True, states={'draft':[('readonly',False)]}),
|
'code': fields.char('Reference', size=32, readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
'purchase_value': fields.float('Gross Value', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
'purchase_value': fields.float('Gross Value', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
|
|
|
@ -84,7 +84,9 @@
|
||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_button_box oe_right">
|
<div class="oe_button_box oe_right">
|
||||||
<button name="open_entries" string="Entries" type="object" class="oe_inline"/>
|
<button class="oe_inline oe_stat_button" name="open_entries" type="object" icon="fa-pencil-square-o">
|
||||||
|
<field string="Entries" name="entry_count" widget="statinfo" />
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<label for="name" class="oe_edit_only"/>
|
<label for="name" class="oe_edit_only"/>
|
||||||
|
@ -117,9 +119,9 @@
|
||||||
<field name="method"/>
|
<field name="method"/>
|
||||||
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
|
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
|
||||||
<label for="method_time"/>
|
<label for="method_time"/>
|
||||||
<div>
|
<div class="oe_button_box">
|
||||||
<field name="method_time" on_change="onchange_method_time(method_time)" class="oe_inline"/>
|
<field name="method_time" on_change="onchange_method_time(method_time)" class="oe_inline"/>
|
||||||
<button name="%(action_asset_modify)d" states="open" string="Change Duration" type="action" icon="terp-stock_effects-object-colorize" class="oe_inline" colspan="1"/>
|
<button name="%(action_asset_modify)d" states="open" string="Change Duration" type="action" icon="fa-cogs" class="oe_inline oe_stat_button" colspan="1" widget="statinfo"/>
|
||||||
</div>
|
</div>
|
||||||
<field name="prorata" attrs="{'invisible': [('method_time','=','end')]}"/>
|
<field name="prorata" attrs="{'invisible': [('method_time','=','end')]}"/>
|
||||||
<field name="method_number" attrs="{'invisible':[('method_time','=','end')], 'required':[('method_time','=','number')]}"/>
|
<field name="method_number" attrs="{'invisible':[('method_time','=','end')], 'required':[('method_time','=','number')]}"/>
|
||||||
|
|
|
@ -70,8 +70,8 @@
|
||||||
</header>
|
</header>
|
||||||
<sheet string="Payment order">
|
<sheet string="Payment order">
|
||||||
<div class="oe_button_box">
|
<div class="oe_button_box">
|
||||||
<button name="%(action_create_payment_order)d" string="Select Invoices to Pay"
|
<button class="oe_inline oe_stat_button oe_right" name="%(action_create_payment_order)d" string="Select Invoices to Pay"
|
||||||
type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
|
type="action" attrs="{'invisible':[('state','=','done')]}" icon="fa-search" widget="statinfo"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<label for="reference" class="oe_edit_only"/>
|
<label for="reference" class="oe_edit_only"/>
|
||||||
|
@ -292,7 +292,7 @@
|
||||||
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//div[@name='import_buttons']" position="inside">
|
<xpath expr="//div[@name='import_buttons']" position="inside">
|
||||||
<button name="%(action_account_populate_statement_confirm)d" attrs="{'invisible':[('state','=','confirm')]}" string="Import Payment Lines" type="action" icon="gtk-execute"/>
|
<button class="oe_inline oe_stat_button" name="%(action_account_populate_statement_confirm)d" attrs="{'invisible':[('state','=','confirm')]}" string="Import Payment Lines" type="action" icon="fa-cogs" widget="statinfo"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -200,9 +200,9 @@
|
||||||
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
<field name="inherit_id" ref="account.view_bank_statement_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//div[@name='import_buttons']" position="inside">
|
<xpath expr="//div[@name='import_buttons']" position="inside">
|
||||||
<button name="%(action_view_account_statement_from_invoice_lines)d"
|
<button class="oe_inline oe_stat_button" name="%(action_view_account_statement_from_invoice_lines)d"
|
||||||
string="Import Invoices" type="action"
|
string="Import Invoices" type="action"
|
||||||
attrs="{'invisible':[('state','=','confirm')]}"/>
|
attrs="{'invisible':[('state','=','confirm')]}" widget="statinfo" icon="fa-pencil-square-o"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -14,15 +14,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="oe_right oe_button_box" name="buttons">
|
<div class="oe_right oe_button_box" name="buttons">
|
||||||
<field name="ref_ir_act_window" invisible="1"/>
|
<field name="ref_ir_act_window" invisible="1"/>
|
||||||
<button name="create_action" string="Add context action" type="object"
|
<button class="oe_inline oe_stat_button" name="create_action" string="Add context action" type="object"
|
||||||
attrs="{'invisible':[('ref_ir_act_window','!=',False)]}"
|
attrs="{'invisible':[('ref_ir_act_window','!=',False)]}" icon="fa-adn"
|
||||||
help="Display an option on related documents to open a composition wizard with this template"/>
|
help="Display an option on related documents to open a composition wizard with this template" widget="statinfo"/>
|
||||||
<button name="unlink_action" string="Remove context action" type="object"
|
<button name="unlink_action" string="Remove context action" type="object"
|
||||||
attrs="{'invisible':[('ref_ir_act_window','=',False)]}"
|
attrs="{'invisible':[('ref_ir_act_window','=',False)]}"
|
||||||
help="Remove the contextual action to use this template on related documents"/>
|
help="Remove the contextual action to use this template on related documents"/>
|
||||||
<button name="%(wizard_email_template_preview)d" string="Preview"
|
<button class="oe_inline oe_stat_button" name="%(wizard_email_template_preview)d" icon="fa-search-plus" string="Preview"
|
||||||
type="action" target="new"
|
type="action" target="new"
|
||||||
context="{'template_id':active_id}"/>
|
context="{'template_id':active_id}" widget="statinfo"/>
|
||||||
</div>
|
</div>
|
||||||
<notebook>
|
<notebook>
|
||||||
<page string="Mailing Template">
|
<page string="Mailing Template">
|
||||||
|
|
|
@ -98,7 +98,14 @@ class project_phase(osv.osv):
|
||||||
else:
|
else:
|
||||||
res[phase.id] = round(100.0 * done / tot, 2)
|
res[phase.id] = round(100.0 * done / tot, 2)
|
||||||
return res
|
return res
|
||||||
|
def _tasks_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
|
res = dict(map(lambda x: (x,0), ids))
|
||||||
|
try:
|
||||||
|
for task in self.browse(cr, uid, ids, context=context):
|
||||||
|
res[task.id] = len(task.task_ids)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return res
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char("Name", size=64, required=True),
|
'name': fields.char("Name", size=64, required=True),
|
||||||
'date_start': fields.datetime('Start Date', select=True, help="It's computed by the scheduler according the project date or the end date of the previous phase.", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
'date_start': fields.datetime('Start Date', select=True, help="It's computed by the scheduler according the project date or the end date of the previous phase.", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||||
|
@ -119,6 +126,7 @@ class project_phase(osv.osv):
|
||||||
help='If the phase is created the status \'Draft\'.\n If the phase is started, the status becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' status.\
|
help='If the phase is created the status \'Draft\'.\n If the phase is started, the status becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' status.\
|
||||||
\n If the phase is over, the status is set to \'Done\'.'),
|
\n If the phase is over, the status is set to \'Done\'.'),
|
||||||
'progress': fields.function(_compute_progress, string='Progress', help="Computed based on related tasks"),
|
'progress': fields.function(_compute_progress, string='Progress', help="Computed based on related tasks"),
|
||||||
|
'tasks_count': fields.function(_tasks_count, string='# Related Tasks', type='integer'),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
|
|
|
@ -152,7 +152,11 @@
|
||||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
<field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
<button name="%(project_phase_task_list)d" string="Related Tasks" type="action" class="oe_right"/>
|
<div class="oe_button_box oe_right">
|
||||||
|
<button class=" oe_inline oe_stat_button " name= "%(project_phase_task_list)d" type="action" icon="fa-tasks">
|
||||||
|
<field string="Related Tasks" name="tasks_count" widget="statinfo"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<label for="name" class="oe_edit_only"/>
|
<label for="name" class="oe_edit_only"/>
|
||||||
<h1><field name="name"/></h1>
|
<h1><field name="name"/></h1>
|
||||||
|
|
|
@ -26,15 +26,14 @@ class res_partner(osv.osv):
|
||||||
_inherit = 'res.partner'
|
_inherit = 'res.partner'
|
||||||
|
|
||||||
def _purchase_order_count(self, cr, uid, ids, field_name, arg, context=None):
|
def _purchase_order_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
res = dict(map(lambda x: (x,0), ids))
|
res = dict(map(lambda x: (x,{'purchase_order_count': 0, 'supplier_invoice_count': 0}), ids))
|
||||||
# this user may not have access to user rights
|
invoice_ids = self.pool.get('account.invoice').search(cr,uid, [('type', '=', 'in_invoice'), ('partner_id', '=', ids[0])])
|
||||||
try:
|
for partner in self.browse(cr, uid, ids, context=context):
|
||||||
for partner in self.browse(cr, uid, ids, context=context):
|
res[partner.id] = {
|
||||||
res[partner.id] = len(partner.purchase_order_ids)
|
'purchase_order_count': len(partner.purchase_order_ids),
|
||||||
except:
|
'supplier_invoice_count': len(invoice_ids),
|
||||||
pass
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def copy(self, cr, uid, id, default=None, context=None):
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
if default is None:
|
if default is None:
|
||||||
default = {}
|
default = {}
|
||||||
|
@ -53,8 +52,10 @@ class res_partner(osv.osv):
|
||||||
domain=[('type','=','purchase')],
|
domain=[('type','=','purchase')],
|
||||||
string="Purchase Pricelist",
|
string="Purchase Pricelist",
|
||||||
help="This pricelist will be used, instead of the default one, for purchases from the current partner"),
|
help="This pricelist will be used, instead of the default one, for purchases from the current partner"),
|
||||||
'purchase_order_count': fields.function(_purchase_order_count, string='# of Purchase Order', type='integer'),
|
'purchase_order_count': fields.function(_purchase_order_count, string='# of Purchase Order', type='integer', multi="count"),
|
||||||
'purchase_order_ids': fields.one2many('purchase.order','partner_id','Purchase Order')
|
'purchase_order_ids': fields.one2many('purchase.order','partner_id','Purchase Order'),
|
||||||
|
'invoice_ids': fields.one2many('account.invoice','partner_id','Supplier Invoices'),
|
||||||
|
'supplier_invoice_count': fields.function(_purchase_order_count, string='# Supplier Invoices', type='integer', multi="count"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,13 +74,15 @@
|
||||||
<field name="priority" eval="20"/>
|
<field name="priority" eval="20"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//div[@name='buttons']" position="inside">
|
<xpath expr="//div[@name='buttons']" position="inside">
|
||||||
<button name="%(purchase.act_res_partner_2_purchase_order)d" type="action"
|
<button class="oe_inline oe_stat_button" name="%(purchase.act_res_partner_2_purchase_order)d" type="action"
|
||||||
string="Purchase Orders"
|
|
||||||
attrs="{'invisible': [('supplier', '=', False)]}"
|
attrs="{'invisible': [('supplier', '=', False)]}"
|
||||||
groups="purchase.group_purchase_user"/>
|
groups="purchase.group_purchase_user" icon="fa-list-alt">
|
||||||
<button name="%(purchase.act_res_partner_2_supplier_invoices)d" type="action"
|
<field string="Purchase Orders" name="purchase_order_count" widget="statinfo"/>
|
||||||
attrs="{'invisible': [('supplier', '=', False)]}"
|
</button>
|
||||||
string="Supplier Invoices"/>
|
<button class="oe_inline oe_stat_button" name="%(purchase.act_res_partner_2_supplier_invoices)d" type="action"
|
||||||
|
attrs="{'invisible': [('supplier', '=', False)]}" icon="fa-pencil-square-o">
|
||||||
|
<field string="Supplier Invoices" name="supplier_invoice_count" widget="statinfo"/>
|
||||||
|
</button>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
Loading…
Reference in New Issue