From 81f4199fe636dfbca853860b8cdc0338ed8b6604 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 2 Oct 2011 14:59:58 +0200 Subject: [PATCH] [IMP] config wizards useability bzr revid: fp@tinyerp.com-20111002125958-uh8ubpli8izpxqyw --- addons/base_setup/base_setup_views.xml | 2 +- addons/purchase/purchase.py | 8 ++-- addons/sale/sale.py | 43 ++++++++--------- addons/sale/sale_view.xml | 64 ++++++++++++-------------- 4 files changed, 55 insertions(+), 62 deletions(-) diff --git a/addons/base_setup/base_setup_views.xml b/addons/base_setup/base_setup_views.xml index 2a1ff256d0e..2e2808d9ff4 100644 --- a/addons/base_setup/base_setup_views.xml +++ b/addons/base_setup/base_setup_views.xml @@ -176,7 +176,7 @@ Specify Your Terminology - Based on the industry needs you can use this wizard to change the terminologies for Partners. + You can use this wizard to change the terminologies for customers in the whole application. diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index dcf29bfaceb..568be5953ca 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -188,11 +188,11 @@ 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','From PO/PO lines'),('order','Draft invoices pre-generated'),('picking','From receptions')], 'Invoicing Control', required=True, - help="From Order: a draft invoice will be generated based on the purchase order. The accountant " \ + 'invoice_method': fields.selection([('manual','Based on purchase order'),('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" \ - "From Reception: a draft invoice will be generated based on validated receptions.\n" \ - "Manual: allows you to generate suppliers invoices by chosing in the uninvoiced lines of all manual purchase orders." + "Based on receptions: a draft invoice will be generated based on validated receptions.\n" \ + "Pre-generate Invoice: allows you to generate draft suppliers invoices on validation of the PO." ), 'minimum_planned_date':fields.function(_minimum_planned_date, fnct_inv=_set_minimum_planned_date, string='Expected Date', type='date', select=True, help="This is computed as the minimum scheduled date of all purchase order lines' products.", store = { diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 16cb5faf065..6f1b3abf40e 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1216,7 +1216,7 @@ class sale_config_picking_policy(osv.osv_memory): ('manual', 'Invoice Based on Sales Orders'), ('picking', 'Invoice Based on Deliveries'), ], 'Main Method Based On', required=True, help="You can generate invoices based on sales orders or based on shippings."), - 'charge_delivery': fields.boolean('Do you charge the delivery'), + 'charge_delivery': fields.boolean('Do you charge the delivery?'), 'time_unit': fields.many2one('product.uom','Main Working Time Unit') } _defaults = { @@ -1225,10 +1225,10 @@ class sale_config_picking_policy(osv.osv_memory): def onchange_order(self, cr, uid, ids, sale, deli, context=None): res = {} - if sale or deli: - res.update({'order_policy': 'manual'}) - elif not sale and not deli: + if sale: res.update({'order_policy': 'manual'}) + elif deli: + res.update({'order_policy': 'picking'}) else: return {} return {'value':res} @@ -1240,26 +1240,18 @@ class sale_config_picking_policy(osv.osv_memory): module_obj = self.pool.get('ir.module.module') module_upgrade_obj = self.pool.get('base.module.upgrade') module_name = [] - group_ids=[] - group_name = ['group_sale_salesman','group_sale_manager'] - for name in group_name: - data_id = data_obj.name_search(cr, uid, name) - group_ids.append(data_obj.browse(cr,uid,data_id[0][0]).res_id) + group_id = data_obj.get_object(cr, uid, 'base', 'group_sale_salesman').id wizard = self.browse(cr, uid, ids)[0] if wizard.sale_orders: - menu_name = 'menu_invoicing_sales_order_lines' - data_id = data_obj.name_search(cr, uid, menu_name) - menu_id = data_obj.browse(cr,uid,data_id[0][0]).res_id - menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_ids[0]),(4,group_ids[1])]}) + menu_id = data_obj.get_object(cr, uid, 'sale', 'menu_invoicing_sales_order_lines').id + menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_id)]}) if wizard.deli_orders: - menu_name = 'menu_action_picking_list_to_invoice' - data_id = data_obj.name_search(cr, uid, menu_name) - menu_id = data_obj.browse(cr,uid,data_id[0][0]).res_id - menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_ids[0]),(4,group_ids[1])]}) + menu_id = data_obj.get_object(cr, uid, 'sale', 'menu_action_picking_list_to_invoice').id + menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_id)]}) if wizard.task_work: module_name.append('project_timesheet') @@ -1269,12 +1261,7 @@ class sale_config_picking_policy(osv.osv_memory): module_name.append('account_analytic_analysis') if wizard.charge_delivery: - module_name.append('delivery') - - if wizard.time_unit: - product_obj = self.pool.get('product.product') - product_id = product_obj.name_search(cr, uid, 'Employee') - product_obj.write(cr, uid, product_id[0][0], {'uom_id':wizard.time_unit.id}) + module_name.append('delivery') if len(module_name): module_ids = [] @@ -1292,7 +1279,17 @@ class sale_config_picking_policy(osv.osv_memory): if need_install: pooler.restart_pool(cr.dbname, update_module=True)[1] + if wizard.time_unit: + prod_id = data_obj.get_object(cr, uid, 'hr_timesheet', 'product_consultant').id + product_obj = self.pool.get('product.product') + product_obj.write(cr, uid, prod_id, {'uom_id':wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id}) + ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], wizard.order_policy) + if wizard.task_work and wizard.time_unit: + company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id + self.pool.get('res.company').write(cr, uid, [company_id], { + 'project_time_mode_id': wizard.time_unit.id + }, context=context) sale_config_picking_policy() diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 68f83604e7d..4669a9d7d9c 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -481,48 +481,44 @@ - Set Up Your Invoicing Method + Setup Your Invoicing Method sale.config.picking_policy form
- Sales Application Configuration + Setup your Invoicing Method
- - - + + + Setup your Invoicing Method + + + This tool will help you to install the right module and configure the system according to the method you use to invoice your customers. + + + + 12 + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - +