[IMP] changes for sale configuration view
bzr revid: tpa@tinyerp.com-20120223094626-7vt2ufe2qjeoudc2
This commit is contained in:
parent
82c41467ad
commit
187b0d3532
|
@ -106,7 +106,7 @@ class delivery_carrier(osv.osv):
|
|||
# if using advanced pricing per destination: do not change
|
||||
if record.use_detailed_pricelist:
|
||||
continue
|
||||
|
||||
|
||||
# not using advanced pricing per destination: override grid
|
||||
grid_id = grid_pool.search(cr, uid, [('carrier_id', '=', record.id)], context=context)
|
||||
|
||||
|
@ -250,23 +250,23 @@ class delivery_grid_line(osv.osv):
|
|||
|
||||
delivery_grid_line()
|
||||
|
||||
class define_delivery_steps(osv.osv_memory):
|
||||
_name = 'delivery.define.delivery.steps.wizard'
|
||||
|
||||
_columns = {
|
||||
'picking_policy' : fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')], 'Picking Policy'),
|
||||
}
|
||||
_defaults = {
|
||||
'picking_policy': lambda s,c,u,ctx: s.pool.get('sale.order').default_get(c,u,['picking_policy'],context=ctx)['picking_policy']
|
||||
}
|
||||
|
||||
def apply_cb(self, cr, uid, ids, context=None):
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
wizard = self.browse(cr, uid, ids, context=context)[0]
|
||||
ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], wizard.picking_policy)
|
||||
return {'type' : 'ir.actions.act_window_close'}
|
||||
|
||||
define_delivery_steps()
|
||||
#class define_delivery_steps(osv.osv_memory):
|
||||
# _name = 'delivery.define.delivery.steps.wizard'
|
||||
#
|
||||
# _columns = {
|
||||
# 'picking_policy' : fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')], 'Picking Policy'),
|
||||
# }
|
||||
# _defaults = {
|
||||
# 'picking_policy': lambda s,c,u,ctx: s.pool.get('sale.order').default_get(c,u,['picking_policy'],context=ctx)['picking_policy']
|
||||
# }
|
||||
#
|
||||
# def apply_cb(self, cr, uid, ids, context=None):
|
||||
# ir_values_obj = self.pool.get('ir.values')
|
||||
# wizard = self.browse(cr, uid, ids, context=context)[0]
|
||||
# ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], wizard.picking_policy)
|
||||
# return {'type' : 'ir.actions.act_window_close'}
|
||||
#
|
||||
#define_delivery_steps()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -337,7 +337,7 @@
|
|||
<field name="sequence">10</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="define_delivery_steps_form">
|
||||
<!--record model="ir.ui.view" id="define_delivery_steps_form">
|
||||
<field name="name">delivery.define_delivery_steps</field>
|
||||
<field name="model">delivery.define.delivery.steps.wizard</field>
|
||||
<field name="type">form</field>
|
||||
|
@ -366,6 +366,6 @@
|
|||
<field name="action_id" ref="action_define_delivery_steps" />
|
||||
<field name="category_id" ref="base.category_sales_management_config"/>
|
||||
<field name="type">once</field>
|
||||
</record>
|
||||
</record-->
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -789,7 +789,7 @@ class sale_order(osv.osv):
|
|||
return True
|
||||
|
||||
def _get_date_planned(self, cr, uid, order, line, start_date, context=None):
|
||||
date_planned = datetime.strptime(start_date, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=line.delay or 0.0)
|
||||
date_planned = datetime.strptime(start_date, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=line.delay or 0.0)
|
||||
date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
return date_planned
|
||||
|
||||
|
@ -1331,94 +1331,93 @@ class sale_order_line(osv.osv):
|
|||
sale_order_line()
|
||||
|
||||
class sale_config_picking_policy(osv.osv_memory):
|
||||
_name = 'sale.config.picking_policy'
|
||||
_inherit = 'res.config'
|
||||
_inherit = 'sale.config.picking_policy'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=64),
|
||||
'sale_orders': fields.boolean('Based on Sales Orders',),
|
||||
'deli_orders': fields.boolean('Based on Delivery Orders'),
|
||||
'task_work': fields.boolean('Based on Tasks\' Work'),
|
||||
'timesheet': fields.boolean('Based on Timesheet'),
|
||||
'order_policy': fields.selection([
|
||||
('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?'),
|
||||
# 'name': fields.char('Name', size=64),
|
||||
# 'sale_orders': fields.boolean('Based on Sales Orders',),
|
||||
# 'deli_orders': fields.boolean('Based on Delivery Orders'),
|
||||
# 'task_work': fields.boolean('Based on Tasks\' Work'),
|
||||
# 'timesheet': fields.boolean('Based on Timesheet'),
|
||||
# 'order_policy': fields.selection([
|
||||
# ('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?'),
|
||||
'time_unit': fields.many2one('product.uom','Main Working Time Unit')
|
||||
}
|
||||
_defaults = {
|
||||
'order_policy': 'manual',
|
||||
# 'order_policy': 'manual',
|
||||
'time_unit': lambda self, cr, uid, c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=c) and self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=c)[0] or False,
|
||||
}
|
||||
|
||||
def onchange_order(self, cr, uid, ids, sale, deli, context=None):
|
||||
res = {}
|
||||
if sale:
|
||||
res.update({'order_policy': 'manual'})
|
||||
elif deli:
|
||||
res.update({'order_policy': 'picking'})
|
||||
return {'value':res}
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
menu_obj = self.pool.get('ir.ui.menu')
|
||||
module_obj = self.pool.get('ir.module.module')
|
||||
module_upgrade_obj = self.pool.get('base.module.upgrade')
|
||||
module_name = []
|
||||
|
||||
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_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_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')
|
||||
module_name.append('project_mrp')
|
||||
module_name.append('account_analytic_analysis')
|
||||
|
||||
if wizard.timesheet:
|
||||
module_name.append('account_analytic_analysis')
|
||||
|
||||
if wizard.charge_delivery:
|
||||
module_name.append('delivery')
|
||||
|
||||
if len(module_name):
|
||||
module_ids = []
|
||||
need_install = False
|
||||
module_ids = []
|
||||
for module in module_name:
|
||||
data_id = module_obj.name_search(cr, uid , module, [], '=')
|
||||
module_ids.append(data_id[0][0])
|
||||
|
||||
for module in module_obj.browse(cr, uid, module_ids):
|
||||
if module.state == 'uninstalled':
|
||||
module_obj.state_update(cr, uid, [module.id], 'to install', ['uninstalled'], context)
|
||||
need_install = True
|
||||
cr.commit()
|
||||
if need_install:
|
||||
pooler.restart_pool(cr.dbname, update_module=True)[1]
|
||||
|
||||
if wizard.time_unit:
|
||||
prod_id = data_obj.get_object(cr, uid, 'product', '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)
|
||||
|
||||
#
|
||||
# def onchange_order(self, cr, uid, ids, sale, deli, context=None):
|
||||
# res = {}
|
||||
# if sale:
|
||||
# res.update({'order_policy': 'manual'})
|
||||
# elif deli:
|
||||
# res.update({'order_policy': 'picking'})
|
||||
# return {'value':res}
|
||||
#
|
||||
# def execute(self, cr, uid, ids, context=None):
|
||||
# ir_values_obj = self.pool.get('ir.values')
|
||||
# data_obj = self.pool.get('ir.model.data')
|
||||
# menu_obj = self.pool.get('ir.ui.menu')
|
||||
# module_obj = self.pool.get('ir.module.module')
|
||||
# module_upgrade_obj = self.pool.get('base.module.upgrade')
|
||||
# module_name = []
|
||||
#
|
||||
# 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_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_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')
|
||||
# module_name.append('project_mrp')
|
||||
# module_name.append('account_analytic_analysis')
|
||||
#
|
||||
# if wizard.timesheet:
|
||||
# module_name.append('account_analytic_analysis')
|
||||
#
|
||||
# if wizard.charge_delivery:
|
||||
# module_name.append('delivery')
|
||||
#
|
||||
# if len(module_name):
|
||||
# module_ids = []
|
||||
# need_install = False
|
||||
# module_ids = []
|
||||
# for module in module_name:
|
||||
# data_id = module_obj.name_search(cr, uid , module, [], '=')
|
||||
# module_ids.append(data_id[0][0])
|
||||
#
|
||||
# for module in module_obj.browse(cr, uid, module_ids):
|
||||
# if module.state == 'uninstalled':
|
||||
# module_obj.state_update(cr, uid, [module.id], 'to install', ['uninstalled'], context)
|
||||
# need_install = True
|
||||
# cr.commit()
|
||||
# if need_install:
|
||||
# pooler.restart_pool(cr.dbname, update_module=True)[1]
|
||||
#
|
||||
# if wizard.time_unit:
|
||||
# prod_id = data_obj.get_object(cr, uid, 'product', '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()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -503,14 +503,14 @@
|
|||
|
||||
<!-- configartion view -->
|
||||
|
||||
<record id="view_config_picking_policy" model="ir.ui.view">
|
||||
<record id="view_config_picking_policy_11" model="ir.ui.view">
|
||||
<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="inherit_id" ref="base.view_config_picking_policy_1"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<form position="attributes">
|
||||
<!--data>
|
||||
< form position="attributes">
|
||||
<attribute name="string">Setup your Invoicing Method</attribute>
|
||||
</form>
|
||||
|
||||
|
@ -519,12 +519,13 @@
|
|||
</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="vsep"]" position="attributes">
|
||||
<attribute name="string"/>
|
||||
<attribute name="rowspan">12</attribute>
|
||||
</xpath>
|
||||
<group string="res_config_contents" position="replace">
|
||||
</xpath-->
|
||||
<field name="picking_policy" position="before">
|
||||
<newline/>
|
||||
<field name="time_unit" />
|
||||
<newline/>
|
||||
</field>
|
||||
<!--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/>
|
||||
|
@ -542,11 +543,11 @@
|
|||
<field name="time_unit" widget="selection" domain="[('category_id','=',%(product.uom_categ_wtime)s)]" attrs="{'invisible':[('task_work','=',False),('timesheet','=',False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</data>
|
||||
</data-->
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_config_picking_policy" model="ir.actions.act_window">
|
||||
<!--record id="action_config_picking_policy" model="ir.actions.act_window">
|
||||
<field name="name">Setup your Invoicing Method</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.config.picking_policy</field>
|
||||
|
@ -556,12 +557,12 @@
|
|||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- register configuration wizard -->
|
||||
<register configuration wizard >
|
||||
<record id="config_wizard_step_sale_picking_policy" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_config_picking_policy"/>
|
||||
<field name="category_id" ref="base.category_sales_management_config"/>
|
||||
<field name="type">once</field>
|
||||
</record>
|
||||
</record-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue