[IMP] stock_landed_costs : Improved the onchange on product.
bzr revid: mdi@tinyerp.com-20140410102825-xy44ot6b4fn9pia3
This commit is contained in:
parent
cabc401513
commit
63e8f9efc7
|
@ -107,9 +107,6 @@ class stock_landed_cost(osv.osv):
|
|||
self.write(cr, uid, cost.id, {'state': 'open'}, context=context)
|
||||
return True
|
||||
|
||||
def button_cancel(self, cr ,uid, ids, context=None):
|
||||
return True
|
||||
|
||||
def compute_landed_cost(self, cr, uid, ids, context=None):
|
||||
line_obj = self.pool.get('stock.valuation.adjustment.lines')
|
||||
for cost in self.browse(cr, uid, ids, context=None):
|
||||
|
@ -155,7 +152,7 @@ class stock_landed_cost_lines(osv.osv):
|
|||
_name = 'stock.landed.cost.lines'
|
||||
_description = 'Stock Landed Cost Lines'
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id=False, price_unit=0.0, account_id=False, context=None):
|
||||
def onchange_product_id(self, cr, uid, ids, product_id=False, context=None):
|
||||
result = {}
|
||||
if not product_id:
|
||||
return {'value': {'quantity': 0.0, 'price_unit': 0.0}}
|
||||
|
@ -164,6 +161,7 @@ class stock_landed_cost_lines(osv.osv):
|
|||
result['name'] = product.name
|
||||
result['split_method'] = product.split_method
|
||||
result['price_unit'] = product.standard_price
|
||||
result['account_id'] = product.property_account_expense and product.property_account_expense.id or False
|
||||
return {'value': result}
|
||||
|
||||
_columns = {
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
<form string="Landed Costs" version="7.0">
|
||||
<header>
|
||||
<button name="button_validate" string="Validate" states="draft" class="oe_highlight" type="object"/>
|
||||
<button name="button_cancel" string="Cancel" states="draft" type="object"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open" statusbar_colors='{"cancel":"red"}'/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
|
@ -37,7 +36,7 @@
|
|||
<group>
|
||||
<group>
|
||||
<field name="product_id"
|
||||
on_change="onchange_product_id(product_id, price_unit, account_id)"/>
|
||||
on_change="onchange_product_id(product_id)"/>
|
||||
<field name="price_unit"/>
|
||||
</group>
|
||||
<group>
|
||||
|
@ -49,7 +48,7 @@
|
|||
<field name="name"/>
|
||||
</form>
|
||||
<tree string="Cost Lines" editable="bottom">
|
||||
<field name="product_id" on_change="onchange_product_id(product_id, price_unit, account_id)"/>
|
||||
<field name="product_id" on_change="onchange_product_id(product_id)"/>
|
||||
<field name="name"/>
|
||||
<field name="account_id"/>
|
||||
<field name="split_method"/>
|
||||
|
@ -144,7 +143,7 @@
|
|||
</record>
|
||||
|
||||
<!-- Stock Landed Cost Menu -->
|
||||
<menuitem name="Landed Costs" parent="stock.menu_stock_root" id="menu_stock_landed_cost_main" sequence="0"/>
|
||||
<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"/>
|
||||
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue