[MERGE] stock_landed_costs: better usability

bzr revid: qdp-launchpad@openerp.com-20140425124634-9bxzm92hx0di5ogy
This commit is contained in:
Quentin (OpenERP) 2014-04-25 14:46:34 +02:00
commit f36b470c1b
6 changed files with 122 additions and 5 deletions

View File

@ -38,6 +38,7 @@
],
'data': [
'security/ir.model.access.csv',
'stock_landed_costs_sequence.xml',
'product_view.xml',
'stock_landed_costs_view.xml',
'stock_landed_costs_data.xml',

View File

@ -12,8 +12,7 @@
<label for="landed_cost_ok"/>
</div>
<xpath expr="//group[@name='properties']" position="before">
<group>
<separator string="Split Method" colspan="4"/>
<group attrs="{'invisible':[('landed_cost_ok','=',False)]}">
<group colspan="2" col="2">
<field name="split_method"/>
</group>

View File

@ -82,7 +82,7 @@ class stock_landed_cost(osv.osv):
return {'value': result}
_columns = {
'name': fields.char('Name', size=256, required=True, states={'done': [('readonly', True)]}, track_visibility='always'),
'name': fields.char('Name', size=256, track_visibility='always', readonly=True),
'date': fields.date('Date', required=True, states={'done': [('readonly', True)]}, track_visibility='onchange'),
'picking_ids': fields.many2many('stock.picking', string='Pickings', states={'done': [('readonly', True)]}),
'cost_lines': fields.one2many('stock.landed.cost.lines', 'cost_id', 'Cost Lines', states={'done': [('readonly', True)]}),
@ -100,6 +100,7 @@ class stock_landed_cost(osv.osv):
}
_defaults = {
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'stock.landed.cost'),
'state': 'draft',
'date': fields.date.context_today,
}

View File

@ -4,9 +4,9 @@
<!-- Stock landed costs - related subtypes for messaging / Chatter -->
<record id="mt_stock_landed_cost_open" model="mail.message.subtype">
<field name="name">Open</field>
<field name="name">Done</field>
<field name="res_model">stock.landed.cost</field>
<field name="description">Landed cost is opened</field>
<field name="description">Landed cost validated</field>
</record>
</data>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="seq_type_stock_landed_costs" model="ir.sequence.type">
<field name="name">Stock Landed Costs</field>
<field name="code">stock.landed.cost</field>
</record>
<record id="seq_stock_landed_costs" model="ir.sequence">
<field name="name">Stock Landed Costs</field>
<field name="code">stock.landed.cost</field>
<field name="prefix">LC/%(year)s/</field>
<field name="padding">4</field>
</record>
</data>
</openerp>

View File

@ -158,5 +158,105 @@
<menuitem name="Landed Costs" parent="stock.menu_stock_root" id="menu_stock_landed_cost_main" sequence="1"/>
<menuitem action="action_stock_landed_cost" name="Landed Costs" parent="menu_stock_landed_cost_main" id="menu_stock_landed_cost" sequence="1"/>
<!-- Stock Landed Cost Type View -->
<record id="view_stock_landed_cost_type_form" model="ir.ui.view">
<field name="name">stock.landed.cost.type.form</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<form string="Landed Costs" version="7.0">
<sheet>
<field name="is_only_child" invisible="1"/>
<field name="image_medium" widget="image" class="oe_avatar oe_left"
attrs="{'readonly': [('is_only_child', '=', False)]}"/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" name='label_name' string="Product Name"
attrs="{'invisible': [('is_only_child', '=', False)]}"/>
</div>
<h1>
<field name="name" class="oe_inline"
attrs="{'required': [('is_only_child', '=', True)],
'invisible': [('is_only_child', '=', False)]}"/>
</h1>
<label for="categ_id" class="oe_edit_only"/>
<h2><field name="categ_id" attrs="{'readonly': [('is_only_child', '=', False)]}"/></h2>
<div name="options" groups="base.group_user">
<field name="landed_cost_ok" readonly="1"/>
<label for="landed_cost_ok"/>
<field name="active" />
<label for="active"/>
</div>
</div>
<notebook>
<page string="Information">
<group>
<group>
<field name="split_method"/>
<field name="standard_price"/>
<field name="property_account_expense"/>
</group>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"
attrs="{'invisible': [('is_only_child', '=', False)]}"/>
<field name="type" attrs="{'invisible': [('is_only_child', '=', False)]}"/>
</group>
</group>
<field name="description" placeholder="describe the product characteristics..."
attrs="{'readonly': [('is_only_child', '=', False)]}"/>
</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>
<!-- Stock Landed Cost Type Tree View -->
<record id="stock_landed_cost_tree_view" model="ir.ui.view">
<field name="name">product.product.tree</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<tree string="Products">
<field name="name"/>
<field name="split_method"/>
<field name="standard_price"/>
</tree>
</field>
</record>
<record id="stock_landed_cost_type_action" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="domain">[('landed_cost_ok','=',True)]</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'default_landed_cost_ok': True}</field>
<field name="search_view_id" ref="product.product_search_form_view"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new kind of landed cost.
</p>
</field>
</record>
<record id="stock_landed_cost_type_action1" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="stock_landed_cost_tree_view"/>
<field name="act_window_id" ref="stock_landed_cost_type_action"/>
</record>
<record id="stock_landed_cost_type_action2" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_stock_landed_cost_type_form"/>
<field name="act_window_id" ref="stock_landed_cost_type_action"/>
</record>
<menuitem action="stock_landed_cost_type_action" name="Landed Cost Type" parent="stock.menu_stock_configuration" id="menu_stock_landed_cost_type" sequence="1"/>
</data>
</openerp>