[WIP] Add menu for global procurement rules and pass routes to next procurement
bzr revid: jco@openerp.com-20130717113136-l2pj1h6ukfoj153r
This commit is contained in:
parent
4ae7d5cec6
commit
208f56c284
|
@ -43,6 +43,7 @@ class sale_order(osv.osv):
|
|||
res.update({
|
||||
'route_ids': routes
|
||||
})
|
||||
return res
|
||||
|
||||
class sale_order_line(osv.osv):
|
||||
_inherit = 'sale.order.line'
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='price_unit']" position="before">
|
||||
<xpath expr="//tree/field[@name='price_unit']" position="before">
|
||||
<field name="route_id"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
|
|
@ -1556,6 +1556,32 @@
|
|||
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_procurement_rule_tree">
|
||||
<field name="name">stock.procurement.tree</field>
|
||||
<field name="model">procurement.rule</field>
|
||||
<field eval="10" name="priority"/>
|
||||
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Procurement Rules">
|
||||
<field name="location_src_id"/>
|
||||
<field name="location_id"/>
|
||||
<field name="action"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="procrules">
|
||||
<field name="context">{}</field>
|
||||
<field name="name">Global procurement rules</field>
|
||||
<field name="res_model">procurement.rule</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="quantsact">
|
||||
<field name="context">{}</field>
|
||||
<field name="name">Quants</field>
|
||||
|
@ -1587,8 +1613,8 @@
|
|||
<menuitem action="procurement.procurement_exceptions" id="menu_stock_procurement_action" parent="menu_stock_sched" sequence="50" groups="stock.group_stock_manager"/>
|
||||
<menuitem id="menu_stock_procurement" name="Automatic Procurements" parent="stock.menu_stock_configuration" sequence="5"/>
|
||||
<menuitem action="action_orderpoint_form" id="menu_stock_order_points" parent="stock.menu_stock_configuration" sequence="10"/>
|
||||
<menuitem id="quants" name="Quants" parent="stock.menu_stock_configuration" action="quantsact" groups="base.group_no_one"/>
|
||||
|
||||
<menuitem id="menu_quants" name="Quants" parent="stock.menu_stock_configuration" action="quantsact" groups="base.group_no_one"/>
|
||||
<menuitem id="menu_procurement_rules" name="Procurement Rules" parent="stock.menu_stock_configuration" action="procrules" groups="base.group_no_one"/>
|
||||
|
||||
|
||||
|
||||
|
@ -1706,7 +1732,5 @@
|
|||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -105,7 +105,7 @@ class stock_location_path(osv.osv):
|
|||
'company_id': rule.company_id and rule.company_id.id or False,
|
||||
'date_expected': newdate,
|
||||
'picking_id': False,
|
||||
'picking_type': move_obj.get_type_from_usage(cr, uid, move.location_id, move.location_dest_id, context=context)
|
||||
'type': move_obj.get_type_from_usage(cr, uid, move.location_id, move.location_dest_id, context=context)
|
||||
})
|
||||
move_obj.write(cr, uid, [move.id], {
|
||||
'move_dest_id': move_id,
|
||||
|
@ -254,6 +254,21 @@ class stock_move(osv.osv):
|
|||
self._push_apply(cr, uid, moves, context=context)
|
||||
return result
|
||||
|
||||
def _create_procurement(self, cr, uid, move, context=None):
|
||||
"""
|
||||
Next to creating the procurement order, it will propagate the routes
|
||||
"""
|
||||
proc_id = super(stock_move, self)._create_procurement(cr, uid, move, context=context)
|
||||
proc_obj = self.pool.get("procurement.order")
|
||||
procs = proc_obj.search(cr, uid, [("move_id", "=", move.id)], context=context)
|
||||
routes = []
|
||||
for proc in proc_obj.browse(cr, uid, procs, context=context):
|
||||
routes += [x.id for x in proc.route_ids]
|
||||
if routes:
|
||||
proc_obj.write(cr, uid, [proc_id], {'route_ids': [(4,x) for x in routes]}, context=context)
|
||||
return proc_id
|
||||
|
||||
|
||||
class stock_location(osv.osv):
|
||||
_inherit = 'stock.location'
|
||||
_columns = {
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
</record>
|
||||
|
||||
<record id="procurement_rule_customer0_xdock" model="procurement.rule">
|
||||
<field name="name"> Output > Customer</field>
|
||||
<field name="name"> Output → Customer</field>
|
||||
<field name="action">move</field>
|
||||
<field name="location_id" ref="stock.stock_location_customers"/>
|
||||
<field name="location_src_id" ref="stock.stock_location_output"/>
|
||||
|
|
Loading…
Reference in New Issue