[IMP] purchase: Add the wizard 'Set the default invoicing method'
bzr revid: stw@openerp.com-20110923152451-7g75qwlrelvqesq2
This commit is contained in:
parent
556323758f
commit
b51bf903f8
|
@ -29,4 +29,28 @@ class purchase_installer(osv.osv_memory):
|
|||
}
|
||||
purchase_installer()
|
||||
|
||||
class purchase_config_wizard(osv.osv_memory):
|
||||
_name = 'purchase.config.wizard'
|
||||
|
||||
_columns = {
|
||||
'default_method' : fields.selection(
|
||||
[('manual', 'Based on Purchase Orders'),
|
||||
('picking', 'Based on Receptions'),
|
||||
('order', 'Pre-Generate Draft Invoices on Purchase Orders'),
|
||||
],
|
||||
'Default Invoicing Control Method',
|
||||
required=True,
|
||||
),
|
||||
}
|
||||
|
||||
def validate_cb(self, cr, uid, ids, context=None):
|
||||
wizard = self.browse(cr, uid, ids, context=context)[0]
|
||||
|
||||
proxy = self.pool.get('ir.values')
|
||||
proxy.set(cr, uid, 'default', False, 'invoice_method', ['purchase.order'], wizard.default_method),
|
||||
|
||||
return {'type' : 'ir.actions.act_window_close'}
|
||||
|
||||
purchase_config_wizard()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -38,5 +38,34 @@
|
|||
<field name="action_id" ref="action_import_create_supplier_installer" />
|
||||
<field name="category_id" ref="category_purchase_config" />
|
||||
</record>
|
||||
|
||||
<record id="view_purchase_config" model="ir.ui.view">
|
||||
<field name="name">purchase.view_purchase_config</field>
|
||||
<field name="type">form</field>
|
||||
<field name="model">purchase.config.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Purchase Config">
|
||||
<label string="Set Your Default Invoicing Control Method" />
|
||||
<field name="default_method" nolabel="1"/>
|
||||
|
||||
<group colspan="4">
|
||||
<button special="cancel" icon="gtk-cancel" string="Cancel" />
|
||||
<button name="validate_cb" string="Validate" icon="gtk-apply" type="object" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_purchase_config" model="ir.actions.act_window">
|
||||
<field name="name">Set the Default Invoicing Control Method</field>
|
||||
<field name="res_model">purchase.config.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="todo_purchase_config" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_purchase_config" />
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue