[IMP] stock: Added default vals of location and hidden by location group

bzr revid: pso@tinyerp.com-20120803122354-3y3ge823cgo9edlk
This commit is contained in:
Saurang Suthar(OpenERP) 2012-08-03 17:53:54 +05:30 committed by pso (OpenERP)
parent e178275b98
commit e9eb895c6a
2 changed files with 27 additions and 7 deletions

View File

@ -2801,6 +2801,14 @@ class stock_inventory_line(osv.osv):
'state': fields.related('inventory_id','state',type='char',string='Status',readonly=True),
}
def _default_stock_location(self, cr, uid, context=None):
stock_location = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock')
return stock_location.id
_defaults = {
'location_id': _default_stock_location
}
def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False, to_date=False):
""" Changes UoM and name if product_id changes.
@param location_id: Location id
@ -2832,8 +2840,20 @@ class stock_warehouse(osv.osv):
'lot_stock_id': fields.many2one('stock.location', 'Location Stock', required=True, domain=[('usage','=','internal')]),
'lot_output_id': fields.many2one('stock.location', 'Location Output', required=True, domain=[('usage','<>','view')]),
}
def _default_lot_input_stock_id(self, cr, uid, context=None):
lot_input_stock = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_stock')
return lot_input_stock.id
def _default_lot_output_id(self, cr, uid, context=None):
lot_output = self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'stock_location_output')
return lot_output.id
_defaults = {
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c),
'lot_input_id': _default_lot_input_stock_id,
'lot_stock_id': _default_lot_input_stock_id,
'lot_output_id': _default_lot_output_id,
}
stock_warehouse()

View File

@ -626,9 +626,9 @@
<h1><field name="name"/></h1>
<group>
<group>
<field name="lot_input_id"/>
<field name="lot_stock_id"/>
<field name="lot_output_id"/>
<field name="lot_input_id" groups="stock.group_locations"/>
<field name="lot_stock_id" groups="stock.group_locations"/>
<field name="lot_output_id" groups="stock.group_locations"/>
</group>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
@ -645,9 +645,9 @@
<field name="arch" type="xml">
<tree string="Warehouse">
<field name="name"/>
<field name="lot_input_id"/>
<field name="lot_stock_id"/>
<field name="lot_output_id"/>
<field name="lot_input_id" groups="stock.group_locations"/>
<field name="lot_stock_id" groups="stock.group_locations"/>
<field name="lot_output_id" groups="stock.group_locations"/>
<field name="partner_id"/>
</tree>
</field>
@ -734,7 +734,7 @@
<group>
<group>
<field name="backorder_id" readonly="1"/>
<field name="invoice_state" string="Invoice Control" groups="account.group_account_invoice"/>
<field name="invoice_state" string="Invoice Control" groups="account.group_account_invoice" attrs="{'invisible':[('invoice_state', '=', 'none')]}"/>
<field name="stock_journal_id" widget="selection" groups="account.group_account_user"/>
</group>
<group>