Dharti Ratani(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-generic_widget-dhr into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-generic_widget-dhr/+merge/99480
Hello,
Grouping price and unit and applying widget in sale.
Adding currency field in hr.expense and and groupin it with price field.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-generic_widget-dhr/+merge/99480
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-generic_widget-dhr.
=== modified file 'hr_expense/hr_expense.py'
--- hr_expense/hr_expense.py 2012-02-13 18:07:41 +0000
+++ hr_expense/hr_expense.py 2012-03-27 08:55:22 +0000
@@ -255,7 +255,14 @@
cr.execute("SELECT l.id,COALESCE(SUM(l.unit_amount*l.unit_quantity),0) AS amount FROM hr_expense_line l WHERE id IN %s GROUP BY l.id ",(tuple(ids),))
res = dict(cr.fetchall())
return res
-
+
+ def _currency(self, cr, uid, ids, field_name, arg, context=None):
+ res ={}
+ for id in ids:
+ symbol = self.browse(cr,uid,id).analytic_account.company_id.currency_id.symbol
+ res[id]=symbol
+ return res
+
_columns = {
'name': fields.char('Expense Note', size=128, required=True),
'date_value': fields.date('Date', required=True),
@@ -265,6 +272,7 @@
'unit_quantity': fields.float('Quantities' ),
'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)]),
'uom_id': fields.many2one('product.uom', 'UoM'),
+ 'currency': fields.function(_currency, type='char',string='Currency'),
'description': fields.text('Description'),
'analytic_account': fields.many2one('account.analytic.account','Analytic account'),
'ref': fields.char('Reference', size=32),
=== modified file 'hr_expense/hr_expense_view.xml'
--- hr_expense/hr_expense_view.xml 2012-03-22 17:23:05 +0000
+++ hr_expense/hr_expense_view.xml 2012-03-27 08:55:22 +0000
@@ -84,7 +84,11 @@
<field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
<field name="name" colspan="4"/>
<newline/>
- <field name="unit_amount"/>
+ <label string="Unit Price: "/>
+ <group widget ="single_col">
+ <field name="unit_amount" nolabel="1"/>
+ <field name="currency" nolabel="1"/>
+ </group>
<field name="unit_quantity"/>
<field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
</group>
=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml 2012-03-26 11:48:47 +0000
+++ sale/sale_view.xml 2012-03-27 08:55:22 +0000
@@ -122,36 +122,38 @@
<form string="Sales Order Lines">
<notebook>
<page string="Order Line">
- <group colspan="4" col="5">
- <field colspan="3"
+ <group colspan="4" col="4">
+ <field colspan="2"
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
+ <label string="Quantity (UOM):"/>
+ <group widget ="single_col">
+ <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)"
- nolabel="1"/>
- <field name="price_unit"/>
-
+ 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)"
+ nolabel="1" />
+ <field name="product_uom" widget= "selection"
+ 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"/>
+ </group>
+ <field name="price_unit"/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field groups="product.group_uos" name="product_uos" nolabel="1"/>
<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"/>
+ colspan="2"/>
<field name="discount"/>
- <separator colspan="5" string="Notes"/>
- <field colspan="5" name="notes" nolabel="1"/>
- <separator colspan="5" string="Taxes"/>
- <field colspan="5" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','<>','purchase')]"/>
- <group colspan="5" col="5" groups="base.group_extended">
- <separator colspan="5" string="States"/>
+ <separator colspan="4" string="Notes"/>
+ <field colspan="4" name="notes" nolabel="1"/>
+ <separator colspan="4" string="Taxes"/>
+ <field colspan="4" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','<>','purchase')]"/>
+ <group colspan="4" col="4" groups="base.group_extended">
+ <separator colspan="4" string="States"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done" statusbar_colors='{"exception":"red","cancel":"red"}'/>
<field name="invoiced"/>
<group attrs="{'invisible':[('invoiced','=',True)]}">
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp