[IMP] Product view

bzr revid: fp@tinyerp.com-20120903175410-d1434rw9cs3ekmo8
This commit is contained in:
Fabien Pinckaers 2012-09-03 19:54:10 +02:00
parent c09802208d
commit 3eaeda7144
3 changed files with 41 additions and 76 deletions

View File

@ -101,7 +101,7 @@
<field name="price_extra" groups="product.group_product_variant"/>
</group>
</group>
<field name="description" placeholder="describe the product's characteristics..."/>
<field name="description" placeholder="describe the product's characteristics for internal use..."/>
</page>
<page string="Procurements" groups="base.group_user">
<group name="procurement">
@ -177,7 +177,7 @@
</form>
</field>
<separator string="Notes on Quotations"/>
<field name="description_sale" placeholder="This note will be displayed on quotations..."/>
<field name="description_sale" placeholder="note to be displayed on quotations..."/>
</page>
</notebook>
</sheet>
@ -190,42 +190,30 @@
</record>
<!-- Product Kanban View -->
<record model="ir.ui.view" id="product_kanban_view">
<record model="ir.ui.view" id="product.product_kanban_view">
<field name="name">Product Kanban</field>
<field name="model">product.product</field>
<field name="arch" type="xml">
<kanban>
<field name="color"/>
<field name="type"/>
<field name="image_medium"/>
<field name="image_small"/>
<field name="list_price"/>
<templates>
<t t-name="kanban-box">
<t t-if="record.type.raw_value!='service' and record.qty_available.raw_value lte 0" t-set="border">oe_kanban_color_red</t>
<div t-attf-class="#{kanban_color(record.color.raw_value)} #{border || ''}">
<div class="oe_kanban_box oe_kanban_color_border">
<div class="oe_kanban_box_header oe_kanban_color_bgdark oe_kanban_color_border oe_kanban_draghandle oe_kanban_title">
<field name="name"/>
</div>
<div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger">
<img t-att-src="kanban_image('product.product', 'image_medium', record.id.value)" width="48" style="float: left; padding: 0 4px 4px 0"/>
Code: <field name="code"/>
<div t-if="record.type.raw_value == 'service'">No Stock</div>
<t t-if="record.type.raw_value != 'service'">
<div>Stock: <field name="qty_available"/> on hand, <field name="virtual_available"/> available</div>
<div t-if="record.list_price.raw_value != 0">Public Price: <field name="lst_price"/></div>
<!-- TODO would deserve to be hidden at the field level -->
<div groups="base.group_user">Cost : <field name="standard_price"/></div>
</t>
<div class="oe_kanban_clear"/>
</div>
<div class="oe_kanban_buttons_set oe_kanban_color_border oe_kanban_color_bglight oe_kanban_box_show_onclick">
<div class="oe_kanban_left">
<a string="Edit" icon="gtk-edit" type="edit"/>
<a string="Change Color" icon="color-picker" type="color" name="color"/>
</div>
<div class="oe_kanban_clear"/>
</div>
<div class="oe_kanban_vignette">
<a type="open"><img t-att-src="kanban_image('product.product', 'image_small', record.id.value)" class="oe_kanban_image"/></a>
<div class="oe_kanban_details">
<h4>
<a type="open">
<t t-if="record.code.raw_value">[<field name="code"/>]</t> <field name="name"/>
</a>
</h4>
<div name="tags"/>
<ul>
<li>Price: <field name="lst_price"></field></li>
</ul>
</div>
</div>
</t>
@ -255,7 +243,7 @@
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">tree,form,kanban</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_type">form</field>
<field name="context">{"search_default_filter_to_sell":1}</field>
<field name="view_id" ref="product_product_tree_view"/>
@ -278,7 +266,7 @@
<record id="open_view_product_tree1" model="ir.actions.act_window.view">
<field name="sequence" eval="2"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="product_product_tree_view"/>
<field name="view_id" ref="product_product_tree_view"/>
<field name="act_window_id" ref="product_normal_action_sell"/>
</record>
@ -292,8 +280,8 @@
<record id="open_view_product_kanban1" model="ir.actions.act_window.view">
<field name="sequence" eval="1"/>
<field name="view_mode">kanban</field>
<field name="view_id" ref="product_kanban_view"/>
<field name="act_window_id" ref="product_normal_action"/>
<field name="view_id" ref="product_kanban_view"/>
<field name="act_window_id" ref="product_normal_action_sell"/>
</record>
<menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/>

