[MERGE]Merge with Parent Branch
bzr revid: pza@tinyerp.com-20130909044932-rwlwaltqurscywsj
This commit is contained in:
@@ -48,14 +48,14 @@ class sale_order(osv.osv):
|
||||
class sale_order_line(osv.osv):
|
||||
_inherit = 'sale.order.line'
|
||||
_columns = {
|
||||
'route_id': fields.many2one('stock.location.route', 'Route', domain=[('sale', '=', True)]),
|
||||
'route_id': fields.many2one('stock.location.route', 'Route', domain=[('sale_selectable', '=', True)]),
|
||||
}
|
||||
|
||||
|
||||
class stock_location_route(osv.osv):
|
||||
_inherit = "stock.location.route"
|
||||
_columns = {
|
||||
'sale':fields.boolean("Can be set on sale order line")
|
||||
'sale_selectable':fields.boolean("Selectable on Sales Order Line")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,10 +44,21 @@
|
||||
<field name="inherit_id" ref="stock_location.stock_location_route_form_view"/>
|
||||
<field name="model">stock.location.route</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='pull_ids']" position="after">
|
||||
<field name="sale"/>
|
||||
<xpath expr="//field[@name='name']" position="after">
|
||||
<field name="sale_selectable"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="stock_location_route_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">stock.location.route.tree.inherit</field>
|
||||
<field name="inherit_id" ref="stock_location.stock_location_route_tree"/>
|
||||
<field name="model">stock.location.route</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='warehouse_selectable']" position="after">
|
||||
<field name="sale_selectable"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -173,7 +173,7 @@ class procurement_order(osv.osv):
|
||||
'product_uom': product.uom_id.id,
|
||||
'location_id': location_id,
|
||||
'company_id': warehouse.company_id.id,
|
||||
'procure_method': 'make_to_order',}
|
||||
}
|
||||
|
||||
def create_automatic_op(self, cr, uid, context=None):
|
||||
"""
|
||||
@@ -204,7 +204,7 @@ class procurement_order(osv.osv):
|
||||
|
||||
product = product_obj.browse(cr, uid, [product_read['id']], context=context)[0]
|
||||
if product.supply_method == 'buy':
|
||||
location_id = warehouse.lot_input_id.id
|
||||
location_id = warehouse.lot_stock_id.id
|
||||
elif product.supply_method == 'produce':
|
||||
location_id = warehouse.lot_stock_id.id
|
||||
else:
|
||||
@@ -212,8 +212,8 @@ class procurement_order(osv.osv):
|
||||
proc_id = proc_obj.create(cr, uid,
|
||||
self._prepare_automatic_op_procurement(cr, uid, product, warehouse, location_id, context=context),
|
||||
context=context)
|
||||
self.signal_button_confirm(cr, uid, [proc_id])
|
||||
self.signal_button_check(cr, uid, [proc_id])
|
||||
self.assign(cr, uid, [proc_id])
|
||||
self.run(cr, uid, [proc_id])
|
||||
return True
|
||||
|
||||
def _get_orderpoint_date_planned(self, cr, uid, orderpoint, start_date, context=None):
|
||||
@@ -229,7 +229,6 @@ class procurement_order(osv.osv):
|
||||
'company_id': orderpoint.company_id.id,
|
||||
'product_uom': orderpoint.product_uom.id,
|
||||
'location_id': orderpoint.location_id.id,
|
||||
'procure_method': 'make_to_order',
|
||||
'origin': orderpoint.name}
|
||||
|
||||
def _product_virtual_get(self, cr, uid, order_point):
|
||||
|
||||
+21
-5
@@ -1950,7 +1950,10 @@ class stock_package(osv.osv):
|
||||
"""
|
||||
_name = "stock.quant.package"
|
||||
_description = "Physical Packages"
|
||||
_order = 'name'
|
||||
_parent_name = "parent_id"
|
||||
_parent_store = True
|
||||
_parent_order = 'name'
|
||||
_order = 'parent_left'
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context)
|
||||
@@ -1985,16 +1988,20 @@ class stock_package(osv.osv):
|
||||
res.add(pack.parent_id.id)
|
||||
return list(res)
|
||||
|
||||
# TODO: Problem when package is empty!
|
||||
#
|
||||
def _get_package_info(self, cr, uid, ids, name, args, context=None):
|
||||
default_company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
|
||||
res = {}.fromkeys(ids, {'location_id': False, 'company_id': default_company_id})
|
||||
for pack in self.browse(cr, uid, ids, context=context):
|
||||
if pack.quant_ids:
|
||||
res[pack.id]['location_id'] = pack.quant_ids[0].location_id.id
|
||||
res[pack.id]['owner_id'] = pack.quant_ids[0].owner_id and pack.quant_ids[0].owner_id.id or False
|
||||
res[pack.id]['company_id'] = pack.quant_ids[0].company_id.id
|
||||
elif pack.children_ids:
|
||||
res[pack.id]['location_id'] = pack.children_ids[0].location_id.id
|
||||
res[pack.id]['company_id'] = pack.children_ids[0].company_id.id
|
||||
res[pack.id]['location_id'] = pack.children_ids[0].location_id and pack.children_ids[0].location_id.id or False
|
||||
res[pack.id]['owner_id'] = pack.children_ids[0].owner_id and pack.children_ids[0].owner_id.id or False
|
||||
res[pack.id]['company_id'] = pack.children_ids[0].company_id and pack.children_ids[0].company_id.id or False
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
@@ -2006,12 +2013,21 @@ class stock_package(osv.osv):
|
||||
'location_id': fields.function(_get_package_info, type='many2one', relation='stock.location', string='Location', multi="package",
|
||||
store={
|
||||
'stock.quant': (_get_packages, ['location_id'], 10),
|
||||
'stock.quant.package': (_get_packages_to_relocate, ['children_ids', 'quant_ids', 'parent_id'], 10),
|
||||
'stock.quant.package': (_get_packages_to_relocate, ['quant_ids', 'children_ids', 'parent_id'], 10),
|
||||
}, readonly=True),
|
||||
'quant_ids': fields.one2many('stock.quant', 'package_id', 'Bulk Content'),
|
||||
'parent_id': fields.many2one('stock.quant.package', 'Parent Package', help="The package containing this item"),
|
||||
'children_ids': fields.one2many('stock.quant.package', 'parent_id', 'Contained Packages'),
|
||||
'company_id': fields.function(_get_package_info, type="many2one", relation='res.company', string='Company', multi="package"),
|
||||
'company_id': fields.function(_get_package_info, type="many2one", relation='res.company', string='Company', multi="package",
|
||||
store={
|
||||
'stock.quant': (_get_packages, ['company_id'], 10),
|
||||
'stock.quant.package': (_get_packages_to_relocate, ['quant_ids', 'children_ids', 'parent_id'], 10),
|
||||
}, readonly=True),
|
||||
'owner_id': fields.function(_get_package_info, type='many2one', relation='res.partner', string='Owner', multi="package",
|
||||
store={
|
||||
'stock.quant': (_get_packages, ['owner_id'], 10),
|
||||
'stock.quant.package': (_get_packages_to_relocate, ['quant_ids', 'children_ids', 'parent_id'], 10),
|
||||
}, readonly=True),
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda self, cr, uid, context: self.pool.get('ir.sequence').get(cr, uid, 'stock.quant.package') or _('Unknown Pack')
|
||||
|
||||
@@ -614,7 +614,7 @@
|
||||
<field name="lot_id" groups="stock.group_production_lot"/>
|
||||
<field name="package_id" groups="stock.group_tracking_lot"/>
|
||||
<field name="owner_id" groups="stock.group_tracking_owner"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_qty" attrs="{'required': [('product_id', '!=', False)]}"/>
|
||||
<field name="result_package_id" groups="stock.group_tracking_lot"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -1725,6 +1725,7 @@
|
||||
<group>
|
||||
<field name="packaging_id"/>
|
||||
<field name='company_id' groups="base.group_multi_company"/>
|
||||
<field name='owner_id' groups="stock.group_tracking_owner"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="location_id"/>
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
<record id="route_drop_shipping" model='stock.location.route'>
|
||||
<field name="name">Drop Shipping</field>
|
||||
<field name="sequence">3</field>
|
||||
<field name="sale">True</field>
|
||||
<field name="sale_selectable" eval="True"/>
|
||||
<field name="product_categ_selectable" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record id="procurement_rule_drop_shipping" model="procurement.rule">
|
||||
@@ -40,7 +41,9 @@
|
||||
<!-- Crossdock -->
|
||||
<record id="stock_location.route_warehouse0_crossdock" model='stock.location.route'>
|
||||
<field name="name">Crossdock</field>
|
||||
<field name="sale">True</field>
|
||||
<field name="sale_selectable" eval="True"/>
|
||||
<field name="product_categ_selectable" eval="True"/>
|
||||
|
||||
</record>
|
||||
<record id="procurement_rule_customer0_xdock" model="procurement.rule">
|
||||
<field name="name"> Supplier → Output</field>
|
||||
@@ -50,5 +53,7 @@
|
||||
<field name="route_id" ref="stock_location.route_warehouse0_crossdock"/>
|
||||
<field name="picking_type_id" ref="stock.picking_type_in"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -60,4 +60,4 @@
|
||||
sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock"))
|
||||
proc_ids = self.search(cr, uid, [('group_id.name', '=', sale_id.name)])
|
||||
purchase_id = [proc.purchase_id for proc in self.browse(cr, uid, proc_ids) if proc.purchase_id]
|
||||
assert purchase_id, 'No Purchase Quotation is created'
|
||||
assert purchase_id, 'No Purchase Quotation is created'
|
||||
@@ -34,6 +34,9 @@ class stock_location_route(osv.osv):
|
||||
'sequence': fields.integer('Sequence'),
|
||||
'pull_ids': fields.one2many('procurement.rule', 'route_id', 'Pull Rules'),
|
||||
'push_ids': fields.one2many('stock.location.path', 'route_id', 'Push Rules'),
|
||||
'product_selectable': fields.boolean('Selectable on Product'),
|
||||
'product_categ_selectable': fields.boolean('Selectable on Product Category'),
|
||||
'warehouse_selectable': fields.boolean('Selectable on Warehouse'),
|
||||
}
|
||||
_defaults = {
|
||||
'sequence': lambda self,cr,uid,ctx: 0,
|
||||
@@ -42,7 +45,7 @@ class stock_location_route(osv.osv):
|
||||
class stock_warehouse(osv.osv):
|
||||
_inherit = 'stock.warehouse'
|
||||
_columns = {
|
||||
'route_id': fields.many2one('stock.location.route', 'Default Routes', help='Default route through the warehouse', required=True),
|
||||
'route_id': fields.many2one('stock.location.route', 'Default Routes', domain="[('warehouse_selectable', '=', True)]", help='Default route through the warehouse', required=True),
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +174,7 @@ class procurement_order(osv.osv):
|
||||
route_ids = [x.id for x in procurement.route_ids] + [x.id for x in procurement.product_id.route_ids]
|
||||
res = self.pool.get('procurement.rule').search(cr, uid, domain + [('route_id', 'in', route_ids)], order = 'route_sequence, sequence', context=context)
|
||||
if not res:
|
||||
res = self.pool.get('procurement.rule').search(cr, uid, domain, order='sequence', context=context)
|
||||
res = self.pool.get('procurement.rule').search(cr, uid, domain + [('route_id', '=', False)], order='sequence', context=context)
|
||||
return res
|
||||
|
||||
|
||||
@@ -201,13 +204,13 @@ class product_removal_strategy(osv.osv):
|
||||
class product_product(osv.osv):
|
||||
_inherit = 'product.product'
|
||||
_columns = {
|
||||
'route_ids': fields.many2many('stock.location.route', 'stock_location_route_product', 'product_id', 'route_id', 'Routes'),
|
||||
'route_ids': fields.many2many('stock.location.route', 'stock_location_route_product', 'product_id', 'route_id', 'Routes', domain="[('product_selectable', '=', True)]"),
|
||||
}
|
||||
|
||||
class product_category(osv.osv):
|
||||
_inherit = 'product.category'
|
||||
_columns = {
|
||||
'route_ids': fields.many2many('stock.location.route', 'stock_location_route_categ', 'categ_id', 'route_id', 'Routes'),
|
||||
'route_ids': fields.many2many('stock.location.route', 'stock_location_route_categ', 'categ_id', 'route_id', 'Routes', domain="[('product_categ_selectable', '=', True)]"),
|
||||
'removal_strategy_ids': fields.one2many('product.removal', 'product_categ_id', 'Removal Strategies'),
|
||||
#'putaway_strategy_ids': fields.one2many('product.putaway', 'product_categ_id', 'Put Away Strategies'),
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<record id="route_warehouse0_mts" model='stock.location.route'>
|
||||
<field name="name">Sale: Ship only</field>
|
||||
<field name="sequence">20</field>
|
||||
<field name="warehouse_selectable" eval="True"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -49,8 +50,10 @@
|
||||
|
||||
|
||||
<record id="route_warehouse0_mto" model='stock.location.route'>
|
||||
<field name="name">Produce or buy on Customer Order</field>
|
||||
<field name="name">MTO</field>
|
||||
<field name="sequence">10</field>
|
||||
<field name="product_selectable" eval="True"/>
|
||||
<field name="product_categ_selectable" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record id="procurement_rule_customer0_mto" model="procurement.rule">
|
||||
@@ -66,6 +69,8 @@
|
||||
<record id="route_warehouse0_crossdock" model='stock.location.route'>
|
||||
<field name="name">Crossdock</field>
|
||||
<field name="sequence">9</field>
|
||||
<field name="product_categ_selectable" eval="True"/>
|
||||
<field name="sale_selectable" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record id="procurement_rule_customer0_xdock" model="procurement.rule">
|
||||
@@ -81,6 +86,7 @@
|
||||
<record id="route_warehouse0_pack" model='stock.location.route'>
|
||||
<field name="name">Sale: Pack + Ship</field>
|
||||
<field name="sequence">15</field>
|
||||
<field name="warehouse_selectable" eval="True"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -130,6 +136,7 @@
|
||||
<record id="route_warehouse0_pickpack" model='stock.location.route'>
|
||||
<field name="name">Sale: Pick + Pack + Ship</field>
|
||||
<field name="sequence">20</field>
|
||||
<field name="warehouse_selectable" eval="True"/>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
@@ -166,6 +166,9 @@
|
||||
<tree string="Routes">
|
||||
<field name="sequence" widget="handle" />
|
||||
<field name="name"/>
|
||||
<field name="product_categ_selectable"/>
|
||||
<field name="product_selectable"/>
|
||||
<field name="warehouse_selectable"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -178,6 +181,11 @@
|
||||
<form string="Route">
|
||||
<field name="name" />
|
||||
<field name="sequence" groups="base.group_no_one"/>
|
||||
<group>
|
||||
<field name="product_categ_selectable"/>
|
||||
<field name="product_selectable"/>
|
||||
<field name="warehouse_selectable"/>
|
||||
</group>
|
||||
<group string="Push Rules" colspan="4" >
|
||||
<field name="push_ids" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user