[IMP] config wizards useability

bzr revid: fp@tinyerp.com-20111002125958-uh8ubpli8izpxqyw
This commit is contained in:
Fabien Pinckaers 2011-10-02 14:59:58 +02:00
parent 730230f7ac
commit 81f4199fe6
4 changed files with 55 additions and 62 deletions

View File

@ -176,7 +176,7 @@
<attribute name="string">Specify Your Terminology</attribute>
</xpath>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Based on the industry needs you can use this wizard to change the terminologies for Partners. </attribute>
<attribute name="string">You can use this wizard to change the terminologies for customers in the whole application.</attribute>
</xpath>
<xpath expr="//separator[@string=&quot;vsep&quot;]" position="attributes">
<attribute name="string"/>

View File

@ -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 = {

View File

@ -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()

View File

@ -481,48 +481,44 @@
<!-- configartion view -->
<record id="view_config_picking_policy" model="ir.ui.view">
<field name="name">Set Up Your Invoicing Method</field>
<field name="name">Setup Your Invoicing Method</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">
<data>
<form position="attributes">
<attribute name="string">Sales Application Configuration</attribute>
<attribute name="string">Setup your Invoicing Method</attribute>
</form>
<group colspan="4" col="8" position="replace">
<group colspan="8">
<separator string="How do you generate your customer invoice ?"/>
<xpath expr="//separator[@string=&quot;title&quot;]" position="attributes">
<attribute name="string">Setup your Invoicing Method</attribute>
</xpath>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">This tool will help you to install the right module and configure the system according to the method you use to invoice your customers.</attribute>
</xpath>
<xpath expr="//separator[@string=&quot;vsep&quot;]" position="attributes">
<attribute name="string"/>
<attribute name="rowspan">12</attribute>
</xpath>
<group string="res_config_contents" position="replace">
<group colspan="4" col="4">
<field name="sale_orders" on_change="onchange_order(sale_orders,deli_orders)"/>
<newline/>
<field name="deli_orders" on_change="onchange_order(sale_orders,deli_orders)"/>
<newline/>
<field name="task_work"/>
<newline/>
<field name="timesheet"/>
<newline/>
<separator string="Options" colspan="4"/>
<field name="order_policy" attrs="{'invisible':['|',('sale_orders','!=',True),('deli_orders','!=',True)]}"/>
<newline/>
<field name="charge_delivery" attrs="{'invisible':[('sale_orders','!=',True), ('deli_orders','!=',True)]}"/>
<newline/>
<field name="time_unit" widget="selection" domain="[('category_id','=',%(product.uom_categ_wtime)s)]" attrs="{'invisible':[('task_work','=',False),('timesheet','=',False)]}"/>
</group>
<group colspan="8" col="2">
<label align="0.0" string="Based on Sales Orders" width="200"/>
<field name="sale_orders" on_change="onchange_order(sale_orders,deli_orders)" nolabel="1"/>
<label align="0.0" string="Based on Delivery Orders" width="200"/>
<field name="deli_orders" on_change="onchange_order(sale_orders,deli_orders)" nolabel="1"/>
<label align="0.0" string="Based on Task's Work" width="200"/>
<field name="task_work" nolabel="1"/>
<label align="0.0" string="Based on Timesheet" width="200"/>
<field name="timesheet" nolabel="1"/>
</group>
<group colspan="8">
<separator string="Options"/>
</group>
<group colspan="8">
<group colspan="4" col="2" attrs="{'invisible':['|',('sale_orders','!=',True),('deli_orders','!=',True)]}">
<label align="0.0" string="Main Method Based On" width="200"/>
<field name="order_policy" nolabel="1"/>
</group>
<group colspan="4" col="2" attrs="{'invisible':[('sale_orders','!=',True), ('deli_orders','!=',True)]}">
<label align="0.0" string="Do you charge the delivery" width="200"/>
<field name="charge_delivery" nolabel="1"/>
</group>
<group colspan="4" col="2" attrs="{'invisible':[('task_work','=',False),('timesheet','=',False)]}">
<label align="0.0" string="Main Working Time Unit" width="200"/>
<field name="time_unit" widget="selection" domain="[('category_id','=',3)]" nolabel="1"/>
</group>
</group>
</group>
<xpath expr="//button[@name=&quot;action_skip&quot;]" position="replace"/>
</group>
</data>
</field>
</record>