View File

@ -32,7 +32,7 @@ class product_product(osv.osv):
moves = move_pool.read_group(cr, uid, [
('product_id', 'in', ids),
('picking_id.type', '=', 'in'),
('state','in',('draft','confirmed','assigned','pending'))
('state','in',('confirmed','assigned','pending'))
], ['product_id'], ['product_id'])
for move in moves:
product_id = move['product_id'][0]
@ -40,7 +40,7 @@ class product_product(osv.osv):
moves = move_pool.read_group(cr, uid, [
('product_id', 'in', ids),
('picking_id.type', '=', 'out'),
('state','in',('draft','confirmed','assigned','pending'))
('state','in',('confirmed','assigned','pending'))
], ['product_id'], ['product_id'])
for move in moves:
product_id = move['product_id'][0]
@ -373,7 +373,7 @@ class product_product(osv.osv):
"typed as 'internal'."),
'virtual_available': fields.function(_product_available, multi='qty_available',
type='float', digits_compute=dp.get_precision('Product Unit of Measure'),
string='Quantity Available',
string='Future Quantity',
help="Forecast quantity (computed as Quantity On Hand "
"- Outgoing + Incoming)\n"
"In a context with a single Stock Location, this includes "

View File

@ -183,50 +183,27 @@
</field>
</record>
<record model="ir.ui.view" id="product.product_kanban_view">
<field name="name">Product Kanban</field>
<record model="ir.ui.view" id="product_kanban_stock_view">
<field name="name">Product Kanban Stock</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_kanban_view"/>
<field name="arch" type="xml">
<kanban>
<field name="color"/>
<field name="type"/>
<field name="image_medium"/>
<field name="list_price"/>
<field name="list_price" position="after">
<field name="reception_count"/>
<field name="delivery_count"/>
<templates>
<t t-name="kanban-box">
<div class="oe_product_vignette">
<div class="oe_product_img">
<a type="open"><img t-att-src="kanban_image('product.product', 'image_medium', record.id.value)" class="oe_product_photo"/></a>
</div>
<div class="oe_product_desc">
<h4><a type="open"><field name="name"></field></a></h4>
<ul>
<li t-if="record.code.raw_value">Code: <field name="code"/></li>
<li t-if="record.type.raw_value != 'service'">Stock on hand: <field name="qty_available"/> <field name="uom_id"/></li>
<li t-if="record.type.raw_value != 'service'">Stock available: <field name="virtual_available"/> <field name="uom_id"/></li>
<li>Price: <field name="lst_price"></field></li>
<!-- TODO the 'groups' attribute doesn't work in kanban views -->
<li groups="base.group_user">Cost: <field name="standard_price"></field></li>
</ul>
<div groups="base.group_user">
<a name="%(action_receive_move)d" type="action">
<t t-if="record.reception_count.value">Receptions(<t t-esc="record.reception_count.value"/>)</t>
</a>
<a name="%(action_deliver_move)d" type="action">
<t t-if="record.delivery_count.value">Deliveries(<t t-esc="record.delivery_count.value"/>)</t>
</a>
</div>
</div>
</div>
<script>
$('.oe_product_photo').load(function() { if($(this).width() > $(this).height()) { $(this).addClass('oe_product_photo_wide') } });
</script>
<div></div>
</t>
</templates>
</kanban>
</field>
<xpath expr="//div[@name='tags']" position="inside">
<a name="%(action_receive_move)d" type="action" t-if="record.reception_count.raw_value>0">
<t t-esc="record.reception_count.value"/> Receptions
</a>
<a name="%(action_deliver_move)d" type="action" t-if="record.delivery_count.raw_value>0">
<t t-esc="record.delivery_count.value"/> Deliveries
</a>
</xpath>
<ul position="inside">
<li t-if="record.type.raw_value != 'service'">On hand: <field name="qty_available"/> <field name="uom_id"/></li>
<li t-if="record.type.raw_value != 'service'">Available: <field name="virtual_available"/> <field name="uom_id"/></li>
</ul>
</field>
</record>