From f5a95f40fe4604e22c868b621369cdc8e5e11297 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 2 Oct 2011 17:48:02 +0200 Subject: [PATCH] [IMP] purchase invoice control wizard improvemens bzr revid: fp@tinyerp.com-20111002154802-pnl31a0ulf688jcp --- addons/purchase/purchase.py | 2 +- addons/purchase/purchase_view.xml | 4 +- addons/purchase/wizard/purchase_installer.py | 18 ++++----- addons/purchase/wizard/purchase_installer.xml | 37 ++++++++++++++----- 4 files changed, 39 insertions(+), 22 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 568be5953ca..db494add04b 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -188,7 +188,7 @@ class purchase_order(osv.osv): 'shipped_rate': fields.function(_shipped_rate, string='Received', type='float'), 'invoiced': fields.function(_invoiced, string='Invoiced & Paid', type='boolean', help="It indicates that an invoice has been paid"), 'invoiced_rate': fields.function(_invoiced_rate, string='Invoiced', type='float'), - 'invoice_method': fields.selection([('manual','Based on purchase order'),('order','Draft invoices pre-generated'),('picking','Based on receptions')], 'Invoicing Control', required=True, + 'invoice_method': fields.selection([('manual','Based on purchase order lines'),('order','Draft invoices pre-generated'),('picking','Based on receptions')], 'Invoicing Control', required=True, help="Based on orders: a draft invoice will be generated based on the purchase order. The accountant " \ "will just have to validate this invoice for control.\n" \ "Based on receptions: a draft invoice will be generated based on validated receptions.\n" \ diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index cb7224faaf0..60c6c39bf05 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -497,14 +497,14 @@ - On Purchase Order Line + On Purchase Order Lines ir.actions.act_window purchase.order.line [('order_id.invoice_method','<>','picking'), ('state','in',('confirmed','done')), ('invoiced', '=', False)] form tree,form - If you set the invoicing control on a purchase order as "Manual", you can track here all the purchase order lines for which you have not received the supplier invoice yet. Once you are ready to receive a supplier invoice, you can generate a draft supplier invoice based on the lines from this menu. + If you set the invoicing control on a purchase order as "Based on Purchase Order Lines", you can track here all the purchase order lines for which you have not received the supplier invoice yet. Once you are ready to receive a supplier invoice, you can generate a draft supplier invoice based on the lines from this menu. diff --git a/addons/purchase/wizard/purchase_installer.py b/addons/purchase/wizard/purchase_installer.py index c6d70947893..03327002953 100644 --- a/addons/purchase/wizard/purchase_installer.py +++ b/addons/purchase/wizard/purchase_installer.py @@ -31,24 +31,24 @@ purchase_installer() class purchase_config_wizard(osv.osv_memory): _name = 'purchase.config.wizard' + _inherit = 'res.config' _columns = { 'default_method' : fields.selection( - [('manual', 'Based on Purchase Orders'), + [('manual', 'Based on Purchase Order Lines'), ('picking', 'Based on Receptions'), - ('order', 'Pre-Generate Draft Invoices on Purchase Orders'), - ], - 'Default Invoicing Control Method', - required=True, - ), + ('order', 'Pre-Generate Draft Invoices on Based Purchase Orders'), + ], 'Default Invoicing Control Method', required=True, + ) + } + _defaults = { + 'default_method': lambda s,c,u,ctx: s.pool.get('purchase.order').default_get(c,u,['invoice_method'],context=ctx)['invoice_method'] } - def validate_cb(self, cr, uid, ids, context=None): + def execute(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() diff --git a/addons/purchase/wizard/purchase_installer.xml b/addons/purchase/wizard/purchase_installer.xml index cf9b6a985db..0519ac3dd01 100644 --- a/addons/purchase/wizard/purchase_installer.xml +++ b/addons/purchase/wizard/purchase_installer.xml @@ -40,32 +40,49 @@ - purchase.view_purchase_config - form + Invoicing Control on Purchases purchase.config.wizard + form + -
-