[IMP] misc improvements

bzr revid: fp@openerp.com-20130224132436-4ehr5f1uidtbuo9m
This commit is contained in:
Fabien Pinckaers 2013-02-24 14:24:36 +01:00
commit fb00c370b2
20 changed files with 121 additions and 101 deletions

View File

@ -334,11 +334,11 @@
<label for="currency_id" groups="base.group_multi_currency"/>
<div groups="base.group_multi_currency">
<field name="currency_id" class="oe_inline"/>
<!-- note fp: I don't think we need this feature ?
<button name="%(action_account_change_currency)d" type="action"
icon="terp-stock_effects-object-colorize"
class="oe_inline oe_link oe_edit_only"
string="(change)"
attrs="{'invisible':[('state','!=','draft')]}"
groups="account.group_account_user"/> -->
groups="account.group_account_user"/>
</div>
</group>
</group>

View File

@ -68,6 +68,22 @@
<field name="search_view_id" ref="view_account_analytic_default_form_search"/>
<field name="context">{"search_default_current":1}</field>
</record>
<record id="action_product_default_list" model="ir.actions.act_window">
<field name="name">Analytic Defaults</field>
<field name="res_model">account.analytic.default</field>
<field name="context">{'search_default_product_id': [active_id], 'default_product_id': active_id}</field>
</record>
<record model="ir.ui.view" id="product_form_view_default_analytic_button">
<field name="name">product.product.stock.move</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Analytic Rules" name= "%(action_product_default_list)d" type="action" groups="analytic.group_analytic_accounting" />
</xpath>
</field>
</record>
<act_window
name="Entries"
@ -99,13 +115,5 @@
context="{'search_default_user_id': [active_id], 'default_user_id': active_id}"
groups="analytic.group_analytic_accounting"/>
<act_window
name="Analytic Rules"
res_model="account.analytic.default"
id="analytic_rule_action_product"
src_model="product.product"
context="{'search_default_product_id': [active_id], 'default_product_id': active_id}"
groups="analytic.group_analytic_accounting"/>
</data>
</openerp>

View File

@ -93,6 +93,10 @@ class hr_job(osv.osv):
_inherit = ['mail.thread']
_columns = {
'name': fields.char('Job Name', size=128, required=True, select=True),
# TO CLEAN: when doing a cleaning, we should change like this:
# no_of_recruitment: a function field
# expected_employees: float
# This would allow a clean update when creating new employees.
'expected_employees': fields.function(_no_of_employee, string='Total Forecasted Employees',
help='Expected number of employees for this job position after new recruitment.',
store = {
@ -146,6 +150,7 @@ class hr_employee(osv.osv):
_name = "hr.employee"
_description = "Employee"
_inherits = {'resource.resource': "resource_id"}
_inherit = ['mail.thread']
def _get_image(self, cr, uid, ids, name, args, context=None):
result = dict.fromkeys(ids, False)

View File

@ -84,6 +84,10 @@
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>

View File

@ -116,7 +116,10 @@ class hr_holidays(osv.osv):
},
}
def _employee_get(self, cr, uid, context=None):
def _employee_get(self, cr, uid, context=None):
emp_id = context.get('default_employee_id', False)
if emp_id:
return emp_id
ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if ids:
return ids[0]
@ -203,9 +206,9 @@ class hr_holidays(osv.osv):
leave_ids = obj_res_leave.search(cr, uid, [('holiday_id', 'in', ids)], context=context)
return obj_res_leave.unlink(cr, uid, leave_ids, context=context)
def onchange_type(self, cr, uid, ids, holiday_type):
result = {'value': {'employee_id': False}}
if holiday_type == 'employee':
def onchange_type(self, cr, uid, ids, holiday_type, employee_id=False, context=None):
result = {}
if holiday_type == 'employee' and not employee_id:
ids_employee = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
if ids_employee:
result['value'] = {

View File

@ -78,7 +78,7 @@
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'invisible':[('holiday_type','=','employee')], 'readonly':[('state','!=','draft'), ('state','!=','confirm')]}"/>
</group>
<group>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130" string="Mode" groups="base.group_hr_user"/>
<field name="holiday_type" on_change="onchange_type(holiday_type, employee_id)" attrs="{'readonly':[('state','!=','draft')]}" width="130" string="Mode" groups="base.group_hr_user"/>
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')],'invisible':[('holiday_type','=','category')]}" on_change="onchange_employee(employee_id)" groups="base.group_hr_user"/>
<field name="department_id" attrs="{'readonly':[('holiday_type','=','category')]}" groups="base.group_hr_user"/>
</group>
@ -206,7 +206,8 @@
<field name="arch" type="xml">
<tree colors="red:state == 'refuse';blue:state == ' draft';black:state in ('confirm','validate','validate1')" string="Leave Requests">
<field name="employee_id"/>
<field name="holiday_type" string="Mode" groups="base.group_hr_user"/>
<field name="holiday_type" string="Mode" groups="base.group_no_one"/>
<field name="holiday_status_id"/>
<field name="name"/>
<field name="date_from"/>
<field name="date_to"/>
@ -214,7 +215,6 @@
<field name="state"/>
<field name="category_id" invisible="1"/>
<field name="department_id" invisible="not context.get('set_visible',False)"/>
<field name="holiday_status_id" invisible="1"/>
<field name="manager_id" invisible="1"/>
<field name="user_id" invisible="1"/>
</tree>

View File

@ -420,12 +420,13 @@ class hr_applicant(base_stage, osv.Model):
act_window = self.pool.get('ir.actions.act_window')
emp_id = False
for applicant in self.browse(cr, uid, ids, context=context):
address_id = False
address_id = contact_name = False
if applicant.partner_id:
address_id = self.pool.get('res.partner').address_get(cr,uid,[applicant.partner_id.id],['contact'])['contact']
if applicant.job_id:
contact_name = self.pool.get('res.partner').name_get(cr,uid,[applicant.partner_id.id])[0][1]
if applicant.job_id and (applicant.partner_name or contact_name):
applicant.job_id.write({'no_of_recruitment': applicant.job_id.no_of_recruitment - 1})
emp_id = hr_employee.create(cr,uid,{'name': applicant.partner_name or applicant.name,
emp_id = hr_employee.create(cr,uid,{'name': applicant.partner_name or contact_name,
'job_id': applicant.job_id.id,
'address_home_id': address_id,
'department_id': applicant.department_id.id
@ -433,7 +434,7 @@ class hr_applicant(base_stage, osv.Model):
self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context)
self.case_close(cr, uid, [applicant.id], context)
else:
raise osv.except_osv(_('Warning!'), _('You must define Applied Job for this applicant.'))
raise osv.except_osv(_('Warning!'), _('You must define an Applied Job and a Contact Name for this applicant.'))
action_model, action_id = model_data.get_object_reference(cr, uid, 'hr', 'open_view_employee_list')
dict_act_window = act_window.read(cr, uid, action_id, [])

View File

@ -10,3 +10,4 @@ access_hr_recruitment_source_hr_officer,hr.recruitment.source,model_hr_recruitme
access_hr_recruitment_source_all,hr.recruitment.source,model_hr_recruitment_source,,1,0,0,0
access_hr_applicant_category,hr.applicant_category,model_hr_applicant_category,,1,1,1,0
access_hr_applicant_category_manager,hr.applicant_category,model_hr_applicant_category,base.group_hr_manager,1,1,1,1
access_crm_meeting_type_hr_officer,crm.meeting.type.officer,base_calendar.model_crm_meeting_type,base.group_hr_user,1,1,1,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
10 access_hr_recruitment_source_all hr.recruitment.source model_hr_recruitment_source 1 0 0 0
11 access_hr_applicant_category hr.applicant_category model_hr_applicant_category 1 1 1 0
12 access_hr_applicant_category_manager hr.applicant_category model_hr_applicant_category base.group_hr_manager 1 1 1 1
13 access_crm_meeting_type_hr_officer crm.meeting.type.officer base_calendar.model_crm_meeting_type base.group_hr_user 1 1 1 0

View File

@ -69,6 +69,7 @@
<field name="date"/>
<field name="order_line_ids"/>
<filter name='is_mine' string="My Orders" domain="[('user_id','=',uid)]"/>
<filter name='by_users' string="Users" context="{'group_by':'user_id'}"/>
</search>
</field>
</record>
@ -304,6 +305,7 @@
<field name="arch" type="xml">
<tree string="Orders Tree">
<field name="date"/>
<field name='user_id'/>
<field name="order_line_ids"/>
<field name="state" />
<field name="total" sum="Total"/>

View File

@ -980,26 +980,6 @@
</field>
</record>
<act_window
context="{'search_default_product_id': [active_id]}"
id="act_product_manufacturing_open"
name="Manufacturing Orders"
view_id="mrp_production_tree_view"
res_model="mrp.production"
src_model="product.product"/>
<act_window
id="action_product_bom_structure"
name="Product BoM Structure"
domain="[('product_id', 'in', active_ids),('bom_id','=',False)]"
context="{'default_product_id': active_id}"
view_type="tree"
view_mode="tree"
view_id="mrp_bom_tree_view"
res_model="mrp.bom"
src_model="product.product"
groups="mrp.group_mrp_user"/>
<!-- Menu for Resource for MRP-->
<record id="mrp_workcenter_action" model="ir.actions.act_window">
@ -1034,21 +1014,33 @@
id="menu_mrp_production_order_action" name="Order Planning"
parent="menu_mrp_planning" sequence="1"/>
<record id="act_product_mrp_bom_open" model="ir.actions.act_window">
<field name="name">BoM Structure</field>
<field name="context">{'default_product_id': active_id}</field>
<field name="domain">[('product_id', 'in', active_ids),('bom_id','=',False)]</field>
<field name="res_model">mrp.bom</field>
</record>
<record model="ir.actions.act_window" id="product_open_bom">
<field name="context">{'default_product_id': active_id, 'search_default_product_id': active_id}</field>
<field name="name">Bill of Materials</field>
<field name="domain">[('bom_id','=',False)]</field>
<field name="res_model">mrp.bom</field>
</record>
<record id="act_product_mrp_production" model="ir.actions.act_window">
<field name="context">{'search_default_product_id': [active_id]}</field>
<field name="name">Manufacturing Orders</field>
<field name="res_model">mrp.production</field>
<field name="view_id" ref="mrp_production_tree_view"/>
</record>
<record model="ir.ui.view" id="product_form_view_bom_button">
<field name="name">product.product.procurement</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Bill of Materials" name="%(product_open_bom)d" type="action"/>
<button string="Bill of Materials" name="%(product_open_bom)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
<button string="BoM Structure" name="%(act_product_mrp_bom_open)d" type="action" groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}"/>
<button string="Manufacturing Orders" name="%(act_product_mrp_production)d" type="action" groups="mrp.group_mrp_user" attrs="{'invisible':[('type', '=', 'service')]}"/>
</xpath>
</field>
</record>

View File

@ -312,11 +312,13 @@
<record model="ir.ui.view" id="product_form_view_procurement_button">
<field name="name">product.product.procurement</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='incoming_qty']" position="after">
<button string="⇒ Request Procurement" name="%(act_make_procurement)d" type="action" class="oe_link"/>
</xpath>
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Request Procurement" name="%(act_make_procurement)d" type="action"/>
<button string="Orderpoints" name="%(product_open_orderpoint)d" type="action"/>
<button string="Orderpoints" name="%(product_open_orderpoint)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}"/>
</xpath>
<xpath expr="//field[@name='cost_method']" position="before">
<field name="procure_method" groups="base.group_user"/>

View File

@ -34,7 +34,7 @@ class project_configuration(osv.osv_memory):
This installs the module project_mrp."""),
'module_pad': fields.boolean("Use integrated collaborative note pads on task",
help="""Lets the company customize which Pad installation should be used to link to new pads
(by default, http://ietherpad.com/).
(for example: http://ietherpad.com/).
This installs the module pad."""),
'module_project_timesheet': fields.boolean("Record timesheet lines per tasks",
help="""This allows you to transfer the entries under tasks defined for Project Management to

View File

@ -334,8 +334,8 @@
<field name="name">Quotations</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="context">{'search_default_draft': 1, 'search_default_to_approve': 1}</field>
<field name="domain">[('state','in',('draft','sent','confirmed'))]</field>
<field name="context">{}</field>
<field name="domain">[('state','in',('draft','sent','cancel'))]</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="search_view_id" ref="view_purchase_order_filter"/>
<field name="help" type="html">
@ -492,15 +492,6 @@
</field>
</record>
<act_window
context="{'search_default_product_id': [active_id], 'default_product_id': active_id}"
id="action_purchase_line_product_tree"
name="Purchases"
res_model="purchase.order.line"
src_model="product.product"
groups="purchase.group_purchase_user"/>
<record id="purchase_line_form_action2" model="ir.actions.act_window">
<field name="name">On Purchase Order Lines</field>
<field name="type">ir.actions.act_window</field>
@ -613,12 +604,20 @@
</field>
</field>
</record>
<record model="ir.actions.act_window" id="action_purchase_line_product_tree">
<field name="context">{'search_default_product_id': active_id, 'default_product_id': active_id}</field>
<field name="name">Purchases</field>
<field name="res_model">purchase.order.line</field>
<field name="view_id" ref="purchase_order_line_tree"/>
</record>
<record id="view_product_account_purchase_ok_form" model="ir.ui.view">
<field name="name">product.account.purchase.ok.form.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="account.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Purchases" name="%(action_purchase_line_product_tree)d" type="action" groups="purchase.group_purchase_user"/>
</xpath>
<xpath expr="//field[@name='property_account_expense']" position="replace" >
<field name="property_account_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" groups="account.group_account_user"/>
</xpath>
@ -627,6 +626,5 @@
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -49,7 +49,7 @@
name="view_picking"
string="Incoming Shipments" states="approved"/>
<button type="object" name="invoice_open"
string="Invoices" attrs="{'invisible': [('state', '=', 'draft')]}"/>
string="Invoices" attrs="{'invisible': [('state', 'in', ['draft','sent'])]}"/>
</div>
</xpath>
</field>

View File

@ -538,15 +538,22 @@
<field name="domain">[('invoiced','&lt;&gt;', 1),('state','=','done')]</field>
<field name="filter" eval="True"/>
</record>
<act_window
context="{'search_default_product_id': active_id, 'default_product_id': active_id}"
id="action_order_line_product_tree"
name="Sales Order Lines"
res_model="sale.order.line"
src_model="product.product"
groups="base.group_sale_salesman"/>
<record id="action_order_line_product_tree" model="ir.actions.act_window">
<field name="context">{'search_default_product_id': active_id, 'default_product_id': active_id}</field>
<field name="name">Sales Order Lines</field>
<field name="res_model">sale.order.line</field>
<field name="view_id" ref="view_order_line_tree"/>
</record>
<record model="ir.ui.view" id="product_form_view_sale_order_button">
<field name="name">product.product.sale.order</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Sales" name="%(action_order_line_product_tree)d" type="action" groups="base.group_sale_salesman"/>
</xpath>
</field>
</record>
<menuitem id="base.menu_invoiced" name="Invoicing" parent="base.menu_base_partner" sequence="5"/>
<menuitem id="menu_invoicing_sales_order_lines" parent="base.menu_invoiced" action="action_order_line_tree2" sequence="10" groups="sale.group_invoice_so_lines"/>

View File

@ -78,7 +78,7 @@ class sale_advance_payment_inv(osv.osv_memory):
result = []
for sale in sale_obj.browse(cr, uid, sale_ids, context=context):
val = inv_line_obj.product_id_change(cr, uid, [], wizard.product_id.id,
uom_id=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id)
False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id)
res = val['value']
# determine and check income account
@ -86,7 +86,7 @@ class sale_advance_payment_inv(osv.osv_memory):
prop = ir_property_obj.get(cr, uid,
'property_account_income_categ', 'product.category', context=context)
prop_id = prop and prop.id or False
account_id = fiscal_obj.map_account(cr, uid, sale.fiscal_position.id or False, prop_id)
account_id = fiscal_obj.map_account(cr, uid, sale.fiscal_position or False, prop_id)
if not account_id:
raise osv.except_osv(_('Configuration Error!'),
_('There is no income account defined as global property.'))

View File

@ -235,6 +235,8 @@ class product_product(osv.osv):
else:
location_ids = []
wids = warehouse_obj.search(cr, uid, [], context=context)
if not wids:
return res
for w in warehouse_obj.browse(cr, uid, wids, context=context):
location_ids.append(w.lot_stock_id.id)

View File

@ -68,6 +68,10 @@
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='buttons']" position="inside">
<button string="Inventory" name="%(action_product_location_tree)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_locations"/>
<button string="Moves" name= "%(act_product_stock_move_open)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_stock_user"/>
</xpath>
<group name="procurement_uom" position="before">
<group name="delay" string="Delays">
<label for="produce_delay" attrs="{'invisible':[('type','=','service')]}"/>
@ -88,13 +92,16 @@
<label for="qty_available"/>
<div>
<field name="qty_available" class="oe_inline"/>
<button name="%(action_view_change_product_quantity)d" string="update"
type="action"
class="oe_link"/>
<button name="%(action_view_change_product_quantity)d" string="⇒ Update"
type="action"
class="oe_link"/>
</div>
<label for="incoming_qty"/>
<div>
<field name="incoming_qty" class="oe_inline"/>
<field name="outgoing_qty" class="oe_inline"/>
<field name="virtual_available" class="oe_inline"/>
</div>
<field name="outgoing_qty" class="oe_inline"/>
<field name="virtual_available" class="oe_inline"/>
</group>
<group name="lot" groups="stock.group_tracking_lot,stock.group_production_lot" string="Lots">
<field name="track_production" groups="stock.group_production_lot"/>

View File

@ -2,13 +2,6 @@
<openerp>
<data>
<act_window
context="{'product_id': active_id}"
id="act_stock_product_location_open"
name="Stock by Location"
res_model="stock.location"
src_model="product.product"/>
<act_window
domain="[('tracking_id', '=', active_id)]"
id="act_stock_tracking_lot_2_stock_report_tracklots"

View File

@ -632,6 +632,16 @@
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_product_location_tree">
<field name="context">{'product_id': active_id}</field>
<field name="name">Stock by Location</field>
<field name="res_model">stock.location</field>
</record>
<record id="act_product_stock_move_open" model="ir.actions.act_window">
<field name="context">{'search_default_done': 1,'search_default_product_id': active_id, 'default_product_id': active_id}</field>
<field name="name">Moves</field>
<field name="res_model">stock.move</field>
</record>
<record id="action_location_tree" model="ir.actions.act_window">
<field name="name">Location Structure</field>
<field name="res_model">stock.location</field>
@ -1562,21 +1572,6 @@
res_model="product.product"
src_model="stock.location"/>
<act_window
context="{'search_default_done': 1,'search_default_product_id': [active_id], 'default_product_id': active_id}"
id="act_product_stock_move_open"
name="Inventory Move"
res_model="stock.move"
src_model="product.product"/>
<act_window
context="{'search_default_future': 1,'search_default_product_id': [active_id], 'default_product_id': active_id}"
domain="[('state','in',('waiting','confirmed','assigned'))]"
id="act_product_stock_move_futur_open"
name="Future Stock Moves"
res_model="stock.move"
src_model="product.product"/>
<record id="ir_act_product_location_open" model="ir.values">
<field name="key2">tree_but_open</field>
<field name="model">stock.location</field>