[IMP] Improved design for sale and sale_layout

bzr revid: fp@tinyerp.com-20111108111102-u49mm19xv16ze39r
This commit is contained in:
Fabien Pinckaers 2011-11-08 12:11:02 +01:00
parent 2684803fad
commit c3cc9bdf5d
4 changed files with 83 additions and 49 deletions

View File

@ -119,40 +119,51 @@
<form string="Sales Order Lines">
<notebook>
<page string="Order Line">
<field colspan="4" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position, False, context)"/>
<group colspan="4" col="5">
<field colspan="3"
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
name="product_id"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position, False, context)"/>
<field name="name"/>
<field
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
name="product_uom_qty"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, True, context)"/>
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, context)"/>
<field name="product_uom"
on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, context)"
nolabel="1"/>
<field name="price_unit"/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field groups="product.group_uos" name="product_uos"/>
<field name="product_packaging" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_id','=',product_id)]" groups="base.group_extended"/>
<field colspan="4" name="name"/>
<field name="price_unit"/>
<field name="discount"/>
<field name="type" groups="base.group_extended"/>
<field name="delay" groups="base.group_extended"/>
<newline/>
<field name="product_packaging"
context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}" on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)"
domain="[('product_id','=',product_id)]" groups="base.group_extended"
colspan="3"/>
<field name="discount"/>
<separator colspan="5" string="Notes"/>
<field colspan="5" name="notes" nolabel="1"/>
<separator colspan="5" string="Taxes"/>
<field colspan="4" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
<group colspan="4" col="5" groups="base.group_extended">
<field colspan="5" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]"/>
<group colspan="5" col="5" groups="base.group_extended">
<separator colspan="5" string="States"/>
<field name="state"/>
<field name="invoiced"/>
<group attrs="{'invisible':[('invoiced','=',True)]}">
<button colspan="1" name="%(action_view_sale_order_line_make_invoice)d" states="confirmed" string="Make Invoices" type="action" icon="terp-document-new"/>
</group>
<button colspan="1" name="%(action_view_sale_order_line_make_invoice)d" states="confirmed" string="Make Invoices" type="action" icon="terp-document-new"/>
</group>
</group>
</group>
</page>
<page groups="base.group_extended" string="Extra Info">
<field name="type"/>
<field name="delay"/>
<field name="th_weight"/>
<field name="address_allotment_id"/>
<field name="property_ids" colspan="4"/>
</page>
<page string="Notes">
<field colspan="4" name="notes" nolabel="1"/>
</page>
<page string="History" groups="base.group_extended">
<separator colspan="4" string="Invoice Lines"/>
<field colspan="4" name="invoice_lines" nolabel="1"/>

View File

@ -117,8 +117,8 @@ class sale_order_line(osv.osv):
('subtotal', 'Sub Total'),
('line', 'Separator Line'),
('break', 'Page Break'),]
,'Layout Type', select=True, required=True),
'sequence': fields.integer('Layout Sequence'),
,'Line Type', select=True, required=True),
'sequence': fields.integer('Line Sequence'),
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}),
'product_uom_qty': fields.float('Quantity (UoM)', digits=(16,2)),
'product_uom': fields.many2one('product.uom', 'Product UoM'),

View File

@ -14,60 +14,83 @@
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='order_line']" position="replace">
<field name="abstract_line_ids" colspan="4" nolabel="1" widget="one2many_list">
<form string="Sale Order Lines">
<form string="Order Line">
<notebook>
<page string="Order Line">
<separator colspan="4" string="Automatic Declaration"/>
<field colspan="4"
<group colspan="4" col="5">
<field name="layout_type" on_change="onchange_sale_order_line_view(layout_type)"/>
<field name="sequence" groups="base.group_extended"/>
</group>
<group colspan="4" col="5">
<field colspan="3"
context="{'partner_id':parent.partner_id,'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}"
name="product_id"
attrs="{'readonly':[('layout_type','!=','article')]}"
attrs="{'invisible':[('layout_type','!=','article')]}"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position, False, context)"
select="1"/>
<field
name="name" required="0"
attrs="{'invisible':[('layout_type','in',('line','break','subtotal'))], 'required':[('layout_type','not in',['line','break'])]}"/>
<field
context="{'partner_id':parent.partner_id,'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}"
name="product_uom_qty"
attrs="{'readonly':[('layout_type','!=','article')]}"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, True, context)"
select="1"/>
attrs="{'invisible':[('layout_type','!=','article')]}"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, True, context)"/>
<field name="product_uom"
required="0"
attrs="{'readonly':[('layout_type','!=','article')], 'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}"
nolabel="1"
required="0"
attrs="{'invisible':[('layout_type','!=','article')], 'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}"
on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, context)"/>
<field name="price_unit"
attrs="{'invisible':[('layout_type','!=','article')],'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}"/>
<field groups="product.group_uos" name="product_uos_qty" on_change="uos_change(product_uos, product_uos_qty, product_id)"/>
<field groups="product.group_uos" name="product_uos"/>
<newline/>
<field
name="product_packaging"
attrs="{'readonly':[('layout_type','!=','article')]}"
colspan="3"
attrs="{'invisible':[('layout_type','!=','article')]}"
context="{'partner_id':parent.partner_id,'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}"
on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)"
domain="[('product_id','=',product_id)]"
groups="base.group_extended"/>
<separator colspan="4" string="Manual Description" />
<field name="layout_type" on_change="onchange_sale_order_line_view(layout_type)"/>
<field name="sequence" string="Seq."/>
<field colspan="4" name="name" required="0" select="2" attrs="{'readonly':[('layout_type','in',('line','break'))], 'required':[('layout_type','not in',['line','break'])]}"/>
<field name="price_unit" select="2" attrs="{'readonly':[('layout_type','!=','article')],'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}"/>
<field name="discount" attrs="{'readonly':[('layout_type','!=','article')]}"/>
<field name="type" attrs="{'readonly':[('layout_type','!=','article')]}"/>
<field name="delay" select="2" attrs="{'readonly':[('layout_type','!=','article')]}"/>
<field colspan="4" name="tax_id" domain="[('parent_id','=',False)]" attrs="{'readonly':[('layout_type','!=','article')]}"/>
<separator colspan="4" string="States"/>
<field name="state" select="2"/>
<group col="3" colspan="2">
<field name="invoiced" select="2"/>
<field
name="discount"
attrs="{'invisible':[('layout_type','!=','article')]}"/>
<group colspan="5"
attrs="{'invisible':[('layout_type','not in', ['article','text'])]}">
<separator colspan="4" string="Notes"/>
<field colspan="4" name="notes" nolabel="1"/>
</group>
<group colspan="5"
attrs="{'invisible':[('layout_type','!=','article')]}">
<separator colspan="4" string="Taxes"/>
<field colspan="4" name="tax_id" domain="[('parent_id','=',False)]" nolabel="1"/>
</group>
<group col="5" colspan="5" attrs="{'invisible':[('layout_type','!=','article')]}">
<separator colspan="5" string="States"/>
<field name="state"/>
<field name="invoiced"/>
<button colspan="1" name="%(sale.action_view_sale_order_line_make_invoice)d" states="confirmed" string="Make Invoice" type="action"/>
</group>
</group>
</page>
<page groups="base.group_extended" string="Extra Info">
<field groups="product.group_uos" name="product_uos_qty" on_change="uos_change(product_uos, product_uos_qty, product_id)"/>
<field groups="product.group_uos" name="product_uos"/>
<page groups="base.group_extended" string="Extra Info"
attrs="{'invisible':[('layout_type','!=','article')]}">
<field name="type" attrs="{'invisible':[('layout_type','!=','article')]}"/>
<field name="delay" select="2" attrs="{'invisible':[('layout_type','!=','article')]}"/>
<field name="address_allotment_id" select="2"/>
<separator colspan="4" string="Properties"/>
<field colspan="4" name="property_ids" nolabel="1"/>
</page>
<page string="Notes">
<field colspan="4" name="notes" nolabel="1"/>
</page>
<page string="History" groups="base.group_extended">
<page string="History" groups="base.group_extended"
attrs="{'invisible':[('layout_type','!=','article')]}">
<separator colspan="4" string="Invoice Lines"/>
<field colspan="4" name="invoice_lines" nolabel="1"/>
<separator colspan="4" string="Stock Moves"/>

View File

@ -20,7 +20,7 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='order_line']/form/notebook/page/field[@name='price_unit']" position="after">
<xpath expr="//field[@name='order_line']/form//field[@name='price_unit']" position="after">
<field name="purchase_price"/>
</xpath>
</field>
@ -32,7 +32,7 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="after">
<xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="after">
<field name="purchase_price"/>
</xpath>
</field>