[fix] sale: migrate to res.config-based initial configuration

bzr revid: xmo@tinyerp.com-20091215155552-3jst1v1qsuqqfrzn
This commit is contained in:
Xavier Morel 2009-12-15 16:55:52 +01:00
parent 0bf0ceebee
commit 3bbf579f49
2 changed files with 23 additions and 35 deletions

View File

@ -1057,6 +1057,8 @@ sale_order_line()
class sale_config_picking_policy(osv.osv_memory):
_name = 'sale.config.picking_policy'
_inherit = 'res.config'
_columns = {
'name': fields.char('Name', size=64),
'picking_policy': fields.selection([
@ -1082,7 +1084,7 @@ class sale_config_picking_policy(osv.osv_memory):
'step': lambda *a: 'one'
}
def set_default(self, cr, uid, ids, context=None):
def execute(self, cr, uid, ids, context=None):
for o in self.browse(cr, uid, ids, context=context):
ir_values_obj = self.pool.get('ir.values')
ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], o.picking_policy)
@ -1099,23 +1101,5 @@ class sale_config_picking_policy(osv.osv_memory):
location_id = md._get_id(cr, uid, 'stock', 'stock_location_output')
location_id = md.browse(cr, uid, location_id, context).res_id
self.pool.get('stock.location').write(cr, uid, [location_id], {'chained_auto_packing': 'transparent'})
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'ir.actions.configuration.wizard',
'type': 'ir.actions.act_window',
'target': 'new',
}
def action_cancel(self, cr, uid, ids, context=None):
return {
'view_type': 'form',
"view_mode": 'form',
'res_model': 'ir.actions.configuration.wizard',
'type': 'ir.actions.act_window',
'target': 'new',
}
sale_config_picking_policy()

View File

@ -508,21 +508,26 @@
<field name="name">Configure Picking Policy for Sale Order </field>
<field name="model">sale.config.picking_policy</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<form string="Sales Configuration">
<separator colspan="4" string="Configure Sale Order Logistic"/>
<newline/>
<field name="picking_policy"/>
<newline/>
<field name="order_policy"/>
<newline/>
<field name="step"/>
<separator string="" colspan="4"/>
<group col="4" colspan="4">
<button icon="gtk-cancel" name="action_cancel" type="object" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="set_default" string="Set Default" type="object"/>
</group>
</form>
<data>
<form position="attributes"><attribute name="string">
Sales Configuration
</attribute></form>
<group string="res_config_contents" position="replace">
<label colspan="4" align="0.0" string="
This Configuration step use to set default picking policy
when make sale order"/>
<separator colspan="4"
string="Configure Sale Order Logistic"/>
<newline/>
<field name="picking_policy"/>
<newline/>
<field name="order_policy"/>
<newline/>
<field name="step"/>
</group>
</data>
</field>
</record>
@ -530,6 +535,7 @@
<field name="name">Configure Picking Policy for Sale Order</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.config.picking_policy</field>
<field name="view_id" ref="view_config_picking_policy"/>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
@ -537,8 +543,6 @@
<!-- register configuration wizard -->
<record id="config_wizard_step_sale_picking_policy" model="ir.actions.todo">
<field name="name">Select the default picking policy for Sale Order</field>
<field name="note">This Configuration step use to set default picking policy when make sale order</field>
<field name="action_id" ref="action_config_picking_policy"/>
</record>