<record model="res.request.link" id="request_link_claim_from_delivery">
<field name="name">Delivery Order</field>
- <field name="object">stock.picking.out</field>
+ <field name="object">stock.picking</field>
</record>
</data>
<field name="res_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm_claim.crm_case_claims_tree_view"/>
- <field name="context">{'default_ref': 'stock.picking.out,'+str(context.get('active_id', False))}</field>
- <field name="domain">[('ref','=','stock.picking.out,'+str(context.get('active_id',False)))]</field>
+ <field name="context">{'default_ref': 'stock.picking,'+str(context.get('active_id', False))}</field>
+ <field name="domain">[('ref','=','stock.picking,'+str(context.get('active_id',False)))]</field>
</record>
<record id="crm_claim_from_delivery" model="ir.ui.view">
<field name="name">crm.claim.from_delivery.form</field>
- <field name="model">stock.picking.out</field>
+ <field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="/form/sheet/h1" position="before">
<div class="oe_right oe_button_box">
+ <!-- TODO: Show only when picking type out (or add boolean to picking type)-->
<button name="%(action_claim_from_delivery)d" string="Claims" type="action"/>
</div>
</xpath>
result[line.picking_id.id] = True
return result.keys()
+
_columns = {
'carrier_id':fields.many2one("delivery.carrier","Carrier"),
'volume': fields.float('Volume'),
'weight_uom_id': lambda self,cr,uid,c: self._get_default_uom(cr,uid,c)
}
-# Redefinition of the new fields in order to update the model stock.picking.out in the orm
-# FIXME: this is a temporary workaround because of a framework bug (ref: lp996816). It should be removed as soon as
-# the bug is fixed
-class stock_picking_out(osv.osv):
- _inherit = 'stock.picking.out'
-
- def _cal_weight(self, cr, uid, ids, name, args, context=None):
- return self.pool.get('stock.picking')._cal_weight(cr, uid, ids, name, args, context=context)
-
-
- def _get_picking_line(self, cr, uid, ids, context=None):
- return self.pool.get('stock.picking')._get_picking_line(cr, uid, ids, context=context)
-
- _columns = {
- 'carrier_id':fields.many2one("delivery.carrier","Carrier"),
- 'volume': fields.float('Volume'),
- 'weight': fields.function(_cal_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
- store={
- 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20),
- 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20),
- }),
- 'weight_net': fields.function(_cal_weight, type='float', string='Net Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
- store={
- 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20),
- 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20),
- }),
- 'carrier_tracking_ref': fields.char('Carrier Tracking Ref', size=32),
- 'number_of_packages': fields.integer('Number of Packages'),
- }
-
-class stock_picking_in(osv.osv):
- _inherit = 'stock.picking.in'
-
- def _cal_weight(self, cr, uid, ids, name, args, context=None):
- return self.pool.get('stock.picking')._cal_weight(cr, uid, ids, name, args, context=context)
-
- def _get_picking_line(self, cr, uid, ids, context=None):
- return self.pool.get('stock.picking')._get_picking_line(cr, uid, ids, context=context)
-
- _columns = {
- 'weight': fields.function(_cal_weight, type='float', string='Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
- store={
- 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20),
- 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20),
- }),
- 'weight_net': fields.function(_cal_weight, type='float', string='Net Weight', digits_compute= dp.get_precision('Stock Weight'), multi='_cal_weight',
- store={
- 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 20),
- 'stock.move': (_get_picking_line, ['product_id','product_qty','product_uom','product_uos_qty'], 20),
- }),
- }
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
_description = 'Procurement Requisition'
_order = "id desc"
_columns = {
- 'name': fields.char('Reference'),
+ 'name': fields.char('Reference', required=True),
'partner_id': fields.many2one('res.partner', string = 'Partner'), #Sale should pass it here
'procurement_ids': fields.many2one('procurement.order', 'group_id', 'Procurements'),
}
'payment_term': fields.many2one('account.payment.term', 'Payment Term'),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
'company_id': fields.many2one('res.company', 'Company'),
+ 'procurement_group_id': fields.many2one('procurement.group', 'Procurement group'),
}
_defaults = {
'date_order': fields.date.context_today,
for order in self.browse(cr, uid, ids, context=context):
proc_ids = []
group_id = self.pool.get("procurement.group").create(cr, uid, {'name': order.name, 'sale_id': order.id}, context=context)
+ order.write({'procurement_group_id': group_id}, context=context)
for line in order.order_line:
if (line.state == 'done') or not line.product_id:
continue
'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation and the shipping of the products to the customer", readonly=True, states={'draft': [('readonly', False)]}),
'procurement_id': fields.many2one('procurement.order', 'Procurement'),
#'property_ids': fields.many2many('mrp.property', 'sale_order_line_property_rel', 'order_id', 'property_id', 'Properties', readonly=True, states={'draft': [('readonly', False)]}),
-
-
}
_order = 'order_id desc, sequence, id'
_defaults = {
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
}
-class stock_picking_in(osv.osv):
- _inherit = "stock.picking"
- _columns = {
- 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
- }
-
-class stock_picking_out(osv.osv):
- _inherit = "stock.picking.out"
- _columns = {
- 'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
- }
-
class sale(osv.osv):
_inherit = "sale.order"
access_stock_location__partner_manager,stock.location.partner.manager,model_stock_location,base.group_partner_manager,1,1,1,1
access_stock_location_manager,stock.location.manager,model_stock_location,stock.group_stock_manager,1,1,1,1
access_stock_location_user,stock.location.user,model_stock_location,base.group_user,1,0,0,0
-access_stock_journal_user,stock.journal.user,model_stock_journal,base.group_user,1,0,0,0
-access_stock_journal_manager,stock.journal.manager,model_stock_journal,stock.group_stock_manager,1,1,1,1
access_stock_picking_user,stock.picking user,model_stock_picking,stock.group_stock_user,1,1,1,1
access_stock_picking_manager,stock.picking manager,model_stock_picking,stock.group_stock_manager,1,1,0,0
access_stock_production_lot_manager,stock.production.lot manager,model_stock_production_lot,stock.group_stock_manager,1,0,0,0
'active': True,
}
-class stock_journal(osv.osv):
- _name = "stock.journal"
- _description = "Inventory Journal"
- _columns = {
- 'name': fields.char('Stock Journal', size=32, required=True),
- 'user_id': fields.many2one('res.users', 'Responsible'),
- }
- _defaults = {
- 'user_id': lambda s, c, u, ctx: u
- }
-
#----------------------------------------------------------
# Stock Location
#----------------------------------------------------------
'backorder_id': fields.many2one('stock.picking', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
#'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."),
'note': fields.text('Notes', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
- 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
'move_type': fields.selection([('direct', 'Partial'), ('one', 'All at once')], 'Delivery Method', required=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="It specifies goods to be deliver partially or all at once"),
'state': fields.function(_get_state, type="selection", store = {'stock.move': (_get_pickings, ['state'], 20)}, selection = [
('draft', 'Draft'),
This will create a procurement order
"""
proc_obj = self.pool.get("procurement.order")
- origin = _('Procurement created by stock move %s') % move.id
+ origin = _('Procurement from created by rule %s') % (move.group_id and move.group_id.name or "", move.rule_id and move.rule_id.name or "")
return proc_obj.create(cr, uid, {
- 'name': _('MTO procurement'),
+ 'name': _('MTO procurement from rule %s') % move.rule_id and move.rule_id.name or "",
'origin': origin,
'company_id': move.company_id and move.company_id.id or False,
'date_planned': move.date,
original_picking = pick_obj.browse(cr, uid, context.get('backorder_of'), context=context)
new_picking_name = original_picking.name
#TODO back_order_name is False currently => find why
- back_order_name = sequence_obj.get(cr, uid, 'stock.picking') #TODO: Need to have sequence for every picking type
+ back_order_name = sequence_obj.get_by_id(cr, uid, original_picking.picking_type_id.id, 'id') #TODO: Need to have sequence for every picking type
pick_obj.write(cr, uid, [original_picking.id], {'name': back_order_name})
pick = pick_obj.copy(cr, uid, original_picking.id, {'name': new_picking_name,
'move_lines': [],
'company_id': move.company_id and move.company_id.id or False,
'move_type': 'one',
'partner_id': move.partner_id and move.partner_id.id or False,
+ 'date_done': move.date_expected,
#'invoice_state': move.invoice_state
'state': 'confirmed',
'group_id': move.group_id and move.group_id.id or False,
<?xml version="1.0" encoding="utf-8"?>
<openerp>
+ <data>
+ <!--
+ Picking types
+ -->
+
+ <!-- Sequences for picking types -->
+ <record id="seq_picking_type_in" model="ir.sequence">
+ <field name="name">Picking in</field>
+ <field name="prefix">IN</field>
+ <field name="padding">5</field>
+ <field name="company_id" eval="False"/>
+ </record>
+
+ <record id="seq_picking_type_out" model="ir.sequence">
+ <field name="name">Picking out</field>
+ <field name="prefix">OUT</field>
+ <field name="padding">5</field>
+ <field name="company_id" eval="False"/>
+ </record>
+
+ <record id="seq_picking_type_internal" model="ir.sequence">
+ <field name="name">Picking internal</field>
+ <field name="prefix">INT</field>
+ <field name="padding">5</field>
+ <field name="company_id" eval="False"/>
+ </record>
+
+ <record id="picking_type_in" model="stock.picking.type">
+ <field name="name">in</field>
+ <field name="sequence_id" ref="seq_picking_type_in"/>
+ </record>
+
+
+ <record id="picking_type_out" model="stock.picking.type">
+ <field name="name">out</field>
+ <field name="sequence_id" ref="seq_picking_type_out"/>
+ </record>
+
+ <record id="picking_type_internal" model="stock.picking.type">
+ <field name="name">internal</field>
+ <field name="sequence_id" ref="seq_picking_type_internal"/>
+ </record>
+
+ </data>
<data noupdate="1">
<!-- notify all employees of module installation -->
<record model="mail.message" id="module_install_notification">
<field name="location_id" ref="stock_location_locations"/>
</record>
- <record id="journal_delivery" model="stock.journal">
- <field name="name">Delivery Orders</field>
- </record>
<record id="stock_location_output" model="stock.location">
<field name="name">Output</field>
<field name="location_id" ref="stock_location_company"/>
</record>
- <!--
- Picking types
- -->
-
- <!-- Sequences for picking types -->
- <record id="seq_picking_type_in" model="ir.sequence">
- <field name="name">Picking in</field>
- <field name="prefix">IN</field>
- <field name="padding">5</field>
- <field name="company_id" eval="False"/>
- </record>
-
- <record id="seq_picking_type_out" model="ir.sequence">
- <field name="name">Picking out</field>
- <field name="prefix">OUT</field>
- <field name="padding">5</field>
- <field name="company_id" eval="False"/>
- </record>
-
- <record id="seq_picking_type_internal" model="ir.sequence">
- <field name="name">Picking internal</field>
- <field name="prefix">INT</field>
- <field name="padding">5</field>
- <field name="company_id" eval="False"/>
- </record>
-
- <record id="seq_picking_type_inventory" model="ir.sequence">
- <field name="name">Picking inventory</field>
- <field name="prefix">INV</field>
- <field name="padding">5</field>
- <field name="company_id" eval="False"/>
- </record>
-
- <record id="picking_type_in" model="stock.picking.type">
- <field name="name">in</field>
- <field name="sequence_id" ref="seq_picking_type_in"/>
- </record>
-
-
- <record id="picking_type_out" model="stock.picking.type">
- <field name="name">out</field>
- <field name="sequence_id" ref="seq_picking_type_out"/>
- </record>
-
- <record id="picking_type_internal" model="stock.picking.type">
- <field name="name">internal</field>
- <field name="sequence_id" ref="seq_picking_type_internal"/>
- </record>
- <record id="picking_type_inventory" model="stock.picking.type">
- <field name="name">inventory</field>
- <field name="sequence_id" ref="seq_picking_type_inventory"/>
- </record>
<!--
Sequences for pickings
-->
- <!--<record id="seq_picking_in" model="ir.sequence">
- <field name="name">Picking IN</field>
- <field name="code">stock.picking.in</field>
- <field name="prefix">IN/</field>
- <field name="padding">5</field>
- <field name="company_id" eval="False"/>
- </record>
-
- <record id="seq_picking_out" model="ir.sequence">
- <field name="name">Picking OUT</field>
- <field name="code">stock.picking.out</field>
- <field name="prefix">OUT/</field>
- <field name="padding">5</field>
- <field name="company_id" eval="False"/>
- </record>-->
+
<record id="seq_picking_internal" model="ir.sequence">
<field name="name">Picking INT</field>
<field name="origin"/>
<field name="date"/>
<field name="min_date"/>
- <field name="stock_journal_id" widget="selection"/>
<field name="state"/>
</tree>
</field>
<group>
<field name="partner_id"/>
<field name="backorder_id" readonly="1" attrs="{'invisible': [('backorder_id','=',False)]}"/>
- <field name="stock_journal_id" widget="selection"/>
+ <field name="picking_type_id"/>
</group>
<group>
<field name="date"/>
<group>
<group>
<field name="move_type"/>
- <field name="picking_type_id"/>
</group>
<group>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<filter icon="terp-dialog-close" name="done" string="Done" domain="[('state','=','done')]" help="Pickings already processed"/>
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<field name="product_id"/>
- <field name="stock_journal_id"/>
+ <field name="picking_type_id"/>
<group expand="0" string="Group By...">
<filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected Date" icon="terp-go-month" domain="[]" context="{'group_by':'min_date'}"/>
- <filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
- <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'stock_journal_id'}"/>
+ <filter string="Origin" domain="[]" context="{'group_by':'origin'}"/>
+ <filter string="Picking Type" domain="[]" context="{'group_by':'picking_type_id'}"/>
</group>
</search>
</field>
<menuitem action="action_out_picking_move" id="menu_action_pdct_out" parent="menu_stock_products_moves" sequence="2"/>
- <record id="view_stock_journal_filter" model="ir.ui.view">
- <field name="name">stock.journal.filter</field>
- <field name="model">stock.journal</field>
+ <record id="view_pickingtype_filter" model="ir.ui.view">
+ <field name="name">stock.picking.type.filter</field>
+ <field name="model">stock.picking.type</field>
<field name="arch" type="xml">
- <search string="Stock Journal">
- <field name="name" string="Stock Journal"/>
- <field name="user_id"/>
+ <search string="Picking Type">
+ <field name="name" string="Picking Type"/>
+ <field name="sequence_id"/>
</search>
</field>
</record>
- <record model="ir.ui.view" id="view_stock_journal_tree">
- <field name="name">Stock Journals</field>
- <field name="model">stock.journal</field>
+ <record model="ir.ui.view" id="view_picking_type_tree">
+ <field name="name">Picking types</field>
+ <field name="model">stock.picking.type</field>
<field name="arch" type="xml">
- <tree string="Stock Journal">
+ <tree string="Picking Types">
<field name="name"/>
- <field name="user_id"/>
+ <field name="sequence_id"/>
+ <field name="pack"/>
</tree>
</field>
</record>
- <record model="ir.ui.view" id="view_stock_journal_form">
- <field name="name">Stock Journals</field>
- <field name="model">stock.journal</field>
+ <record model="ir.ui.view" id="view_picking_type_form">
+ <field name="name">Picking Types</field>
+ <field name="model">stock.picking.type</field>
<field name="arch" type="xml">
- <form string="Stock Journal" version="7.0">
+ <form string="Picking Types" version="7.0">
<group>
<field name="name"/>
- <field name="user_id"/>
+ <field name="sequence_id"/>
+ <field name="pack"/>
</group>
</form>
</field>
</record>
- <record id="action_stock_journal_form" model="ir.actions.act_window">
- <field name="name">Stock Journals</field>
- <field name="res_model">stock.journal</field>
+ <record id="action_picking_type_form" model="ir.actions.act_window">
+ <field name="name">Picking Types</field>
+ <field name="res_model">stock.picking.type</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
- Click to create a new journal.
+ Click to create a new picking type.
</p><p>
- The stock journal system allows you to assign each stock
- operation to a specific journal according to the type of
- operation to perform or the worker/team that should perform the
- operation. Examples of stock journals may be: quality control,
- pick lists, packing, etc.
+ The picking type system allows you to assign each stock
+ operation a specific type which will alter its views accordingly.
+ On the picking type you could e.g. specify if packing is needed by default,
+ if it should show the customer.
+ <br/>
+ Examples are in, out, internal, packing, quality control, ...
</p>
</field>
</record>
<menuitem
- action="action_stock_journal_form"
- id="menu_action_stock_journal_form"
+ action="action_picking_type_form"
+ id="menu_action_picking_type_form"
parent="menu_warehouse_config" sequence="1"/>
<!-- Order Point -->
<?xml version="1.0"?>
<openerp>
<data>
- <!-- Picking type dropship-->
+ <!-- Sequence and picking type dropship-->
+
+ <record id="seq_picking_type_dropship" model="ir.sequence">
+ <field name="name">Dropship</field>
+ <field name="prefix">DS</field>
+ <field name="padding">5</field>
+ <field name="company_id" eval="False"/>
+ </record>
+
<record id="picking_type_dropship" model="stock.picking.type">
<field name="name">dropship</field>
+ <field name="sequence_id" ref="seq_picking_type_dropship"/>
</record>
+
+
<!-- Drop Shipping-->
<record id="route_drop_shipping" model='stock.location.route'>
<field name="name">Drop Shipping</field>
<!-- Crossdock -->
+ <record id="stock_location.route_warehouse0_crossdock" model='stock.location.route'>
+ <field name="name">Crossdock</field>
+ <field name="sale">True</field>
+ </record>
<record id="procurement_rule_customer0_xdock" model="procurement.rule">
<field name="name"> Supplier → Output</field>
<field name="action">buy</field>
'location_dest_id': rule.location_dest_id.id
})
vals = {}
-# TODO journal_id was to be removed?
-# if route.journal_id:
-# vals['stock_journal_id'] = route.journal_id.id
vals['type'] = rule.picking_type
if rule.location_dest_id.id<>move.location_dest_id.id:
move_obj._push_apply(self, cr, uid, move.id, context)
<record id="product.product_product_9" model="product.product">
<field name="description">This product is configured with example of push/pull flows</field>
</record>
- <record id="stock_journal_quality" model="stock.journal">
- <field name="name">Quality Control</field>
- </record>
<record id="stock_location_qualitytest0" model="stock.location">
<field name="location_id" ref="stock.stock_location_company"/>
--
- !record {model: stock.journal, id: journal_pick}:
- name: Pick List
--
- !record {model: stock.journal, id: journal_pack}:
- name: Packing
--
- !record {model: stock.journal, id: journal_gate_a}:
- name: Delivery Gate A
--
- !record {model: stock.journal, id: journal_gate_b}:
- name: Delivery Gate B
-
!record {model: stock.location, id: location_order}:
name: Order Processing
product_id: product.product_product_10
location_from_id: stock.stock_location_output
location_dest_id: location_pack_zone
- picking_type_id: stock.picking_type_internal
+ picking_type_id: stock.picking_type_internal
\ No newline at end of file
# FIXME:(class stock_picking_in and stock_picking_out) this is a temporary workaround because of a framework bug (ref: lp:996816).
# It should be removed as soon as the bug is fixed
-class stock_picking_in(osv.osv):
- _inherit = 'stock.picking.in'
+class stock_picking(osv.osv):
+ _inherit = 'stock.picking'
def onchange_partner_in(self, cr, uid, ids, partner_id=None, context=None):
if not partner_id:
return {'value': result.get('value',{}), 'warning':warning}
-class stock_picking_out(osv.osv):
- _inherit = 'stock.picking.out'
-
- def onchange_partner_in(self, cr, uid, ids, partner_id=None, context=None):
- if not partner_id:
- return {}
- partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
- warning = {}
- title = False
- message = False
- if partner.picking_warn != 'no-message':
- if partner.picking_warn == 'block':
- raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg)
- title = _("Warning for %s") % partner.name
- message = partner.picking_warn_msg
- warning = {
- 'title': title,
- 'message': message
- }
- result = super(stock_picking_out, self).onchange_partner_in(cr, uid, ids, partner_id, context)
- if result.get('warning',False):
- warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
- warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
-
- return {'value': result.get('value',{}), 'warning':warning}
-
class product_product(osv.osv):
_inherit = 'product.product'
_columns = {