[MERGE:IMP] merge addons-stock branch with latest improvement to Warehouse Management

bzr revid: odo@openerp.com-20101011175802-n705sldw70bp4xpx
This commit is contained in:
Olivier Dony 2010-10-11 19:58:02 +02:00
commit 788881af5d
85 changed files with 1759 additions and 1732 deletions

View File

@ -112,13 +112,29 @@ class account_analytic_line(osv.osv):
(prod.name, prod_id,))
amount_unit = prod.price_get('list_price', context)[prod_id]
prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
amount = amount_unit * quantity or 1.0
result = round(amount, prec)
if is_purchase:
result *= -1
return {
'value': {
if not company_id:
company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context)
flag = False
# Compute based on pricetype
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','standard_price')], context)
pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0]
if journal_id:
journal = analytic_journal_obj.browse(cr, uid, journal_id)
if journal.type == 'sale':
product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context)
if product_price_type_ids:
pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0]
# Take the company currency as the reference one
if pricetype.field == 'list_price':
flag = True
amount_unit = prod.price_get(pricetype.field, context)[prod.id]
amount = amount_unit*unit_amount or 1.0
prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
amount = amount_unit*unit_amount or 1.0
result = round(amount, prec)
if not flag:
result *= -1
return {'value': {
'amount': result,
'general_account_id': a,
}

View File

@ -68,6 +68,6 @@
<menuitem id="menu_dashboard_acc" name="Dashboard" sequence="2" parent="account.menu_finance_reporting" groups="group_account_user,group_account_manager"/>
<menuitem action="open_board_account" icon="terp-graph" id="menu_board_account" parent="menu_dashboard_acc" sequence="1"/>
<menuitem icon="terp-account" id="account.menu_finance" name="Accounting" sequence="13" action="open_board_account"/>
</data>
</openerp>

View File

@ -9,7 +9,7 @@
<field name="arch" type="xml">
<notebook position="inside">
<page string="Accounting">
<group groups="base.group_extended">
<group name="properties" groups="base.group_extended">
<separator string="Sales Properties" colspan="2"/>
<separator string="Purchase Properties" colspan="2"/>
<field name="property_account_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" groups="base.group_extended"/>

View File

@ -19,8 +19,7 @@
#
##############################################################################
from datetime import datetime
from osv import fields,osv,orm
from osv import fields,osv
from tools.translate import _
import crm
import time
@ -121,7 +120,7 @@ class crm_opportunity(osv.osv):
"""
res = super(crm_opportunity, self).case_reset(cr, uid, ids, *args)
self.write(cr, uid, ids, {'stage_id': False})
return True
return res
def case_open(self, cr, uid, ids, *args):

View File

@ -27,7 +27,7 @@ import pooler
class decimal_precision(osv.osv):
_name = 'decimal.precision'
_columns = {
'name': fields.char('Usage', size=50, required=True),
'name': fields.char('Usage', size=50, select=True, required=True),
'digits': fields.integer('Digits', required=True),
}
_defaults = {
@ -35,7 +35,7 @@ class decimal_precision(osv.osv):
}
_sql_constraints = [
('name_uniq', 'unique (name)', """The Usage of the decimal precision must be unique!"""),
('name_uniq', 'unique (name)', """Only one value can be defined for each given usage!"""),
]
@cache(skiparg=3)

View File

@ -31,10 +31,8 @@ TEMPLATE_ENGINES = []
from osv import osv, fields
from tools.translate import _
from mako.template import Template #For backward combatibility
try:
from mako.template import Template as MakoTemplate
from mako import exceptions
TEMPLATE_ENGINES.append(('mako', 'Mako Templates'))
except:
LOGGER.notifyChannel(
@ -302,7 +300,6 @@ This is useful for CRM leads for example"),
def unlink_action(self, cr, uid, ids, context):
for template in self.browse(cr, uid, ids, context):
obj = self.pool.get(template.object_name.model)
try:
if template.ref_ir_act_window:
self.pool.get('ir.actions.act_window').unlink(cr, uid, template.ref_ir_act_window.id, context)

View File

@ -19,11 +19,10 @@
#
##############################################################################
import time
from crm import crm
from osv import fields, osv
from tools.translate import _
import time
import tools
import decimal_precision as dp
@ -37,7 +36,7 @@ class event_type(osv.osv):
}
event_type()
class event_event(crm.crm_case, osv.osv):
class event_event(osv.osv):
"""Event"""
_name = 'event.event'
_description = __doc__
@ -55,7 +54,6 @@ class event_event(crm.crm_case, osv.osv):
'registration_ids': False,
})
return super(event_event, self).copy(cr, uid, id, default=default, context=context)
def onchange_product(self, cr, uid, ids, product_id):
"""This function returns value of product's unit price based on product id.
@param self: The object pointer
@ -157,14 +155,11 @@ class event_event(crm.crm_case, osv.osv):
('event_id', '=', event.id),
('state', 'in', state)])
number = 0.0
if reg_ids:
cr.execute('select sum(nb_register) from event_registration where id IN %s', (tuple(reg_ids),))
number = cr.fetchone()
if 'register_current' in fields:
res[event.id]['register_current'] = number and number[0]
res[event.id]['register_current'] = len(reg_ids)
if 'register_prospect' in fields:
res[event.id]['register_prospect'] = number and number[0]
res[event.id]['register_prospect'] = len(reg_ids)
return res
def write(self, cr, uid, ids, vals, context=None):
@ -238,7 +233,7 @@ class event_event(crm.crm_case, osv.osv):
type='many2one', relation='res.country', string='Country', readonly=False, states={'done': [('readonly', True)]}),
'language': fields.char('Language',size=64, readonly=False, states={'done': [('readonly', True)]}),
'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}),
'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
}
@ -246,7 +241,6 @@ class event_event(crm.crm_case, osv.osv):
'state': 'draft',
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'event.event', context=c),
'user_id': lambda obj, cr, uid, context: uid,
'section_id': crm.crm_case._get_section,
}
def _check_recursion(self, cr, uid, ids):
@ -341,8 +335,8 @@ class event_registration(osv.osv):
_defaults = {
'nb_register': 1,
'tobe_invoiced': True,
'state': 'draft',
'active': True,
'state': lambda *a: 'draft',
'active': lambda *a: 1,
'user_id': lambda self, cr, uid, ctx: uid,
}
@ -358,9 +352,6 @@ class event_registration(osv.osv):
val_invoice = inv_pool.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
val_invoice['value'].update({'partner_id': reg.partner_invoice_id.id})
inv_lines_pool.product_id_change(cr, uid, [], reg.event_id.product_id.id, uom =False, partner_id=reg.partner_invoice_id.id, fposition_id=reg.partner_invoice_id.property_account_position.id)
val_invoice['value'].update({
'origin': reg.event_product,
'reference': False,
@ -592,6 +583,7 @@ class event_registration(osv.osv):
data ={}
if not contact:
return data
contact_obj = self.pool.get('res.partner.contact')
addr_obj = self.pool.get('res.partner.address')
job_obj = self.pool.get('res.partner.job')
@ -666,6 +658,7 @@ class event_registration(osv.osv):
data['contact_id'] = job_obj.browse(cr, uid, job_ids[0]).contact_id.id
d = self.onchange_contact_id(cr, uid, ids, data['contact_id'], part)
data.update(d['value'])
partner_data = res_obj.browse(cr, uid, part)
return {'value': data}
def onchange_partner_invoice_id(self, cr, uid, ids, event_id, partner_invoice_id):
@ -712,4 +705,5 @@ class event_registration_badge(osv.osv):
}
event_registration_badge()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -83,7 +83,6 @@ class report_custom(report_rml):
dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
if att['action'] == 'sign_out':
week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + ((dt - ldt).seconds/3600)
ldt = dt
# Week xml representation
week_repr = ['<week>', '<weekstart>%s</weekstart>' % monday.strftime('%Y-%m-%d'), '<weekend>%s</weekend>' % n_monday.strftime('%Y-%m-%d')]

View File

@ -253,10 +253,8 @@ class hr_expense_line(osv.osv):
product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
v['name'] = product.name
# Compute based on pricetype of employee company
pricetype_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).user_id.company_id.property_valuation_price_type.id
context['currency_id'] = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).user_id.company_id.currency_id.id
pricetype = self.pool.get('product.price.type').browse(cr, uid, pricetype_id, context=context)
amount_unit = product.price_get(pricetype.field, context)[product.id]
amount_unit = product.price_get('standard_price', context)[product.id]
v['unit_amount'] = amount_unit
if not uom_id:
v['uom_id'] = product.uom_id.id

View File

@ -15,7 +15,7 @@
<child1>
<action colspan="4" height="200" name="%(mrp.mrp_production_action2)d" string="Next production orders" width="510"/>
<action colspan="4" name="%(stock.action_picking_tree)d" string="Deliveries (Out picking)" domain="[('state','=','assigned'),('type','=','out')]"/>
<action colspan="4" name="%(procurement.procurement_action4)d" string="Procurements in Exception"/>
<action colspan="4" name="%(procurement.procurement_exceptions)d" string="Procurements in Exception"/>
</child1>
<child2>
<action colspan="4" name="%(mrp.action_report_workcenter_load_tree)d" string="Work Center future load"/>

View File

@ -861,7 +861,7 @@ class mrp_production(osv.osv):
source = production.product_id.product_tmpl_id.property_stock_production.id
data = {
'name':'PROD:' + production.name,
'date_planned': production.date_planned,
'date': production.date_planned,
'product_id': production.product_id.id,
'product_qty': production.product_qty,
'product_uom': production.product_uom.id,
@ -883,7 +883,7 @@ class mrp_production(osv.osv):
if line.product_id.type in ('product', 'consu'):
res_dest_id = move_obj.create(cr, uid, {
'name':'PROD:' + production.name,
'date_planned': production.date_planned,
'date': production.date_planned,
'product_id': line.product_id.id,
'product_qty': line.product_qty,
'product_uom': line.product_uom.id,
@ -904,7 +904,7 @@ class mrp_production(osv.osv):
'product_uom': line.product_uom.id,
'product_uos_qty': line.product_uos and line.product_uos_qty or False,
'product_uos': line.product_uos and line.product_uos.id or False,
'date_planned': newdate,
'date': newdate,
'move_dest_id': res_dest_id,
'location_id': production.location_src_id.id,
'location_dest_id': routing_loc or production.location_src_id.id,

View File

@ -5,10 +5,9 @@
<menuitem icon="terp-mrp" id="base.menu_mrp_root" parent="" name="Manufacturing"
groups="group_mrp_user,group_mrp_manager,base.group_system" sequence="8"/>
<menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="5"/>
<menuitem id="menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="5"/>
<menuitem id="menu_mrp_manufacturing" name="Manufacturing" parent="base.menu_mrp_root" sequence="1"/>
<menuitem name="Master Data"
id="menu_mrp_bom"
parent="base.menu_mrp_root"
@ -487,24 +486,9 @@
</field>
</record>
<!--
Procurement
-->
<menuitem action="procurement.procurement_action" id="base.menu_mrp_procurement_action"
parent="mrp.menu_mrp_manufacturing" sequence="3" />
<menuitem id="menu_mrp_scheduler" name="Schedulers" parent="base.menu_mrp_root" groups="base.group_system,mrp.group_mrp_user,mrp.group_mrp_manager" sequence="3"/>
<menuitem action="procurement.action_compute_schedulers" id="base.mrp_Sched_all" parent="mrp.menu_mrp_scheduler" sequence="90" groups="base.group_system,mrp.group_mrp_user,mrp.group_mrp_manager"/>
<!--
Order Point
-->
<menuitem action="procurement.action_orderpoint_form" id="menu_action_orderpoint_form" parent="mrp.menu_mrp_reordering"/>
<!--
Production Management
-->
<record id="mrp_production_tree_view" model="ir.ui.view">
<field name="name">mrp.production.tree</field>
<field name="model">mrp.production</field>

View File

@ -16,7 +16,7 @@
<record id="process_node_minimumstockrule0" model="process.node">
<field name="menu_id" ref="mrp.menu_action_orderpoint_form"/>
<field name="menu_id" ref="procurement.menu_stock_order_points"/>
<field name="model_id" ref="procurement.model_stock_warehouse_orderpoint"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Linked to the 'Minimum stock rule' supplying method.&quot;&quot;&quot;" name="note"/>
@ -26,7 +26,7 @@
</record>
<record id="process_node_stockproduct0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Product type is Stockable or Consumable.&quot;&quot;&quot;" name="note"/>
@ -38,7 +38,7 @@
</record>
<record id="process_node_stockproduct1" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;For stockable products and consumables&quot;&quot;&quot;" name="note"/>
@ -50,7 +50,7 @@
</record>
<record id="process_node_serviceproduct0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Product type is service&quot;&quot;&quot;" name="note"/>
@ -62,7 +62,7 @@
</record>
<record id="process_node_serviceproduct1" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;For Services.&quot;&quot;&quot;" name="note"/>
@ -74,7 +74,7 @@
</record>
<record id="process_node_purchaseprocure0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Procurement Orders&quot;&quot;&quot;" name="name"/>
@ -85,7 +85,7 @@
</record>
<record id="process_node_productminimumstockrule0" model="process.node">
<field name="menu_id" ref="mrp.menu_action_orderpoint_form"/>
<field name="menu_id" ref="procurement.menu_stock_order_points"/>
<field name="model_id" ref="procurement.model_stock_warehouse_orderpoint"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Minimum Stock&quot;&quot;&quot;" name="name"/>
@ -118,7 +118,7 @@
Process Transition
-->
<record id="process_node_procureproducts0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;The way to procurement depends on the product type.&quot;&quot;&quot;" name="note"/>

View File

@ -9,7 +9,7 @@
<record id="process_node_servicemts0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from stock.&quot;&quot;&quot;" name="note"/>

View File

@ -17,7 +17,7 @@
-->
<record id="process_node_mts0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from stock.&quot;&quot;&quot;" name="note"/>
@ -28,7 +28,7 @@
</record>
<record id="process_node_stock0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from Production or Purchase Order.&quot;&quot;&quot;" name="note"/>

View File

@ -71,7 +71,7 @@ class report_mrp_inout(osv.osv):
create or replace view report_mrp_inout as (
select
min(sm.id) as id,
to_char(sm.date_planned,'YYYY:IW') as date,
to_char(sm.date,'YYYY:IW') as date,
sum(case when (sl.usage='internal') then
pt.standard_price * sm.product_qty
else
@ -94,7 +94,7 @@ class report_mrp_inout(osv.osv):
where
sm.state in ('waiting','confirmed','assigned')
group by
to_char(sm.date_planned,'YYYY:IW')
to_char(sm.date,'YYYY:IW')
)""")
report_mrp_inout()

View File

@ -79,7 +79,7 @@ class StockMove(osv.osv):
proc_id = procurement_obj.create(cr, uid, {
'name': (move.picking_id.origin or ''),
'origin': (move.picking_id.origin or ''),
'date_planned': move.date_planned,
'date_planned': move.date,
'product_id': line['product_id'],
'product_qty': line['product_qty'],
'product_uom': line['product_uom'],

View File

@ -8,7 +8,6 @@
company_id: base.main_company
date: '2010-06-24 20:10:28'
date_expected: '2010-06-24 20:10:55'
date_planned: '2010-06-24 20:10:28'
location_dest_id: stock.stock_location_stock
location_id: stock.stock_location_stock
name: '[PC1] Basic PC'

View File

@ -83,7 +83,7 @@ class mrp_production(osv.osv):
qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
data = {
'name': 'PROD:'+production.name,
'date_planned': production.date_planned,
'date': production.date_planned,
'product_id': sub_product.product_id.id,
'product_qty': qty1,
'product_uom': sub_product.product_uom.id,

View File

@ -206,8 +206,7 @@ class pos_return(osv.osv_memory):
'product_id': line.product_id.id,
'location_dest_id': stock_dest_id,
'name': '%s (return)' %order_id.name,
'date': date_cur,
'date_planned': date_cur
'date': date_cur
})
if qty != 0.0:
line_obj.copy(cr, uid, line.id, {'qty': -qty, 'order_id': new_order})
@ -294,8 +293,7 @@ class add_product(osv.osv_memory):
'product_id':prod_id.id,
'location_dest_id':stock_dest_id,
'name':'%s (return)' %order_id.name,
'date':date_cur,
'date_planned':date_cur
'date':date_cur
})
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
@ -371,7 +369,6 @@ class add_product(osv.osv_memory):
'location_dest_id':stock_dest_id,
'name':'%s (return)' % order_id.name,
'date':date_cur,
'date_planned':date_cur
})
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)

View File

@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="procurement_action_board" model="ir.actions.act_window">
<field name="name">Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception')]</field>
<field name="view_id" ref="procurement.procurement_tree_view_board"/>
</record>
<record id="board_mrp_procurement_form" model="ir.ui.view">
<field name="name">board.mrp.procurement.form</field>
<field name="model">board.board</field>
@ -8,7 +17,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/hpaned/child1" position="inside">
<action colspan="4" name="%(procurement.procurement_action5)d" string="Procurement Exceptions" width="510" />
<action colspan="4" name="%(procurement_action_board)d" string="Procurement Exceptions" width="510" />
</xpath>
</field>
</record>

View File

@ -12,7 +12,7 @@
<field eval="1" name="active"/>
</record>
<record id="process_node_procureproducts0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="menu_stock_procurement_action"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;The way to procurement depends on the product type.&quot;&quot;&quot;" name="note"/>
@ -28,7 +28,7 @@
<field eval="1" name="active"/>
</record>
<record id="process_node_serviceonorder0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="menu_stock_procurement_action"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from Production or Purchase Order.&quot;&quot;&quot;" name="note"/>

View File

@ -157,34 +157,19 @@ class procurement_order(osv.osv):
""" Checks product type.
@return: True or False
"""
for procurement in self.browse(cr, uid, ids):
if procurement.product_id.type in ('product', 'consu'):
return True
return False
return all(procurement.product_id.type in ('product', 'consu') for procurement in self.browse(cr, uid, ids))
def check_move_cancel(self, cr, uid, ids, context={}):
""" Checks if move is cancelled or not.
@return: True or False.
"""
res = True
ok = False
for procurement in self.browse(cr, uid, ids, context):
if procurement.move_id:
ok = True
if not procurement.move_id.state == 'cancel':
res = False
return res and ok
return all(procurement.move_id.state == 'cancel' for procurement in self.browse(cr, uid, ids))
def check_move_done(self, cr, uid, ids, context={}):
""" Checks if move is done or not.
@return: True or False.
"""
res = True
for proc in self.browse(cr, uid, ids, context):
if proc.move_id:
if not proc.move_id.state == 'done':
res = False
return res
return all(procurement.move_id.state == 'done' for procurement in self.browse(cr, uid, ids))
#
# This method may be overrided by objects that override procurement.order
@ -343,7 +328,7 @@ class procurement_order(osv.osv):
'product_id': procurement.product_id.id,
'product_qty': procurement.product_qty,
'product_uom': procurement.product_uom.id,
'date_planned': procurement.date_planned,
'date_expected': procurement.date_planned,
'state': 'draft',
'company_id': procurement.company_id.id,
})

View File

@ -23,6 +23,21 @@
<field name="name" invisible="1"/>
</tree>
</field>
</record>
<record id="procurement_tree_view_board" model="ir.ui.view">
<field name="name">procurement.order.tree.board</field>
<field name="model">procurement.order</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Procurement Lines" colors="red:date_planned&lt;current_date and state in ('exception');black:state=='running';darkgreen:state=='confirmed';gray:state in ['done','cancel'];blue:state in ('ready')">
<field name="date_planned" widget="date"/>
<field name="origin"/>
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom" string="UOM"/>
<field name="message"/>
</tree>
</field>
</record>
<record id="procurement_form_view" model="ir.ui.view">
<field name="name">procurement.order.form</field>
@ -85,11 +100,13 @@
<search string="Search Procurement">
<group col='10' colspan='4'>
<filter icon="terp-check" string="Current" domain="[('state','in',('draft','confirmed'))]" name="current" help="Procurement Orders in draft or open state."/>
<filter icon="terp-emblem-important" string="Exceptions" domain="[('state','=','exception')]" help="Procurement Orders with exceptions"/>
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
domain="['&amp;', ('date_planned::date','&lt;', current_date), ('state', 'in', ('draft', 'confirmed'))]"
help="Procurement started late" />
<filter icon="terp-gtk-go-back-rtl" string="To Fix" domain="[('state', '=', 'exception'),('message','=','')]" help="Procurement Orders with exceptions and without message"/>
<separator orientation="vertical"/>
<filter icon="terp-emblem-important" string="Exceptions" name="exceptions" domain="[('state','=','exception')]" help="Procurement Exceptions"/>
<filter icon="terp-emblem-important" string="To Fix" name="perm_exceptions" domain="[('state','=','exception'),('message', '!=', '')]" help="Permanent Procurement Exceptions"/>
<filter icon="terp-emblem-important" string="Temporary" name="temp_exceptions" domain="[('state','=','exception'),('message', '=', '')]" help="Temporary Procurement Exceptions"/>
<separator orientation="vertical"/>
<field name="origin"/>
<field name="product_id" />
@ -106,29 +123,29 @@
</search>
</field>
</record>
<record id="procurement_action" model="ir.actions.act_window">
<field name="name">Procurement Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="context">{'search_default_current':1}</field>
<field name="search_view_id" ref="view_procurement_filter"/>
<field name="context">{'search_default_Current':1}</field>
<field name="help">The procurement order will schedule a proposal for automatic procurement for the product concerned. This procurement will start a task, a purchase order form for the supplier or a production depending on the product configuration.</field>
<field name="context">{'search_default_current':1}</field>
<field name="help">Procurement Orders represent the need for a certain quantity of products, at a given time, in a given location. Sale Orders are one typical source of Procurement Orders (but these are distinct documents). Depending on the procurement parameters and the products configuration, the procurement engine will attempt to satisfy the need by reserving products from stock, or ordering products from a supplier, or passing a manufacturing order, etc.</field>
</record>
<record id="procurement_action3" model="ir.actions.act_window">
<field name="name">Procurements</field>
<record id="procurement_exceptions" model="ir.actions.act_window">
<field name="name">Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'search_default_perm_exceptions':1}</field>
<field name="search_view_id" ref="view_procurement_filter"/>
<field name="domain">[]</field>
<field name="context">{}</field>
<field name="help">Procurement Orders represent the need for a certain quantity of products, at a given time, in a given location. Sale Orders are one typical source of Procurement Orders (but these are distinct documents). Depending on the procurement parameters and the products configuration, the procurement engine will attempt to satisfy the need by reserving products from stock, or ordering products from a supplier, or passing a manufacturing order, etc. A Procurement Exception occurs when the system cannot find a way to fulfill a procurement. Some exceptions will resolve themselves automatically, but others require manual intervention (those are identified by a specific error message)</field>
</record>
<record id="procurement_action5" model="ir.actions.act_window">
<field name="name">Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
@ -136,26 +153,6 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception')]</field>
<field name="help"> For each customer order line or raw materials in a manufacturing order, there is a procurement form . In normal system use, procurement orders are automatically generated by OpenERP. But if there are configuration problems, the system can remain blocked by a procurement without generating a corresponding document. It is a procurement exception. Some problems are link to timing and will be correct automatically by the system. If there is no procurement rule, the exception must be corrected manually.</field>
</record>
<record id="procurement_action4" model="ir.actions.act_window">
<field name="name">Procurement Exceptions to Fix</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception'), ('message', '&lt;&gt;', '')]</field>
<field name="filter" eval="True"/>
</record>
<record id="procurement_action11" model="ir.actions.act_window">
<field name="name">Temporary Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception'), ('message', '=', '')]</field>
</record>
<!-- Order Point -->
@ -263,8 +260,12 @@
res_model="stock.warehouse.orderpoint"
src_model="procurement.order"/>
<menuitem id="base.menu_mrp_scheduler" name="Schedulers" parent="stock.menu_stock_root" groups="base.group_system" sequence="3"/>
<menuitem action="action_compute_schedulers" id="base.mrp_Sched_all" parent="base.menu_mrp_scheduler" sequence="50" groups="base.group_system"/>
<menuitem action="procurement.procurement_action" id="base.menu_mrp_procurement_action" parent="stock.menu_stock_warehouse_mgmt" sequence="9" groups="base.group_system"/>
<!-- Procurements are located in Warehouse menu hierarchy, MRP users should come to Stock application to use it. -->
<menuitem id="menu_stock_sched" name="Schedulers" parent="stock.menu_stock_root" sequence="4" groups="base.group_extended"/>
<menuitem action="action_compute_schedulers" id="menu_stock_proc_schedulers" parent="menu_stock_sched" sequence="20" groups="stock.group_stock_manager"/>
<menuitem action="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_root" sequence="5" groups="base.group_extended"/>
<menuitem action="action_orderpoint_form" id="menu_stock_order_points" parent="menu_stock_procurement" sequence="10"/>
</data>
</openerp>

View File

@ -23,6 +23,5 @@ import pricelist
import report
import partner
import wizard
import company
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -55,7 +55,6 @@
'product_view.xml',
'pricelist_view.xml',
'partner_view.xml',
'company_view.xml',
'process/product_process.xml'
],
'test':['test/product_report.yml'],

View File

@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
class res_company(osv.osv):
_inherit = 'res.company'
_columns = {
'property_valuation_price_type': fields.property(
'product.price.type',
type='many2one',
relation='product.price.type',
domain=[],
string="Valuation Price Type",
method=True,
view_load=True,
help="The price type field in the selected price type will be used, instead of the default one, \
for valuation of product in the current company"),
}
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,18 +0,0 @@
<openerp>
<data>
<record id="view_company_property_form" model="ir.ui.view">
<field name="name">res.company.product.property.form.inherit</field>
<field name="model">res.company</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<field name="currency_id" position="after">
<field name="property_valuation_price_type"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -69,15 +69,15 @@ class product_uom(osv.osv):
'name': fields.char('Name', size=64, required=True, translate=True),
'category_id': fields.many2one('product.uom.categ', 'UoM Category', required=True, ondelete='cascade',
help="Quantity conversions may happen automatically between Units of Measure in the same category, according to their respective ratios."),
'factor': fields.float('Ratio', digits=(12, 6), required=True,
'factor': fields.float('Ratio', required=True,digits=(12, 6),
help='How many times this UoM is smaller than the reference UoM in this category:\n'\
'1 * (reference unit) = ratio * (this unit)'),
'factor_inv': fields.function(_factor_inv, digits=(12, 6),
'factor_inv': fields.function(_factor_inv, digits_compute=dp.get_precision('Product UoM'),
fnct_inv=_factor_inv_write,
method=True, string='Ratio',
help='How many times this UoM is bigger than the reference UoM in this category:\n'\
'1 * (this unit) = ratio * (reference unit)', required=True),
'rounding': fields.float('Rounding Precision', digits=(16, 3), required=True,
'rounding': fields.float('Rounding Precision', digits_compute=dp.get_precision('Product UoM'), required=True,
help="The computed quantity will be a multiple of this value. "\
"Use 1.0 for a UoM that cannot be further split, such as a piece."),
'active': fields.boolean('Active', help="By unchecking the active field you can disable a unit of measure without deleting it."),

View File

@ -144,12 +144,6 @@ parameter) will see those record just disappear.
<field eval="'product.pricelist,'+str(ref('list0'))" name="value"/>
</record>
<record forcecreate="True" id="property_valuation_price_type" model="ir.property">
<field name="name">property_valuation_price_type</field>
<field name="fields_id" search="[('model','=','res.company'),('name','=','property_valuation_price_type')]"/>
<field eval="'product.price.type,'+str(ref('standard_price'))" name="value"/>
</record>
<record forcecreate="True" id="decimal_sale" model="decimal.precision">
<field name="name">Sale Price</field>
<field name="digits">2</field>
@ -166,6 +160,9 @@ parameter) will see those record just disappear.
<field name="name">Stock Weight</field>
<field name="digits">2</field>
</record>
<record forcecreate="True" id="decimal_product_uom" model="decimal.precision">
<field name="name">Product UoM</field>
<field name="digits" eval="3"/>
</record>
</data>
</openerp>

View File

@ -7,6 +7,8 @@
login: hr
name: HR Manager
password: hr
groups_id:
- base.group_hr_manager
-
Create a product with type service used to specify employees designation

View File

@ -451,7 +451,7 @@ class purchase_order(osv.osv):
'product_uos_qty': order_line.product_qty,
'product_uom': order_line.product_uom.id,
'product_uos': order_line.product_uom.id,
'date_planned': order_line.date_planned,
'date': order_line.date_planned,
'date_expected': order_line.date_planned,
'location_id': loc_id,
'location_dest_id': dest,

View File

@ -31,6 +31,21 @@ class stock_move(osv.osv):
_defaults = {
'purchase_line_id': False
}
def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context=None):
"""
Overrides the default stock valuation to take into account the currency that was specified
on the purchase order in case the valuation data was not directly specified during picking
confirmation.
"""
reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context)
if move.product_id.cost_method != 'average' or not move.price_unit:
# no average price costing or cost not specified during picking validation, we will
# plug the purchase line values if they are found.
if move.purchase_line_id and move.picking_id.purchase_id.pricelist_id:
reference_amount, reference_currency_id = move.purchase_line_id.price_unit, move.picking_id.purchase_id.pricelist_id.currency_id.id
return reference_amount, reference_currency_id
stock_move()
#
@ -86,6 +101,9 @@ class stock_picking(osv.osv):
user, picking, move_line)
def _invoice_line_hook(self, cursor, user, move_line, invoice_line_id):
if move_line.purchase_line_id:
invoice_line_obj = self.pool.get('account.invoice.line')
invoice_line_obj.write(cursor, user, [invoice_line_id], {'note': move_line.purchase_line_id.notes,})
return super(stock_picking, self)._invoice_line_hook(cursor, user,
move_line, invoice_line_id)
@ -99,5 +117,48 @@ class stock_picking(osv.osv):
stock_picking()
class stock_partial_picking(osv.osv_memory):
_inherit = 'stock.partial.picking'
def default_get(self, cr, uid, fields, context=None):
""" To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
pick_obj = self.pool.get('stock.picking')
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
for m in pick.move_lines:
if (m.product_id.cost_method == 'average'):
if pick.type == 'in' and pick.purchase_id and m.purchase_line_id:
res['move%s_product_price'%(m.id)] = m.purchase_line_id.price_unit
res['move%s_product_currency'%(m.id)] = pick.purchase_id.pricelist_id.currency_id.id
return res
stock_partial_picking()
class stock_partial_move(osv.osv_memory):
_inherit = "stock.partial.move"
def default_get(self, cr, uid, fields, context=None):
""" To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
move_obj = self.pool.get('stock.move')
for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if (m.product_id.cost_method == 'average'):
if m.picking_id.type == 'in' and m.purchase_line_id and m.picking_id.purchase_id:
res['move%s_product_price'%(m.id)] = m.purchase_line_id.price_unit
res['move%s_product_currency'%(m.id)] = m.picking_id.purchase_id.pricelist_id.currency_id.id
return res
stock_partial_move()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,7 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="stock_move_purchase" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
<field name="type">form</field>
<field name="inherit_id" ref="stock.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="/form/group/field[@name='tracking_id']" position="before">
<field name="purchase_line_id" colspan="2" />
</xpath>
</field>
</record>
<record id="stock_picking_inherit_purchase" model="ir.ui.view">
<field name="name">Picking list</field>
<field name="model">stock.picking</field>

View File

@ -63,7 +63,7 @@
</record>
<record id="process_node_saleprocurement0" model="process.node">
<field name="menu_id" ref="base.menu_mrp_procurement_action"/>
<field name="menu_id" ref="procurement.menu_stock_procurement_action"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Procurement Order&quot;&quot;&quot;" name="name"/>

View File

@ -712,7 +712,7 @@ class sale_order(osv.osv):
'name': line.name[:64],
'picking_id': picking_id,
'product_id': line.product_id.id,
'date_planned': date_planned,
'date': date_planned,
'date_expected': date_planned,
'product_qty': line.product_uom_qty,
'product_uom': line.product_uom.id,

View File

@ -29,7 +29,25 @@ class stock_move(osv.osv):
_defaults = {
'sale_line_id': False
}
def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context=None):
"""
Overrides the default stock valuation to take into account the currency that was specified
on the sale order in case the valuation data was not directly specified during picking
confirmation.
"""
reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context)
if move.product_id.cost_method != 'average' or not move.price_unit:
# no average price costing or cost not specified during picking validation, we will
# plug the sale line values if they are found.
if move.sale_line_id and move.picking_id.sale_id.pricelist_id:
reference_amount, reference_currency_id = move.sale_line_id.price_unit, move.picking_id.sale_id.pricelist_id.currency_id.id
return reference_amount, reference_currency_id
def _create_chained_picking(self, cr, uid, pick_name,picking,ptype,move, context=None):
res=super(stock_move, self)._create_chained_picking(cr, uid, pick_name,picking,ptype,move, context=context)
if picking.sale_id:
picking_obj = self.pool.get('stock.picking').write(cr,uid,[res],{'sale_id':picking.sale_id.id})
return res
stock_move()
class stock_picking(osv.osv):
@ -186,6 +204,7 @@ class stock_picking(osv.osv):
'quantity': sale_line.product_uos_qty,
'invoice_line_tax_id': [(6, 0, tax_ids)],
'account_analytic_id': account_analytic_id,
'notes':sale_line.notes
}, context=context)
self.pool.get('sale.order.line').write(cursor, user, [sale_line.id], {'invoiced':True,
'invoice_lines': [(6, 0, [invoice_line_id])],
@ -208,4 +227,47 @@ class stock_picking(osv.osv):
stock_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
class stock_partial_picking(osv.osv_memory):
_inherit = 'stock.partial.picking'
def default_get(self, cr, uid, fields, context=None):
""" To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
pick_obj = self.pool.get('stock.picking')
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
for pick in pick_obj.browse(cr, uid, context.get('active_ids', [])):
for m in pick.move_lines:
if (m.product_id.cost_method == 'average'):
if pick.type == 'out' and pick.sale_id and m.sale_line_id:
res['move%s_product_price'%(m.id)] = m.sale_line_id.price_unit
res['move%s_product_currency'%(m.id)] = pick.sale_id.pricelist_id.currency_id.id
return res
stock_partial_picking()
class stock_partial_move(osv.osv_memory):
_inherit = "stock.partial.move"
def default_get(self, cr, uid, fields, context=None):
""" To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
move_obj = self.pool.get('stock.move')
for m in move_obj.browse(cr, uid, context.get('active_ids', [])):
if (m.product_id.cost_method == 'average'):
if m.picking_id.type == 'out' and m.sale_line_id and m.picking_id.sale_id:
res['move%s_product_price'%(m.id)] = m.sale_line_id.price_unit
res['move%s_product_currency'%(m.id)] = m.picking_id.sale_id.pricelist_id.currency_id.id
return res
stock_partial_move()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -13,6 +13,17 @@
</field>
</record>
<record id="stock_move_sale" model="ir.ui.view">
<field name="name">stock.move.form</field>
<field name="model">stock.move</field>
<field name="type">form</field>
<field name="inherit_id" ref="stock.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="/form/group/field[@name='tracking_id']" position="before">
<field name="sale_line_id" colspan="2"/>
</xpath>
</field>
</record>
<!-- Adding Sale Order Reference to outgoing picking -->
<record id="stock_picking_out_inherit_sale" model="ir.ui.view">

View File

@ -20,7 +20,7 @@
move_lines:
- company_id: base.main_company
date_expected: '2010-08-04 14:09:38'
date_planned: '2010-08-04 14:09:38'
date: '2010-08-04 14:09:38'
location_id: stock.stock_location_stock
product_id: product.product_product_24
product_qty: 50.0
@ -84,4 +84,4 @@
-
!python {model: sale_journal.picking.journal}: |
pick_jour = self.browse(cr, uid, ref("sale_journal_picking_journal_pickjournal0"))
assert (pick_jour.state == 'close'), "Journal is not in the open state"
assert (pick_jour.state == 'close'), "Journal is not in the open state"

View File

@ -45,11 +45,12 @@ Thanks to the double entry management, the inventory controlling is powerful and
"init_xml" : [],
"demo_xml" : ["stock_demo.xml"],
"update_xml" : [
"security/stock_security.xml",
"security/ir.model.access.csv",
"stock_data.xml",
"wizard/stock_move_view.xml",
"wizard/stock_partial_picking_view.xml",
"wizard/stock_partial_move_view.xml",
"wizard/stock_inventory_set_stock_zero_view.xml",
"wizard/stock_fill_inventory_view.xml",
"wizard/stock_invoice_onshipping_view.xml",
"wizard/stock_inventory_merge_view.xml",
@ -68,10 +69,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
"product_view.xml",
"partner_view.xml",
"report/report_stock_move_view.xml",
"report/report_stock_picking_view.xml",
"report/report_stock_view.xml",
"security/stock_security.xml",
"security/ir.model.access.csv",
"board_warehouse_view.xml"
],
'test': ['test/stock_test.yml',

View File

@ -5,30 +5,56 @@
<field name="name">Warehouse</field>
</record>
<record id="action_reception_picking_move_board" model="ir.actions.act_window">
<field name="name">Reception Picking Stock Move</field>
<record id="action_incoming_product_board" model="ir.actions.act_window">
<field name="name">Incoming Product</field>
<field name="res_model">stock.move</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('picking_id','!=',False),('picking_id.type','=','in'),('date','&lt;=',time.strftime('%Y-%m-%d 23:59:59'))]</field>
<field name="view_id" ref="stock.view_move_tree_reception_picking"/>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','in')]</field>
<field name="view_id" ref="stock.view_move_tree_reception_picking_board"/>
</record>
<record id="action_outgoing_product_board" model="ir.actions.act_window">
<field name="name">Outgoing Product</field>
<field name="res_model">stock.move</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','out')]</field>
<field name="view_id" ref="stock.view_move_tree_reception_picking_board"/>
</record>
<record model="ir.actions.act_window" id="action_stock_incoming_product_delay">
<field name="res_model">report.stock.move</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="view_id" ref="stock.view_stock_graph_board"></field>
<field name="context">{'search_default_month-1':1,'search_default_in':1,'group_by':['day'], 'group_by_no_leaf':1}</field>
</record>
<record model="ir.actions.act_window" id="action_stock_outgoing_product_delay">
<field name="res_model">report.stock.move</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="view_id" ref="stock.view_stock_graph_board"></field>
<field name="context">{'search_default_month-1':1,'search_default_out':1,'group_by':['day'], 'group_by_no_leaf':1}</field>
</record>
<record id="board_warehouse_form" model="ir.ui.view">
<field name="name">board.warehouse.form</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Warehouse board">
<hpaned position="100">
<hpaned position="200">
<child1>
<action colspan="4" name="%(action_reception_picking_move_board)d" string="Products To Receive" />
<action colspan="4" name="%(action_incoming_product_board)d" string="Incoming Product" />
<action colspan="4" name="%(action_outgoing_product_board)d" string="Outgoing Product" />
</child1>
<child2>
<action colspan="4" name="%(stock.action_move_graph_reception_picking)d" string="Number of Products to receive vs planned" width="510"/>
<action colspan="4" name="%(stock.action_move_delivery_products_planned)d" string="Delivery Products vs Planned" width="510"/>
<action colspan="4" name="%(action_stock_incoming_product_delay)d" string="Incoming Products Delay" width="510"/>
<action colspan="4" name="%(action_stock_outgoing_product_delay)d" string="Outgoing Products delay" width="510"/>
</child2>
</hpaned>
</form>
@ -43,9 +69,9 @@
<field name="view_id" ref="board_warehouse_form"/>
</record>
<menuitem id="menu_dashboard_stock" name="Dashboard" sequence="0" parent="stock.next_id_61"/>
<menuitem action="open_board_warehouse" icon="terp-graph" id="menu_board_warehouse" parent="menu_dashboard_stock" sequence="1"/>
<menuitem icon="terp-stock" id="stock.menu_stock_root" name="Warehouse" sequence="5" action="open_board_warehouse"/>
<menuitem id="menu_dashboard_stock" name="Dashboard" sequence="0" parent="stock.next_id_61"/>
<menuitem action="open_board_warehouse" icon="terp-graph" groups="group_stock_manager" id="menu_board_warehouse" parent="menu_dashboard_stock" sequence="1"/>
<menuitem icon="terp-stock" id="stock.menu_stock_root" name="Warehouse" sequence="5" groups="group_stock_manager" action="open_board_warehouse"/>
</data>
</openerp>

View File

@ -21,6 +21,7 @@
from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
class product_product(osv.osv):
_inherit = "product.product"
@ -228,16 +229,25 @@ class product_product(osv.osv):
results = []
results2 = []
from_date=context.get('from_date',False)
to_date=context.get('to_date',False)
date_str=False
from_date = context.get('from_date',False)
to_date = context.get('to_date',False)
date_str = False
date_values = False
where = [tuple(location_ids),tuple(location_ids),tuple(ids),tuple(states)]
if from_date and to_date:
date_str="date_planned>='%s' and date_planned<='%s'"%(from_date,to_date)
date_str = "date>=%s and date<=%s"
where.append(tuple([from_date]))
where.append(tuple([to_date]))
elif from_date:
date_str="date_planned>='%s'"%(from_date)
date_str = "date>=%s"
date_values = [from_date]
elif to_date:
date_str="date_planned<='%s'"%(to_date)
date_str = "date<=%s"
date_values = [to_date]
if date_values:
where.append(tuple(date_values))
if 'in' in what:
# all moves from a location out of the set to a location in the set
cr.execute(
@ -247,8 +257,7 @@ class product_product(osv.osv):
'and location_dest_id IN %s'\
'and product_id IN %s'\
'and state IN %s' + (date_str and 'and '+date_str+' ' or '') +''\
'group by product_id,product_uom',(tuple(location_ids),tuple(location_ids),tuple(ids),tuple(states),)
)
'group by product_id,product_uom',tuple(where))
results = cr.fetchall()
if 'out' in what:
# all moves from a location in the set to a location out of the set
@ -259,8 +268,7 @@ class product_product(osv.osv):
'and location_dest_id NOT IN %s '\
'and product_id IN %s'\
'and state in %s' + (date_str and 'and '+date_str+' ' or '') + ''\
'group by product_id,product_uom',(tuple(location_ids),tuple(location_ids),tuple(ids),tuple(states),)
)
'group by product_id,product_uom',tuple(where))
results2 = cr.fetchall()
uom_obj = self.pool.get('product.uom')
uoms = map(lambda x: x[2], results) + map(lambda x: x[2], results2)
@ -309,16 +317,19 @@ class product_product(osv.osv):
return res
_columns = {
'qty_available': fields.function(_product_available, method=True, type='float', string='Real Stock', help="Current quantities of products in selected locations or all internal if none have been selected.", multi='qty_available'),
'virtual_available': fields.function(_product_available, method=True, type='float', string='Virtual Stock', help="Future stock for this product according to the selected locations or all internal if none have been selected. Computed as: Real Stock - Outgoing + Incoming.", multi='qty_available'),
'incoming_qty': fields.function(_product_available, method=True, type='float', string='Incoming', help="Quantities of products that are planned to arrive in selected locations or all internal if none have been selected.", multi='qty_available'),
'outgoing_qty': fields.function(_product_available, method=True, type='float', string='Outgoing', help="Quantities of products that are planned to leave in selected locations or all internal if none have been selected.", multi='qty_available'),
'qty_available': fields.function(_product_available, method=True, type='float', string='Real Stock', help="Current quantities of products in selected locations or all internal if none have been selected.", multi='qty_available', digits_compute=dp.get_precision('Product UoM')),
'virtual_available': fields.function(_product_available, method=True, type='float', string='Virtual Stock', help="Future stock for this product according to the selected locations or all internal if none have been selected. Computed as: Real Stock - Outgoing + Incoming.", multi='qty_available', digits_compute=dp.get_precision('Product UoM')),
'incoming_qty': fields.function(_product_available, method=True, type='float', string='Incoming', help="Quantities of products that are planned to arrive in selected locations or all internal if none have been selected.", multi='qty_available', digits_compute=dp.get_precision('Product UoM')),
'outgoing_qty': fields.function(_product_available, method=True, type='float', string='Outgoing', help="Quantities of products that are planned to leave in selected locations or all internal if none have been selected.", multi='qty_available', digits_compute=dp.get_precision('Product UoM')),
'track_production': fields.boolean('Track Manufacturing Lots' , help="Forces to specify a Production Lot for all moves containing this product and generated by a Manufacturing Order"),
'track_incoming': fields.boolean('Track Incoming Lots', help="Forces to specify a Production Lot for all moves containing this product and coming from a Supplier Location"),
'track_outgoing': fields.boolean('Track Outgoing Lots', help="Forces to specify a Production Lot for all moves containing this product and going to a Customer Location"),
'location_id': fields.dummy(string='Stock Location', relation='stock.location', type='many2one'),
'valuation':fields.selection([('manual_periodic', 'Periodic (manual)'),
('real_time','Real Time (automatized)'),], 'Stock Valuation', help="Decide if the system must automatically create account moves based on stock moves", required=True),
'valuation':fields.selection([('manual_periodic', 'Periodical (manual)'),
('real_time','Real Time (automated)'),], 'Inventory Valuation',
help="If real-time valuation is enabled for a product, the system will automatically write journal entries corresponding to stock moves." \
"The inventory variation account set on the product category will represent the current inventory value, and the stock input and stock output account will hold the counterpart moves for incoming and outgoing products."
, required=True),
}
_defaults = {
@ -404,11 +415,11 @@ class product_template(osv.osv):
'property_stock_account_input': fields.property('account.account',
type='many2one', relation='account.account',
string='Stock Input Account', method=True, view_load=True,
help='This account will be used, instead of the default one, to value input stock'),
help='When doing real-time inventory valuation, counterpart Journal Items for all incoming stock moves will be posted in this account. If not set on the product, the one from the product category is used.'),
'property_stock_account_output': fields.property('account.account',
type='many2one', relation='account.account',
string='Stock Output Account', method=True, view_load=True,
help='This account will be used, instead of the default one, to value output stock'),
help='When doing real-time inventory valuation, counterpart Journal Items for all outgoing stock moves will be posted in this account. If not set on the product, the one from the product category is used.'),
}
product_template()
@ -420,23 +431,23 @@ class product_category(osv.osv):
'property_stock_journal': fields.property('account.journal',
relation='account.journal', type='many2one',
string='Stock journal', method=True, view_load=True,
help="This journal will be used for the accounting move generated by stock move"),
help="When doing real-time inventory valuation, this is the Accounting Journal in which entries will be automatically posted when stock moves are processed."),
'property_stock_account_input_categ': fields.property('account.account',
type='many2one', relation='account.account',
string='Stock Input Account', method=True, view_load=True,
help='This account will be used to value the input stock'),
help='When doing real-time inventory valuation, counterpart Journal Items for all incoming stock moves will be posted in this account. This is the default value for all products in this category, it can also directly be set on each product.'),
'property_stock_account_output_categ': fields.property('account.account',
type='many2one', relation='account.account',
string='Stock Output Account', method=True, view_load=True,
help='This account will be used to value the output stock'),
help='When doing real-time inventory valuation, counterpart Journal Items for all outgoing stock moves will be posted in this account. This is the default value for all products in this category, it can also directly be set on each product.'),
'property_stock_variation': fields.property('account.account',
type='many2one',
relation='account.account',
string="Stock Variation Account",
method=True, view_load=True,
help="This account will be used in product when valuation type is real-time valuation ",),
help="When real-time inventory valuation is enabled on a product, this account will hold the current value of the products.",),
}
product_category()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -60,10 +60,9 @@
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="standard_price" position="replace">
<label string="Cost Price:" align="1.0" colspan="1"/>
<group col="2" colspan="1">
<field name="standard_price" nolabel="1" attrs="{'readonly':[('valuation','=','real_time')]}"/>
<button name="%(action_view_change_standard_price)d" string="Update" type="action" icon="gtk-execute" attrs="{'invisible':[('valuation','=','manual_periodic')]}"/>
<group col="4" colspan="2">
<field name="standard_price" readonly="True"/>
<button name="%(action_view_change_standard_price)d" string="Change Price" type="action" icon="gtk-execute"/>
</group>
</field>
</field>
@ -76,10 +75,21 @@
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="priority">26</field>
<field name="arch" type="xml">
<field name="property_account_expense" position="after">
<field name="property_stock_account_output" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" groups="base.group_extended" attrs="{'invisible':[('valuation','=','manual_periodic')]}"/>
<field name="property_stock_account_input" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" groups="base.group_extended" attrs="{'invisible':[('valuation','=','manual_periodic')]}"/>
</field>
<xpath expr="/form/notebook/page/group[@name='properties']" position="before">
<group groups="base.group_extended">
<separator string="Inventory Valuation" colspan="4"/>
<group colspan="2" col="2">
<field name="valuation"/>
</group>
<group colspan="2" col="2">
<field name="property_stock_account_input" attrs="{'readonly':[('valuation', '!=', 'real_time')]}"
domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" groups="base.group_extended"/>
<field name="property_stock_account_output" attrs="{'readonly':[('valuation', '!=', 'real_time')]}"
domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]" groups="base.group_extended"/>
</group>
</group>
<newline/>
</xpath>
</field>
</record>
@ -122,17 +132,17 @@
</field>
</record>
<record id="view_product_valuation_form" model="ir.ui.view">
<!-- <record id="view_product_valuation_form" model="ir.ui.view">
<field name="name">product.valuation.stock.form.inherit</field>
<field name="model">product.product</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="cost_method" position="after">
<field name="valuation" groups="base.group_extended"/>
<field name="valuation"/>
</field>
</field>
</record>
</record>-->
</data>
</openerp>

View File

@ -24,7 +24,6 @@ import ups
import picking
import lot_overview_all
import report_stock
import report_stock_picking
import report_stock_move
import stock_inventory_move_report
import lot_overview

View File

@ -37,7 +37,8 @@ class lot_overview(report_sxw.rml_parse):
def process(self,location_id):
location_obj = pooler.get_pool(self.cr.dbname).get('stock.location')
data = location_obj._product_get_report(self.cr,self.uid, [location_id])
data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['name'])[0]['name']
data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['complete_name'])[0]['complete_name']
self.price_total = 0.0
self.price_total += data['total_price']
self.grand_total += data['total_price']

View File

@ -37,7 +37,7 @@ class lot_overview_all(report_sxw.rml_parse):
def process(self,location_id):
location_obj = pooler.get_pool(self.cr.dbname).get('stock.location')
data = location_obj._product_get_all_report(self.cr,self.uid, [location_id])
data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['name'])[0]['name']
data['location_name'] = location_obj.read(self.cr, self.uid, [location_id],['complete_name'])[0]['complete_name']
self.price_total = 0.0
self.price_total += data['total_price']
self.grand_total += data['total_price']

View File

@ -69,12 +69,12 @@ class report_stock(report_int):
if not loc_ids or not product_ids:
return (False, 'pdf')
cr.execute("select sum(r.product_qty * u.factor), r.date_planned, r.product_id "
cr.execute("select sum(r.product_qty * u.factor), r.date, r.product_id "
"from stock_move r left join product_uom u on (r.product_uom=u.id) "
"where state IN %s"
"and location_id IN %s"
"and product_id IN %s"
"group by date_planned,product_id",(('confirmed','assigned','waiting'),tuple(loc_ids) ,tuple(product_ids),))
"group by date,product_id",(('confirmed','assigned','waiting'),tuple(loc_ids) ,tuple(product_ids),))
for (qty, dt, prod_id) in cr.fetchall():
if dt<=dt_from:
dt= (datetime.now() + relativedelta(days=1)).strftime('%Y-%m-%d')
@ -83,12 +83,12 @@ class report_stock(report_int):
products.setdefault(prod_id, [])
products[prod_id].append((dt,-qty))
cr.execute("select sum(r.product_qty * u.factor), r.date_planned, r.product_id "
cr.execute("select sum(r.product_qty * u.factor), r.date, r.product_id "
"from stock_move r left join product_uom u on (r.product_uom=u.id) "
"where state IN %s"
"and location_dest_id IN %s"
"and product_id IN %s"
"group by date_planned,product_id",(('confirmed','assigned','waiting'),tuple(loc_ids) ,tuple(product_ids),))
"group by date,product_id",(('confirmed','assigned','waiting'),tuple(loc_ids) ,tuple(product_ids),))
for (qty, dt, prod_id) in cr.fetchall():
if dt<=dt_from:

View File

@ -29,7 +29,7 @@ class report_stock_move(osv.osv):
_description = "Moves Statistics"
_auto = False
_columns = {
'date_planned': fields.date('Date Planned', readonly=True ),
'date': fields.date('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
@ -39,26 +39,30 @@ class report_stock_move(osv.osv):
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
'picking_id':fields.many2one('stock.picking', 'Packing', readonly=True),
'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."),
'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery'), ('other', 'Others')], 'Shipping Type', required=True, select=True, help="Shipping type specify, goods coming in or going out."),
'location_id': fields.many2one('stock.location', 'Source Location', readonly=True, select=True, help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."),
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', readonly=True, select=True, help="Location where the system will stock the finished products."),
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True),
'product_qty_in':fields.float('In Qty',readonly=True),
'product_qty_out':fields.float('Out Qty',readonly=True),
'value' : fields.float('Total Value', required=True, digits_compute=dp.get_precision('Sale Price')),
'day_diff2':fields.float('Delay (Days)',readonly=True, digits=(16,2), group_operator="avg"),
'day_diff1':fields.float('Planned (Days)',readonly=True, digits=(16,2), group_operator="avg"),
'day_diff':fields.float('Real (Days)',readonly=True, digits=(16,2), group_operator="avg"),
'product_qty':fields.integer('Quantity',readonly=True),
'categ_id': fields.many2one('product.category', 'Product Category', ),
'product_qty_in':fields.integer('In Qty',readonly=True),
'product_qty_out':fields.integer('Out Qty',readonly=True),
'value' : fields.float('Total Value', required=True),
'day_diff2':fields.float('Lag (Days)',readonly=True, digits_compute=dp.get_precision('Shipping Delay'), group_operator="avg"),
'day_diff1':fields.float('Planned Lead Time (Days)',readonly=True, digits_compute=dp.get_precision('Shipping Delay'), group_operator="avg"),
'day_diff':fields.float('Execution Lead Time (Days)',readonly=True, digits_compute=dp.get_precision('Shipping Delay'), group_operator="avg"),
'stock_journal': fields.many2one('stock.journal','Stock Journal', select=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_move')
cr.execute("""
create or replace view report_stock_move as (
select
CREATE OR REPLACE view report_stock_move AS (
SELECT
min(sm_id) as id,
sum(value) as value,
al.dp as date_planned,
al.dp as date,
al.curr_year as year,
al.curr_month as month,
al.curr_day as day,
@ -69,56 +73,74 @@ class report_stock_move(osv.osv):
al.picking_id as picking_id,
al.company_id as company_id,
al.location_dest_id as location_dest_id,
al.product_qty,
al.out_qty as product_qty_out,
al.in_qty as product_qty_in,
al.address_id as partner_id,
al.product_id as product_id,
al.state as state ,
al.product_uom as product_uom,
al.type as type
al.categ_id as categ_id,
coalesce(al.type, 'other') as type,
al.stock_journal as stock_journal,
sum(al.in_value - al.out_value) as value
FROM (SELECT
CASE WHEN sp.type in ('out','delivery') THEN
sum(sm.product_qty) END AS out_qty,
sum(sm.product_qty * pu.factor)
ELSE 0.0
END AS out_qty,
CASE WHEN sp.type in ('in') THEN
sum(sm.product_qty) END AS in_qty,
sum(sm.product_qty * pu.factor)
ELSE 0.0
END AS in_qty,
CASE WHEN sp.type in ('out','delivery') THEN
sum(sm.product_qty * pu.factor) * pt.standard_price
ELSE 0.0
END AS out_value,
CASE WHEN sp.type in ('in') THEN
sum(sm.product_qty * pu.factor) * pt.standard_price
ELSE 0.0
END AS in_value,
min(sm.id) as sm_id,
sm.date_planned as dp,
to_char(date_trunc('day',sm.date_planned), 'YYYY') as curr_year,
to_char(date_trunc('day',sm.date_planned), 'MM') as curr_month,
to_char(date_trunc('day',sm.date_planned), 'YYYY-MM-DD') as curr_day,
avg(date(sm.date_planned)-date(sm.create_date)) as curr_day_diff,
sm.date as dp,
to_char(date_trunc('day',sm.date), 'YYYY') as curr_year,
to_char(date_trunc('day',sm.date), 'MM') as curr_month,
to_char(date_trunc('day',sm.date), 'YYYY-MM-DD') as curr_day,
avg(date(sm.date)-date(sm.create_date)) as curr_day_diff,
avg(date(sm.date_expected)-date(sm.create_date)) as curr_day_diff1,
avg(date(sm.date_planned)-date(sm.date_expected)) as curr_day_diff2,
avg(date(sm.date)-date(sm.date_expected)) as curr_day_diff2,
sm.location_id as location_id,
sm.location_dest_id as location_dest_id,
pt.standard_price * sum(sm.product_qty) as value,
sum(sm.product_qty) as product_qty,
pt.categ_id as categ_id ,
sm.address_id as address_id,
sm.product_id as product_id,
sm.picking_id as picking_id,
sm.company_id as company_id,
sm.state as state,
sm.product_uom as product_uom,
sp.type as type
from
sp.type as type,
sp.stock_journal_id AS stock_journal
FROM
stock_move sm
left join stock_picking sp on (sm.picking_id=sp.id)
left join product_product pp on (sm.product_id=pp.id)
left join product_template pt on (pp.product_tmpl_id=pt.id)
left join stock_location sl on (sm.location_id = sl.id)
LEFT JOIN stock_picking sp ON (sm.picking_id=sp.id)
LEFT JOIN product_product pp ON (sm.product_id=pp.id)
LEFT JOIN product_uom pu ON (sm.product_uom=pu.id)
LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id)
LEFT JOIN stock_location sl ON (sm.location_id = sl.id)
group by
sm.id,sp.type, sm.date_planned,sm.address_id,
GROUP BY
sm.id,sp.type, sm.date,sm.address_id,
sm.product_id,sm.state,sm.product_uom,sm.date_expected,
sm.product_id,pt.standard_price, sm.picking_id,
sm.company_id,sm.product_qty, sm.location_id,sm.location_dest_id)
as al
sm.product_id,pt.standard_price, sm.picking_id, sm.product_qty,
sm.company_id,sm.product_qty, sm.location_id,sm.location_dest_id,pu.factor,pt.categ_id, sp.stock_journal_id)
AS al
group by
GROUP BY
al.out_qty,al.in_qty,al.curr_year,al.curr_month,
al.curr_day,al.curr_day_diff,al.curr_day_diff1,al.curr_day_diff2,al.dp,al.location_id,al.location_dest_id,
al.address_id,al.product_id,al.state,al.product_uom,
al.picking_id,al.company_id,al.type
al.picking_id,al.company_id,al.type,al.product_qty, al.categ_id, al.stock_journal
)
""")
@ -130,14 +152,15 @@ class report_stock_inventory(osv.osv):
_description = "Stock Statistics"
_auto = False
_columns = {
'date_planned': fields.datetime('Date', readonly=True),
'date': fields.datetime('Date', readonly=True),
'partner_id':fields.many2one('res.partner.address', 'Partner', readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'product_categ_id':fields.many2one('product.category', 'Product Category', readonly=True),
'location_id': fields.many2one('stock.location', 'Location', readonly=True),
'prodlot_id': fields.many2one('stock.production.lot', 'Lot', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'product_qty':fields.float('Qty', digits=(16,2), readonly=True),
'value' : fields.float('Total Value', digits=(16,2), required=True, digits_compute=dp.get_precision('Sale Price')),
'product_qty':fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), readonly=True),
'value' : fields.float('Total Value', digits_compute=dp.get_precision('Account'), required=True),
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
\nThe state is \'Waiting\' if the move is waiting for another one.'),
@ -146,44 +169,44 @@ class report_stock_inventory(osv.osv):
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_inventory')
cr.execute("""
create or replace view report_stock_inventory as (
(select
min(m.id) as id, m.date_planned as date_planned,
CREATE OR REPLACE view report_stock_inventory AS (
(SELECT
min(m.id) as id, m.date as date,
m.address_id as partner_id, m.location_id as location_id,
m.product_id as product_id, l.usage as location_type,
m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type,
m.company_id,
m.state as state, m.prodlot_id as prodlot_id,
sum(-m.product_qty*u.factor)::decimal(16,2) as product_qty,
sum(-pt.standard_price * m.product_qty * u.factor)::decimal(16,2) as value
from
coalesce(sum(-m.product_qty * u.factor)::decimal, 0.0) as product_qty,
coalesce(sum(-pt.standard_price * m.product_qty * u.factor)::decimal, 0.0) as value
FROM
stock_move m
left join stock_picking p on (m.picking_id=p.id)
left join product_product pp on (m.product_id=pp.id)
left join product_template pt on (pp.product_tmpl_id=pt.id)
left join product_uom u on (m.product_uom=u.id)
left join stock_location l on (m.location_id=l.id)
group by
m.id, m.product_id, m.address_id, m.location_id, m.prodlot_id,
m.date_planned, m.state, l.usage, m.company_id
) union all (
select
-m.id as id, m.date_planned as date_planned,
LEFT JOIN stock_picking p ON (m.picking_id=p.id)
LEFT JOIN product_product pp ON (m.product_id=pp.id)
LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id)
LEFT JOIN product_uom u ON (m.product_uom=u.id)
LEFT JOIN stock_location l ON (m.location_id=l.id)
GROUP BY
m.id, m.product_id, m.product_uom, pt.categ_id, m.address_id, m.location_id, m.location_dest_id,
m.prodlot_id, m.date, m.state, l.usage, m.company_id
) UNION ALL (
SELECT
-m.id as id, m.date as date,
m.address_id as partner_id, m.location_dest_id as location_id,
m.product_id as product_id, l.usage as location_type,
m.product_id as product_id, pt.categ_id as product_categ_id, l.usage as location_type,
m.company_id,
m.state as state, m.prodlot_id as prodlot_id,
sum(m.product_qty*u.factor)::decimal(16,2) as product_qty,
sum(pt.standard_price * m.product_qty * u.factor)::decimal(16,2) as value
from
coalesce(sum(m.product_qty*u.factor)::decimal, 0.0) as product_qty,
coalesce(sum(pt.standard_price * m.product_qty * u.factor)::decimal, 0.0) as value
FROM
stock_move m
left join stock_picking p on (m.picking_id=p.id)
left join product_product pp on (m.product_id=pp.id)
left join product_template pt on (pp.product_tmpl_id=pt.id)
left join product_uom u on (m.product_uom=u.id)
left join stock_location l on (m.location_dest_id=l.id)
group by
m.id, m.product_id, m.address_id, m.location_id, m.location_dest_id,
m.prodlot_id, m.date_planned, m.state, l.usage, m.company_id
LEFT JOIN stock_picking p ON (m.picking_id=p.id)
LEFT JOIN product_product pp ON (m.product_id=pp.id)
LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id)
LEFT JOIN product_uom u ON (m.product_uom=u.id)
LEFT JOIN stock_location l ON (m.location_dest_id=l.id)
GROUP BY
m.id, m.product_id, m.product_uom, pt.categ_id, m.address_id, m.location_id, m.location_dest_id,
m.prodlot_id, m.date, m.state, l.usage, m.company_id
)
);
""")

View File

@ -13,7 +13,7 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Moves Analysis">
<field name="date_planned" invisible="1"/>
<field name="date" invisible="1"/>
<field name="year" invisible="1" />
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
@ -24,12 +24,15 @@
<field name="location_id" invisible="1"/>
<field name="location_dest_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="categ_id" invisible="1"/>
<field name="stock_journal" invisible="1"/>
<field name="state" invisible="1"/>
<field name="product_qty_in"/>
<field name="product_qty_out"/>
<field name="value"/>
<field name="day_diff"/>
<field name="product_qty" sum="Total quantity"/>
<field name="product_qty_in" sum="Total incoming quantity" />
<field name="product_qty_out" sum="Total outgoing quantity"/>
<field name="value" sum="Total value"/>
<field name="day_diff1"/>
<field name="day_diff"/>
<field name="day_diff2"/>
</tree>
</field>
@ -42,7 +45,18 @@
<field name="arch" type="xml">
<graph string="Moves Analysis" type="bar">
<field name="product_id"/>
<field name="day_diff2" operator="avg"/>
<field name="day_diff2" operator="+"/>
</graph>
</field>
</record>
<record id="view_stock_graph_board" model="ir.ui.view">
<field name="name">report.stock.move.graph</field>
<field name="model">report.stock.move</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Moves Analysis" type="bar">
<field name="day"/>
<field name="day_diff2" operator="+"/>
</graph>
</field>
</record>
@ -54,52 +68,44 @@
<field name="arch" type="xml">
<search string="Moves Analysis">
<group>
<filter icon="terp-go-year" string=" Year "
domain="[('date_planned','&lt;=', time.strftime('%%Y-%%m-%%d')),('date_planned','&gt;=',time.strftime('%%Y-01-01'))]"
<filter icon="terp-go-year" string="Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-01-01'))]"
help="Current year"/>
<filter icon="terp-go-month" string=" Month "
name="month"
domain="[('date_planned','&lt;=', time.strftime('%%Y-%%m-%%d')),('date_planned','&gt;=',time.strftime('%%Y-%%m-01'))]"
help="Current month"/>
<filter icon="terp-go-month"
string=" Month-1 "
string="Month-1"
name="month-1"
separator="1"
domain="[('date_planned','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date_planned','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
help="Last month"/>
domain="[('date','&lt;=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
help="Last month"/>
<filter icon="terp-go-month" string="Month"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;=',time.strftime('%%Y-%%m-01'))]"
help="Current month"/>
<separator orientation="vertical"/>
<filter string="Done"
name="done"
icon="terp-check"
domain="[('state','=','done')]"
help = "Completed Stock-Moves"/>
<filter string="Todo"
icon="terp-camera_test"
icon="terp-stock"
domain="[('state','in',('assigned','waiting','confirmed'))]"
help = "Future Stock-Moves"/>
<separator orientation="vertical"/>
<filter icon="terp-go-home" name="in" string="Receptions" domain="[('type','=','in')]"/>
<filter icon="terp-go-home" name="internal" string="Internals" domain="[('type','=','internal')]"/>
<filter icon="terp-go-home" name="out" string="Packings" domain="[('type','=','out')]"/>
<filter icon="terp-go-home" name="in" string="Incoming" domain="[('type','=','in')]"/>
<filter icon="terp-go-home" name="internal" string="Internal" domain="[('type','=','internal')]"/>
<filter icon="terp-go-home" name="out" string="Outgoing" domain="[('type','=','out')]"/>
<filter icon="terp-go-home" name="delivery" string="Deliveries" domain="[('type','=','delivery')]"/>
<separator orientation="vertical"/>
<field name="product_id"/>
<field name="product_id" default_focus="1"/>
<field name="partner_id" context="{'contact_display':'partner'}"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="location_id" widget = "selection"/>
<field name="location_dest_id" widget = "selection"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
<field name="date_planned"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter name="group_partner" string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter name="group_categ_id" string="Product Category" icon="terp-stock_symbol-selection" context="{'group_by':'categ_id'}"/>
<filter name="group_product" string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter name="group_picking" string="Packing" icon="terp-accessories-archiver" context="{'group_by':'picking_id'}"/>
@ -109,13 +115,25 @@
<separator orientation="vertical"/>
<filter string="Type" name="group_type" icon="terp-gtk-jump-to-rtl" context="{'group_by':'type'}" help="Shipping type specify, goods coming in or going out"/>
<filter string="State" name="group_state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Stock journal" name="group_stock_journal" icon="terp-folder-orange" context="{'group_by':'stock_journal'}"/>
<separator orientation="vertical"/>
<filter string="Company" name="group_state" icon="terp-stock_effects-object-colorize" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Day Planned"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'date_planned'}" help="Month Planned"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'date'}" help="Month Planned"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Year Planned"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="location_id" />
<field name="location_dest_id" />
<field name="categ_id"/>
<field name="stock_journal"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company" widget = "selection"/>
<newline/>
<field name="date"/>
</group>
</search>
</field>
</record>
@ -126,28 +144,28 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_stock_search"/>
<field name="context">{'contact_display': 'partner', 'search_default_month':1, 'search_default_group_product':1,'search_default_done':1,'group_by':[], 'group_by_no_leaf':1}</field>
<field name="context">{'full':'1','contact_display': 'partner','search_default_done':1, 'search_default_month':1, 'search_default_group_type':1, 'group_by': [], 'group_by_no_leaf':1,}</field>
</record>
<menuitem action="action_stock_move_report" id="menu_action_stock_move_report" parent="next_id_61" sequence="3"/>
<!-- Inventory Control -->
<record id="view_stock_inventory_tree" model="ir.ui.view">
<field name="name">report.stock.inventory.tree</field>
<field name="model">report.stock.inventory</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Inventory Analysis">
<field name="date_planned" invisible="1"/>
<field name="date" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="location_type" invisible="1"/>
<field name="location_id" invisible="1"/>
<field name="partner_id" invisible="1" context="{'contact_display':'partner'}"/>
<field name="product_categ_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="prodlot_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="product_qty"/>
<field name="value"/>
<field name="product_qty" sum="Total quantity"/>
<field name="value" sum="Total value"/>
</tree>
</field>
</record>
@ -173,43 +191,46 @@
<group col="16">
<filter string="Real"
name="real"
icon="terp-dialog-close"
icon="terp-check"
domain="[('state','=','done')]"
help="Analysis on real stock."/>
help="Analysis of current inventory (only moves that have already been processed)"/>
<filter string="Future"
icon="terp-camera_test"
icon="terp-stock"
domain="[('state','in',('assigned','done','waiting','confirmed'))]"
help = "Analysis including future operations."/>
help = "Analysis including future moves (similar to virtual stock)"/>
<separator orientation="vertical"/>
<filter icon="terp-go-home" name="location_type_internal" string="Internal" domain="[('location_type','=','internal')]"/>
<filter icon="terp-go-home" name="location_type_scrap" string="Scrap" domain="[('location_type','=','scrap')]"/>
<separator orientation="vertical"/>
<field name="date_planned"/>
<field name="product_id"/>
<field name="location_id"/>
<field name="product_id" default_focus="1"/>
<field name="location_id" filter_domain="[('location_id', 'child_of', self)]"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id" context="{'contact_display':'partner'}"/>
<field name="prodlot_id"/>
<field name="state"/>
<field name="location_type"/>
</group>
<newline/>
<group expand="1" string="Group By..." >
<filter string="Partner" name="group_partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter name="group_product_categ_id" string="Product Category" icon="terp-stock_symbol-selection" context="{'group_by':'product_categ_id'}"/>
<filter name="group_product" string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter name="group_lot" string="Lot" context="{'group_by':'prodlot_id'}"/>
<separator orientation="vertical"/>
<filter name="group_company" string="Company" context="{'group_by':'company_id'}"/>
<filter name="group_company" string="Company" groups="base.group_multi_company" context="{'group_by':'company_id'}"/>
<filter name="group_location" string="Location" context="{'group_by':'location_id'}"/>
<filter name="group_lot" string="Lot" context="{'group_by':'prodlot_id'}"/>
<separator orientation="vertical"/>
<filter string="Date" icon="terp-go-month" context="{'group_by':'date_planned'}"/>
<filter string="Date" icon="terp-go-month" context="{'group_by':'date'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="partner_id" context="{'contact_display':'partner'}"/>
<field name="product_categ_id" />
<field name="prodlot_id"/>
<field name="state"/>
<field name="location_type"/>
<field name="date"/>
<filter icon="terp-go-home" name="location_type_scrap" string="Scrap" domain="[('location_type','=','scrap')]"/>
</group>
</search>
</field>
</record>
@ -220,7 +241,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" eval="False"/>
<field name="context">{'contact_display': 'partner', 'search_default_real':1, 'search_default_location_type_internal':1,'search_default_group_product':1,'search_default_group_location':1,'group_by':[], 'group_by_no_leaf':1}</field>
<field name="context">{'contact_display': 'partner', 'search_default_real':1, 'search_default_location_type_internal':1,'search_default_group_product':1,'group_by':[], 'group_by_no_leaf':1}</field>
</record>
<menuitem action="action_stock_inventory_report" id="menu_action_stock_inventory_report" parent="next_id_61" sequence="4" groups="base.group_system,base.group_user"/>

View File

@ -1,113 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields,osv
import tools
class report_stock_picking(osv.osv):
_name = "report.stock.picking"
_description = "Stock Picking Report"
_auto = False
_columns = {
'year': fields.char('Year',size=64,required=False, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'nbr': fields.integer('# of Lines', readonly=True),
'nbp': fields.integer('# of Picking', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'product_qty': fields.float('# of Products', readonly=True),
'product_uos_qty': fields.float('# of Products', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'date': fields.date('Date', readonly=True),
'avg_days_late': fields.float('Avg Due Days', digits=(16,2), readonly=True, group_operator="avg"),
'avg_days_to_deliver': fields.float('Avg Days to Deliver', digits=(16,2), readonly=True, group_operator="avg",
help="Number of Avg Days to deliver"),
'state': fields.selection([('draft', 'Draft'),('auto', 'Waiting'),('confirmed', 'Confirmed'),('assigned', 'Available'),('done', 'Done'),('cancel', 'Cancelled')], 'State'),
'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal'), ('delivery', 'Delivery')], 'Shipping Type', required=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'invoice_state': fields.selection([
("invoiced", "Invoiced"),
("2binvoiced", "To Be Invoiced"),
("none", "Not from Picking")], "Invoice Status",readonly=True),
'min_date': fields.date('Expected Date',help="Expected date for Picking. Default it takes current date"),
'order_date': fields.date('Order Date', help="Date of Order"),
'date_done': fields.date('Date Done', help="Date of completion"),
'location_id': fields.many2one('stock.location', 'Source Location', help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."),
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', help="Location where the system will stock the finished products."),
'max_date': fields.date('Max.Expected Date'),
'product_uos': fields.many2one('product.uom', 'Product UOS'),
'product_uom': fields.many2one('product.uom', 'Product UOM'),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_stock_picking')
cr.execute("""
create or replace view report_stock_picking as (
select
min(sm.id) as id,
date_trunc('day',sp.min_date) as min_date,
date_trunc('day',sp.date) as order_date,
date_trunc('day',sp.date_done) as date_done,
date_trunc('day',sp.max_date) as max_date,
to_char(sp.create_date, 'YYYY') as year,
to_char(sp.create_date, 'MM') as month,
to_char(sp.create_date, 'YYYY-MM-DD') as day,
sp.address_id as partner_id,
to_date(to_char(sp.create_date, 'MM-dd-YYYY'),'MM-dd-YYYY') as date,
count(sm.id) as nbr,
count(sp.id) as nbp,
sum(sm.product_qty*u.factor) as product_qty,
sum(sm.product_uos_qty) as product_uos_qty,
sm.product_id as product_id,
sm.location_dest_id as location_dest_id,
sm.location_id as location_id,
sp.type,
sm.product_uos,
sm.product_uom,
sp.invoice_state,
sp.company_id as company_id,
avg(extract('epoch' from (sp.date_done-sp.create_date)))/(3600*24) as avg_days_to_deliver,
avg(extract('epoch' from (sp.date_done-sp.min_date)))/(3600*24) as avg_days_late,
sp.state
from stock_picking as sp
Inner join stock_move as sm ON (sm.picking_id=sp.id)
Inner join product_uom u on (u.id=sm.product_uom)
group by sp.type,
sp.create_date,
sp.address_id,
sm.product_id,
to_char(sp.create_date, 'YYYY'),
sm.location_dest_id,
sm.location_id,
to_char(sp.create_date, 'MM'),
to_char(sp.create_date, 'YYYY-MM-DD'),
sm.product_uos,
sm.product_uom,
date_trunc('day',sp.min_date),
date_trunc('day',sp.date),
date_trunc('day',sp.date_done),
date_trunc('day',sp.max_date),
sp.invoice_state,
sp.company_id,
sp.state
)""")
report_stock_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,138 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--
Stock Picking Report
-->
<record id="view_report_report_stock_picking_tree" model="ir.ui.view">
<field name="name">report.stock.picking.tree</field>
<field name="model">report.stock.picking</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking">
<field name="year" invisible="1"/>
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
<field name="date" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="min_date" invisible="1"/>
<field name="order_date" invisible="1"/>
<field name="date_done" invisible="1"/>
<field name="max_date" invisible="1"/>
<field name="type" invisible="1"/>
<field name="invoice_state" invisible="1"/>
<field name="state" invisible="1"/>
<field name="nbr" sum="# of Lines" />
<field name="product_qty" sum="# of Products" />
<field name="avg_days_to_deliver" avg='Avg Days to Deliver'/>
<field name="avg_days_late" avg='Avg Due Days'/>
</tree>
</field>
</record>
<record id="view_report_report_stock_picking_graph" model="ir.ui.view">
<field name="name">report.stock.picking.graph</field>
<field name="model">report.stock.picking</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph orientation="horizontal" string="Picking" type="bar">
<field name="partner_id"/>
<field name="nbr" operator="+"/>
<field name="product_qty" operator="+"/>
<field name="nbp" operator="+"/>
</graph>
</field>
</record>
<record id="view_report_report_stock_picking_filter" model="ir.ui.view">
<field name="name">report.stock.picking.select</field>
<field name="model">report.stock.picking</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="6">
<filter icon="terp-go-year" string=" 365 Days "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Picking in last 365 days"/>
<filter icon="terp-go-month" string=" 30 Days "
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Picking in last 30 days"/>
<filter icon="terp-go-week"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Picking during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Todo" icon="terp-gtk-go-back-rtl" domain="[('state','in',('draft','auto','confirmed','assigned'))]"/>
<filter string="Done" icon="terp-dialog-close" domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="partner_id"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." groups="base.group_extended">
<field name="product_id"/>
<separator orientation="vertical"/>
<field name="type"/>
<field name="invoice_state"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<newline/>
<field name="order_date"/>
<field name="date_done"/>
<field name="min_date"/>
<field name="max_date"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Partner" name="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Shipping Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Invoice Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'invoice_state'}"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'year'}"/>
</group>
</search>
</field>
</record>
<record id="action_report_report_stock_picking" model="ir.actions.act_window">
<field name="name">Picking</field>
<field name="res_model">report.stock.picking</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_report_report_stock_picking_tree"/>
<field name="search_view_id" ref="view_report_report_stock_picking_filter"/>
<field name="context">{'search_default_Partner':1,'search_default_month':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<record model="ir.actions.act_window.view" id="action_report_report_stock_picking_tree">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_report_report_stock_picking_tree"/>
<field name="act_window_id" ref="action_report_report_stock_picking"/>
</record>
<record model="ir.actions.act_window.view" id="action_report_report_stock_picking_graph">
<field name="sequence" eval="2"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_report_report_stock_picking_graph"/>
<field name="act_window_id" ref="action_report_report_stock_picking"/>
</record>
<menuitem name="Picking" action="action_report_report_stock_picking"
id="menu_report_report_stock_pickings_tree" parent="stock.next_id_61" sequence="5"/>
</data>
</openerp>

View File

@ -32,17 +32,12 @@
"access_stock_lines_date_manager","report.stock.lines.date manager","model_report_stock_lines_date","stock.group_stock_manager",1,1,1,1
"access_stock_lines_date_system","report.stock.lines.date system","model_report_stock_lines_date","base.group_system",1,0,0,0
"access_stock_report_tracklots","stock.report.tracklots","model_stock_report_tracklots","stock.group_stock_user",1,1,1,1
"access_report_products_to_received_planned","report.products.to.received.planned","model_report_products_to_received_planned","stock.group_stock_user",1,1,1,1
"access_report_delivery_products_planned","report.delivery.products.planned","model_report_delivery_products_planned","stock.group_stock_user",1,1,1,1
"access_report_stock_move_user","report.stock.move user","model_report_stock_move","stock.group_stock_user",1,0,0,0
"access_report_stock_move_system","report.stock.move system","model_report_stock_move","base.group_system",1,0,0,0
"access_report_stock_move_manager","report.stock.move manager","model_report_stock_move","stock.group_stock_manager",1,1,1,1
"access_report_stock_inventory_user","report.stock.inventory user","model_report_stock_inventory","stock.group_stock_user",1,1,1,1
"access_report_stock_inventory_manager","report.stock.inventory manager","model_report_stock_inventory","stock.group_stock_manager",1,1,1,1
"access_report_stock_inventory_system","report.stock.inventory system","model_report_stock_inventory","base.group_system",1,0,0,0
"access_report_stock_picking_user","report.stock.picking user","model_report_stock_picking","stock.group_stock_user",1,1,1,1
"access_report_stock_picking_manager","report.stock.picking manager","model_report_stock_picking","stock.group_stock_manager",1,1,1,1
"access_report_stock_picking_system","report.stock.picking system","model_report_stock_picking","base.group_system",1,0,0,0
"access_stock_warehouse_system","stock.warehouse.system","model_stock_warehouse","base.group_system",1,1,1,1
"access_stock_location_system","stock.location.system","model_stock_location","base.group_system",1,1,1,1
"access_stock_journal_system","stock.journal.system","model_stock_journal","base.group_system",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
32 access_stock_lines_date_manager report.stock.lines.date manager model_report_stock_lines_date stock.group_stock_manager 1 1 1 1
33 access_stock_lines_date_system report.stock.lines.date system model_report_stock_lines_date base.group_system 1 0 0 0
34 access_stock_report_tracklots stock.report.tracklots model_stock_report_tracklots stock.group_stock_user 1 1 1 1
access_report_products_to_received_planned report.products.to.received.planned model_report_products_to_received_planned stock.group_stock_user 1 1 1 1
access_report_delivery_products_planned report.delivery.products.planned model_report_delivery_products_planned stock.group_stock_user 1 1 1 1
35 access_report_stock_move_user report.stock.move user model_report_stock_move stock.group_stock_user 1 0 0 0
36 access_report_stock_move_system report.stock.move system model_report_stock_move base.group_system 1 0 0 0
37 access_report_stock_move_manager report.stock.move manager model_report_stock_move stock.group_stock_manager 1 1 1 1
38 access_report_stock_inventory_user report.stock.inventory user model_report_stock_inventory stock.group_stock_user 1 1 1 1
39 access_report_stock_inventory_manager report.stock.inventory manager model_report_stock_inventory stock.group_stock_manager 1 1 1 1
40 access_report_stock_inventory_system report.stock.inventory system model_report_stock_inventory base.group_system 1 0 0 0
access_report_stock_picking_user report.stock.picking user model_report_stock_picking stock.group_stock_user 1 1 1 1
access_report_stock_picking_manager report.stock.picking manager model_report_stock_picking stock.group_stock_manager 1 1 1 1
access_report_stock_picking_system report.stock.picking system model_report_stock_picking base.group_system 1 0 0 0
41 access_stock_warehouse_system stock.warehouse.system model_stock_warehouse base.group_system 1 1 1 1
42 access_stock_location_system stock.location.system model_stock_location base.group_system 1 1 1 1
43 access_stock_journal_system stock.journal.system model_stock_journal base.group_system 1 1 1 1

File diff suppressed because it is too large Load Diff

View File

@ -114,7 +114,13 @@
<field name="fields_id" search="[('model','=','product.template'),('name','=','property_stock_production')]"/>
<field eval="'stock.location,'+str(location_production)" name="value"/>
</record>
<record forcecreate="True" id="decimal_shipping_delay" model="decimal.precision">
<field name="name">Shipping Delay</field>
<field name="digits" eval="2"/>
</record>
<!--
Resource: stock.warehouse
-->

View File

@ -274,6 +274,7 @@
<field name="type">out</field>
<field name="move_type">direct</field>
<field name="invoice_state">2binvoiced</field>
<field name="address_id" ref="base.main_address"/>
<field name="company_id" ref="base.main_company"/>
</record>
</data>

View File

@ -2,13 +2,13 @@
<openerp>
<data>
<menuitem icon="terp-stock" id="menu_stock_root" name="Warehouse" sequence="5"/>
<menuitem id="menu_stock_warehouse_mgmt" name="Warehouse Management" parent="menu_stock_root" sequence="1" groups="base.group_extended"/>
<menuitem icon="terp-stock" id="menu_stock_root" name="Warehouse" groups="group_stock_manager,group_stock_user" sequence="5"/>
<menuitem id="menu_stock_warehouse_mgmt" name="Warehouse Management" parent="menu_stock_root" sequence="1" groups="group_stock_manager,group_stock_user,base.group_extended"/>
<menuitem id="menu_stock_products_moves" name="Products Moves" parent="menu_stock_root" sequence="2"/>
<menuitem id="menu_stock_product" name="Product" parent="menu_stock_root" sequence="6"/>
<menuitem action="product.product_normal_action" id="menu_stock_products_menu" parent="menu_stock_product" sequence="1"/>
<menuitem id="menu_stock_configuration" name="Configuration" parent="menu_stock_root" sequence="15" groups="base.group_system"/>
<menuitem id="menu_warehouse_config" name="Warehouse Management" parent="menu_stock_configuration" sequence="1" groups="base.group_system"/>
<menuitem id="menu_stock_configuration" name="Configuration" parent="menu_stock_root" sequence="15" groups="group_stock_manager,base.group_system"/>
<menuitem id="menu_warehouse_config" name="Warehouse Management" parent="menu_stock_configuration" sequence="1" groups="group_stock_manager,base.group_system"/>
<menuitem id="menu_stock_inventory_control" name="Inventory Control" parent="menu_stock_root" sequence="4"/>
<record id="stock_inventory_line_tree" model="ir.ui.view">
@ -41,7 +41,7 @@
<field colspan="4" domain="[('usage','=','internal')]" name="location_id" select="1"/>
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines" groups="base.group_extended"
type="action" icon="gtk-justify-fill"/>
type="action" icon="terp-stock_effects-object-colorize"/>
</form>
</field>
</record>
@ -85,45 +85,57 @@
<field name="model">stock.inventory</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Lot Inventory">
<form string="Physical Inventory">
<field name="name"/>
<field name="date"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<notebook colspan="4">
<page string="General Informations">
<field colspan="4" name="inventory_line_id" nolabel="1" widget="one2many_list">
<tree string="Inventory Lines" editable="bottom">
<tree string="Products" editable="bottom">
<field context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" domain="[('type','&lt;&gt;','service')]"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field name="prod_lot_id" groups="base.group_extended"/>
<field colspan="4" domain="[('usage','=','internal')]" name="location_id"/>
<field name="state" />
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines" groups="base.group_extended"
type="action" icon="gtk-justify-fill" states="draft"/>
type="action" icon="terp-stock_effects-object-colorize" states="draft"/>
<field colspan="4" domain="[('usage','=','internal')]" name="location_id"/>
<field name="state" />
</tree>
<form string="Inventory Lines">
<form string="Products ">
<field colspan="4" context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" domain="[('type','&lt;&gt;','service')]"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field domain="[('usage','=','internal')]" name="location_id"/>
<group colspan="2" col="4">
<field name="prod_lot_id" groups="base.group_extended"/>
<group colspan="2" col="3">
<button name="%(stock.action_view_stock_inventory_line_split)d"
string="Split inventory lines" groups="base.group_extended"
type="action" icon="gtk-justify-fill"/>
type="action" icon="terp-stock_effects-object-colorize"/>
</group>
</form>
</field>
</page><page string="Posted Inventory" groups="base.group_extended">
<field colspan="4" name="move_ids" nolabel="1"/>
<field colspan="2" name="move_ids" nolabel="1" readonly="1" widget="one2many_list">
<tree string="Stock Moves">
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UoM"/>
<field name="prodlot_id" groups="base.group_extended"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date" string="Date"/>
<field name="state"/>
</tree>
</field>
</page>
</notebook>
<field name="state"/>
<group col="4" colspan="2">
<button name="action_done" states="draft" string="Confirm Inventory" type="object" icon="gtk-apply"/>
<button name="action_cancel" states="cancel" string="Set to Draft" type="object" icon="gtk-cancel"/>
<button name="action_cancel" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name="action_cancel_inventary" states="draft" string="Cancel Inventory" type="object" icon="gtk-cancel"/>
</group>
@ -132,7 +144,7 @@
</record>
<record id="action_inventory_form" model="ir.actions.act_window">
<field name="name">Periodical Inventory</field>
<field name="name">Physical Inventories</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.inventory</field>
<field name="view_type">form</field>
@ -143,7 +155,7 @@
<menuitem action="action_inventory_form" id="menu_action_inventory_form" parent="menu_stock_inventory_control" sequence="30"/>
<record id="action_inventory_form_draft" model="ir.actions.act_window">
<field name="name">Draft Periodical Inventories</field>
<field name="name">Draft Physical Inventories</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.inventory</field>
<field name="view_type">form</field>
@ -172,7 +184,7 @@
context="{'type': 'move_history_ids','field': ''}" colspan="2"/>
</group>
<notebook colspan="4">
<page string="Inventory Moves">
<page string="Stock Moves">
<field colspan="2" name="move_ids" nolabel="1"/>
</page>
</notebook>
@ -200,7 +212,7 @@
</record>
<menuitem id="menu_traceability" name="Traceability" parent="menu_stock_root" sequence="3"/>
<menuitem action="action_tracking_form" id="menu_action_tracking_form"
groups="base.group_extended"
groups="base.group_extended,group_stock_user"
parent="menu_traceability"/>
<record id="lot_line_tree" model="ir.ui.view">
@ -287,8 +299,23 @@
<page string="Revisions">
<field colspan="2" name="revisions" nolabel="1"/>
</page>
<page string="Inventory Moves">
<field colspan="2" name="move_ids" nolabel="1"/>
<page string="Stock Moves">
<field colspan="2" name="move_ids" nolabel="1" widget="one2many_list">
<tree string="Stock Moves">
<field name="picking_id" string="Reference"/>
<field name="origin"/>
<field name="partner_id"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UoM"/>
<field name="tracking_id"/>
<field name="date"/>
<field name="prodlot_id" groups="base.group_extended"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="state"/>
</tree>
</field>
</page>
</notebook>
</form>
@ -342,13 +369,13 @@
<field name="search_view_id" ref="search_product_lot_filter" />
<field name="context">{'full':'1',"search_default_available":1}</field>
</record>
<menuitem action="action_production_lot_form" id="menu_action_production_lot_form" parent="menu_traceability" groups="base.group_extended"/>
<menuitem action="action_production_lot_form" id="menu_action_production_lot_form" parent="menu_traceability" groups="group_stock_user,group_stock_manager,base.group_extended"/>
#
# Lot composition (history)
#
<record id="stock_move_tree" model="ir.ui.view">
<field name="name">Inventory Moves</field>
<field name="name">Stock Moves</field>
<field name="model">stock.move</field>
<field name="type">tree</field>
<field name="field_parent">move_history_ids</field>
@ -363,8 +390,8 @@
<field name="picking_id"/>
<field name="location_id" />
<field name="location_dest_id" />
<field name="date"/>
<field name="date_planned" string="Date"/>
<field name="create_date"/>
<field name="date" string="Date"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
@ -373,7 +400,7 @@
</record>
<record id="stock_move_tree2" model="ir.ui.view">
<field name="name">Inventory Moves</field>
<field name="name">Stock Moves</field>
<field name="model">stock.move</field>
<field name="type">tree</field>
<field name="field_parent">move_history_ids2</field>
@ -388,8 +415,8 @@
<field name="picking_id"/>
<field name="location_id" />
<field name="location_dest_id" />
<field name="date" />
<field name="date_planned" string="Date"/>
<field name="create_date" />
<field name="date" string="Date"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
</tree>
@ -481,7 +508,7 @@
<field name="search_view_id" ref="view_location_search"/>
<field name="context">{'full':1, 'search_default_in_location':1}</field>
</record>
<menuitem action="action_location_form" id="menu_action_location_form" parent="menu_warehouse_config" groups="base.group_system"/>
<menuitem action="action_location_form" id="menu_action_location_form" parent="menu_warehouse_config" groups="base.group_system,group_stock_manager"/>
<record id="view_location_tree" model="ir.ui.view">
<field name="name">stock.location.tree</field>
@ -502,7 +529,7 @@
<field name="view_type">tree</field>
<field name="view_id" ref="view_location_tree"/>
</record>
<menuitem action="action_location_tree" id="menu_action_location_tree" parent="menu_stock_inventory_control" groups="base.group_extended" sequence="20"/>
<menuitem action="action_location_tree" id="menu_action_location_tree" parent="menu_stock_inventory_control" groups="base.group_extended,group_stock_manager" sequence="20"/>
<record id="view_warehouse" model="ir.ui.view">
<field name="name">stock.warehouse</field>
@ -541,7 +568,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="view_warehouse_tree"/>
</record>
<menuitem action="action_warehouse_form" id="menu_action_warehouse_form" parent="menu_warehouse_config" groups="base.group_system"/>
<menuitem action="action_warehouse_form" id="menu_action_warehouse_form" parent="menu_warehouse_config" groups="group_stock_manager,base.group_system"/>
<record id="stock_picking_move_wizard_form" model="ir.ui.view">
<field name="name">stock.picking.move.wizard.form</field>
@ -554,7 +581,7 @@
<field name="picking_id" invisible="True"/>
<field domain="[('picking_id','&lt;&gt;',picking_id),('state','in',['confirmed','assigned']),('picking_id.address_id','=',address_id)]" name="move_ids" nolabel="1" height="100" width="500"/><newline/>
<group colspan="4">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button special="cancel" string="_Cancel" icon="gtk-cancel"/>
<button name="action_move" string="Add" type="object" icon="gtk-add"/>
</group>
</group>
@ -597,7 +624,7 @@
<field name="invoice_state"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="confirmed,assigned" string="Approve" type="action" icon="gtk-go-forward" help="Approve Picking"/>
<button name="%(action_partial_picking)d" states="confirmed,assigned" string="Approve Picking" type="action" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@ -624,7 +651,7 @@
<notebook colspan="4">
<page string="Products">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines}">
<tree colors="grey:scrapped == True" string="Inventory Moves">
<tree colors="grey:scrapped == True" string="Stock Moves">
<field name="name" string="Move Name"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@ -636,7 +663,6 @@
states="draft,waiting,confirmed,assigned"
groups="base.group_extended"/>
<field name="scrapped" invisible="1"/>
<field name="picking_id"/>
<field name="prodlot_id" groups="base.group_extended"/>
<button
name="%(stock.track_line)d"
@ -656,11 +682,11 @@
states="draft,assigned,confirmed,done"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
</tree>
<form string="Inventory Moves">
<form string="Stock Moves">
<group colspan="2" col="4">
<separator colspan="4" string="Move Information"/>
<field name="name" invisible="1" colspan="4"/>
@ -678,14 +704,14 @@
<group colspan="2" col="2">
<separator string="Locations" colspan="2" />
<field name="location_id" domain="[('usage','=','internal')]" widget="selection"/>
<field name="location_dest_id" domain="[('usage','=','internal')]" widget="selection"/>
<field name="location_id" domain="[('usage','=','internal')]" />
<field name="location_dest_id" domain="[('usage','=','internal')]" />
</group>
<group colspan="2" col="2">
<separator string="Dates" colspan="2" />
<field name="date" invisible="1"/>
<field name="date_planned"/>
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected"/>
</group>
@ -717,13 +743,13 @@
</field>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-apply"/>
<button name="draft_force_assign" states="draft" string="Confirm (Do Not Process Now)" type="object" icon="gtk-apply"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Approve" type="action" icon="gtk-apply"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@ -761,8 +787,12 @@
<newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'address_id'}"/>
<separator orientation="vertical" />
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical" />
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'stock_journal_id'}" groups="base.group_extended"/>
</group>
</search>
</field>
@ -775,15 +805,15 @@
<field name="arch" type="xml">
<tree colors="blue:state in ('draft');grey:state in ('cancel');red:state not in ('cancel', 'done') and date &lt; current_date" string="Picking list">
<field name="name"/>
<field name="address_id"/>
<field name="partner_id"/>
<field name="backorder_id" groups="base.group_extended"/>
<field name="origin"/>
<field name="date"/>
<field name="min_date"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="assigned" string="Approve" type="action" icon="gtk-go-forward" help="Approve Delivery"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the delivery. Do you want to continue?"/>
<button name="%(action_partial_picking)d" states="assigned" type="action" icon="gtk-go-forward" string="Approve Delivery"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" confirm="This operation will cancel the delivery. Do you want to continue?"/>
</tree>
</field>
</record>
@ -810,7 +840,7 @@
<notebook colspan="4">
<page string="Products">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
<tree colors="grey:scrapped == True" string="Inventory Moves">
<tree colors="grey:scrapped == True" string="Stock Moves">
<field name="name" string="Move Name"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@ -841,11 +871,11 @@
groups="base.group_extended"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date"/>
<field name="date_expected" string="Date Expected"/>
<field name="state"/>
</tree>
<form string="Inventory Moves">
<form string="Stock Moves">
<group colspan="2" col="4">
<separator colspan="2" string="Move Information"/>
<field name="name" invisible="1" colspan="4"/>
@ -863,14 +893,14 @@
<group colspan="2" col="2">
<separator string="Locations" colspan="2" />
<field name="location_id" domain="[('usage','=','internal')]" widget="selection"/>
<field name="location_dest_id" domain="[('usage','&lt;&gt;','view')]" widget="selection"/>
<field name="location_id" domain="[('usage','=','internal')]" />
<field name="location_dest_id" domain="[('usage','&lt;&gt;','view')]" />
</group>
<group colspan="2" col="2">
<separator string="Dates" colspan="2" />
<field name="date" invisible="1"/>
<field name="date_planned"/>
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected"/>
</group>
@ -908,7 +938,7 @@
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Products Sent" type="action" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@ -939,15 +969,19 @@
<filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id','!=',False)]" help="Is a Back Order" groups="base.group_extended"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="address_id"/>
<field name="partner_id"/>
<field name="origin"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="10">
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'address_id'}"/>
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical" />
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical" />
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'stock_journal_id'}" groups="base.group_extended"/>
</group>
</search>
</field>
@ -960,7 +994,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="domain">[('type','=','delivery')]</field>
<field name="context">{'contact_display': 'partner',"search_default_available":1}</field>
<field name="context">{'contact_display': 'partner_address',"search_default_available":1}</field>
<field name="search_view_id" ref="view_stock_delivery_filter"/>
</record>
<record id="action_picking_tree_delivery_view1" model="ir.actions.act_window.view">
@ -994,7 +1028,7 @@
<field name="arch" type="xml">
<tree colors="blue:state in ('draft');grey:state in ('cancel');red:state not in ('cancel', 'done') and date &lt; current_date" string="Picking list">
<field name="name"/>
<field name="address_id"/>
<field name="partner_id"/>
<field name="origin"/>
<field name="date"/>
<field name="min_date"/>
@ -1002,7 +1036,7 @@
<field name="invoice_state"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="assigned" string="Approve" type="action" icon="gtk-go-forward" help="Approve Picking"/>
<button name="%(action_partial_picking)d" states="assigned" string="Approve Picking" type="action" icon="gtk-go-forward"/>
</tree>
</field>
</record>
@ -1029,7 +1063,7 @@
<notebook colspan="4">
<page string="Products">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}" >
<tree colors="grey:scrapped==True" string="Inventory Moves">
<tree colors="grey:scrapped==True" string="Stock Moves">
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="UoM"/>
@ -1055,12 +1089,12 @@
groups="base.group_extended"
states="draft,assigned,confirmed,done"/>
<field name="location_id"/>
<field name="date_planned"/>
<field name="date"/>
<field name="state"/>
<button name="%(action_partial_move)d" string="Partial" type="action" states="confirmed,assigned" icon="gtk-justify-fill"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
</tree>
<form string="Inventory Moves">
<form string="Stock Moves">
<group colspan="2" col="4">
<separator colspan="4" string="Move Information"/>
<field name="name" invisible="1" colspan="4" />
@ -1078,14 +1112,14 @@
<group colspan="2" col="2">
<separator string="Locations" colspan="2" />
<field name="location_id" domain="[('usage','=','internal')]" widget="selection"/>
<field name="location_dest_id" domain="[('usage','&lt;&gt;','view')]" widget="selection"/>
<field name="location_id" domain="[('usage','=','internal')]" />
<field name="location_dest_id" domain="[('usage','&lt;&gt;','view')]" />
</group>
<group colspan="2" col="2">
<separator string="Dates" colspan="2" />
<field name="date" invisible="1"/>
<field name="date_planned"/>
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected"/>
</group>
@ -1123,7 +1157,7 @@
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Done" type="action" icon="gtk-execute"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@ -1154,17 +1188,21 @@
<filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order" groups="base.group_extended"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="address_id" />
<field name="partner_id" />
<field name="origin"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'address_id'}"/>
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical" />
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical" />
<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'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'stock_journal_id'}" groups="base.group_extended"/>
</group>
</search>
</field>
@ -1177,7 +1215,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="domain">[('type','=','out')]</field>
<field name="context">{'contact_display': 'partner', 'search_default_available': 1}</field>
<field name="context">{'contact_display': 'partner_address', 'search_default_available': 1}</field>
<field name="search_view_id" ref="view_picking_out_search"/>
</record>
<record id="action_picking_tree_out_view1_waiting" model="ir.actions.act_window.view">
@ -1206,7 +1244,7 @@
<field name="arch" type="xml">
<tree colors="blue:state in ('draft');grey:state in ('done');red:state not in ('cancel', 'done') and date &lt; current_date" string="Picking list">
<field name="name"/>
<field name="address_id"/>
<field name="partner_id" />
<field name="backorder_id" groups="base.group_extended"/>
<field name="origin"/>
<field name="date"/>
@ -1214,8 +1252,8 @@
<field name="invoice_state" groups="base.group_extended"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="assigned" string="Approve" type="action" icon="gtk-ok" help="Receive products"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the shipment. Do you want to continue?" />
<button name="%(action_partial_picking)d" states="assigned" string="Receive products" type="action" icon="gtk-ok"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" confirm="This operation will cancel the shipment. Do you want to continue?" />
</tree>
</field>
</record>
@ -1242,10 +1280,10 @@
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}" >
<tree colors="grey:scrapped==True" string="Inventory Moves">
<field name="product_id" readonly="1"/>
<field name="product_qty" readonly="1"/>
<field name="product_uom" string="UoM" readonly="1"/>
<tree colors="grey:scrapped==True" string="Stock Moves">
<field name="product_id" />
<field name="product_qty" />
<field name="product_uom" string="UoM" />
<button name="%(stock.move_scrap)d"
string="Scrap Products" type="action"
icon="gtk-convert" context="{'scrap': True}"
@ -1271,7 +1309,7 @@
<field name="location_dest_id"/>
<field name="state"/>
</tree>
<form string="Inventory Moves">
<form string="Stock Moves">
<group colspan="2" col="4">
<separator colspan="4" string="Move Information"/>
<field name="name" invisible="1" colspan="4"/>
@ -1289,14 +1327,14 @@
<group colspan="2" col="2">
<separator string="Locations" colspan="2" />
<field name="location_id" domain="[('usage','&lt;&gt;','view')]" widget="selection"/>
<field name="location_dest_id" domain="[('usage','=','internal')]" widget="selection"/>
<field name="location_id" domain="[('usage','&lt;&gt;','view')]" />
<field name="location_dest_id" domain="[('usage','=','internal')]" />
</group>
<group colspan="2" col="2">
<separator string="Dates" colspan="2" />
<field name="date" invisible="1"/>
<field name="date_planned"/>
<field name="create_date" invisible="1"/>
<field name="date"/>
<field name="date_expected"/>
</group>
@ -1322,7 +1360,7 @@
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object" icon="gtk-find"/>
<button name="action_cancel" states="assigned" string="Cancel" type="object" icon="gtk-cancel"/>
<button name="action_cancel" states="assigned" string="_Cancel" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
@ -1334,7 +1372,7 @@
<button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Products Received" type="action" icon="gtk-ok"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-document-new" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional Info" groups="base.group_extended,base.group_multi_company">
@ -1361,19 +1399,21 @@
<filter icon="terp-accessories-archiver-minus" string="Back Orders" domain="[('backorder_id', '!=', False)]" help="Is a Back Order" groups="base.group_extended"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="address_id"/>
<field name="partner_id"/>
<field name="origin"/>
<field name="stock_journal_id" groups="base.group_extended" widget="selection"/>
<field name="company_id" widget="selection" groups="base.group_multi_company" />
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'address_id'}"/>
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical" />
<filter icon="terp-stock_effects-object-colorize" name="state" string="State" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical" />
<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'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'stock_journal_id'}" groups="base.group_extended"/>
</group>
</search>
</field>
@ -1387,7 +1427,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="domain">[('type','=','in')]</field>
<field name="context">{'contact_display': 'partner',"search_default_available":1}</field>
<field name="context">{'contact_display': 'partner_address',"search_default_available":1}</field>
<field name="search_view_id" ref="view_picking_in_search"/>
</record>
<record id="action_invoice_tree5_view1" model="ir.actions.act_window.view">
@ -1427,9 +1467,13 @@
<newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<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'}"/>
<separator orientation="vertical"/>
<filter string="Origin" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'origin'}"/>
<separator orientation="vertical" />
<filter string="Journal" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'stock_journal_id'}" groups="base.group_extended"/>
</group>
</search>
</field>
@ -1442,7 +1486,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="domain">[('type','=','internal')]</field>
<field name="context">{'contact_display': 'partner',"search_default_confirmed":1}</field>
<field name="context">{'contact_display': 'partner_address',"search_default_confirmed":1}</field>
<field name="search_view_id" ref="view_picking_internal_search"/>
</record>
@ -1469,10 +1513,10 @@
<field name="type">tree</field>
<field eval="6" name="priority"/>
<field name="arch" type="xml">
<tree colors="grey:state in ('cancel');red:(state not in ('cancel','done')) and date_planned > current_date" string="Moves" editable="top">
<tree colors="grey:state in ('cancel');red:(state not in ('cancel','done')) and date > current_date" string="Moves" editable="top">
<field name="picking_id" string="Reference"/>
<field name="origin"/>
<field name="date" invisible="1"/>
<field name="create_date" invisible="1"/>
<field name="partner_id"/>
<field name="product_id"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
@ -1500,10 +1544,10 @@
states="draft,assigned,confirmed,done"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date_planned"/>
<field name="date"/>
<field name="date_expected"/>
<field name="state"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-ok"/>
</tree>
</field>
</record>
@ -1516,36 +1560,34 @@
<field name="type">form</field>
<field eval="4" name="priority"/>
<field name="arch" type="xml">
<form string="Inventory Moves">
<group colspan="4" col="7">
<separator colspan="7" string="Move Information"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.address_id)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" string="Unit Of Measure" widget="selection"/>
<form string="Stock Moves">
<group colspan="2" col="4">
<separator colspan="4" string="Move Information"/>
<field name="name" colspan="4"/>
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, parent.address_id)" colspan="4"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="3"/>
<button name="%(stock.move_scrap)d" groups="base.group_extended"
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1"/>
<newline/>
<field name="name" string="Reason"/>
<field name="product_uos_qty" groups="product.product_uos"/>
<field name="product_uos" groups="product.product_uos"/>
<newline/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="product_uom" string="Unit Of Measure" widget="selection" colspan="4"/>
<field name="product_uos_qty" groups="product.product_uos" colspan="4"/>
<field name="product_uos" groups="product.product_uos" colspan="4"/>
</group>
<group colspan="2" col="2">
<separator string="Locations &amp; Picking" colspan="2" />
<field name="address_id" context="{'contact_display':'partner'}"/>
<field name="location_id" widget="selection"/>
<field name="location_dest_id" widget="selection"/>
<field name="picking_id"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group colspan="2" col="2">
<separator string="Dates &amp; Priority" colspan="2" />
<field name="date" groups="base.group_extended"/>
<field name="date_planned"/>
<field name="create_date"/>
<field name="date"/>
<field name="date_expected"/>
<field name="priority"/>
</group>
@ -1570,9 +1612,9 @@
<separator colspan="4"/>
<field name="state"/>
<group col="4" colspan="2">
<button name="action_confirm" states="draft" string="Process Later" type="object" icon="gtk-apply"/>
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="action_cancel" states="assigned,confirmed" string="Cancel" type="object" icon="gtk-cancel"/>
<button name="action_cancel" states="assigned,confirmed" string="_Cancel" type="object" icon="gtk-cancel"/>
<button name="action_done" states="assigned" string="Done" type="object" icon="gtk-jump-to"/>
</group>
</form>
@ -1585,9 +1627,9 @@
<field name="type">search</field>
<field eval="3" name="priority"/>
<field name="arch" type="xml">
<search string="Inventory Moves">
<search string="Stock Moves">
<group col="14" colspan="4">
<filter icon="terp-go-today" string="Today" domain="[('date_planned','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date_planned','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders processed Today or planned for Today"/>
<filter icon="terp-go-today" string="Today" domain="[('date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders processed Today or planned for Today"/>
<separator orientation="vertical"/>
<filter icon="terp-check" string="Done" name="done" domain="[('state','=','done')]" help="Stock moves that have been processed"/>
<filter icon="terp-stock" string="Future" name="future" domain="[('state','in',('assigned','confirmed','waiting'))]" help="Stock moves that are Confirmed, Available or Waiting"/>
@ -1596,7 +1638,7 @@
<field name="product_id"/>
<field name="location_id" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/>
<field name="address_id" string="Partner" context="{'contact_display':'partner'}" filter_domain="[('picking_id.address_id','ilike',self)]"/>
<field name="date_planned"/>
<field name="date"/>
</group>
<newline/>
<group expand="0" string="Extended Filters..." colspan="4" col="8">
@ -1618,15 +1660,15 @@
<separator orientation="vertical"/>
<filter icon="terp-stock_effects-object-colorize" string="State" domain="[]" context="{'group_by':'state'}" />
<separator orientation="vertical"/>
<filter string="Creation" name="groupby_date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Expected" name="groupby_date_planned" icon="terp-go-month" domain="[]" context="{'group_by':'date_planned'}"/>
<filter string="Creation" name="groupby_create_date" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}"/>
<filter string="Expected" name="groupby_date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
</group>
</search>
</field>
</record>
<record id="action_move_form2" model="ir.actions.act_window">
<field name="name">Inventory Moves</field>
<field name="name">Stock Moves</field>
<field name="res_model">stock.move</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -1673,14 +1715,32 @@
groups="base.group_extended"
icon="terp-stock_effects-object-colorize"
states="draft,assigned,confirmed,done"/>
<field name="date_planned"/>
<field name="date"/>
<field name="state"/>
<button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes" groups="base.group_extended"/>
<button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="%(action_partial_move)d" string="Partial" type="action" states="confirmed,assigned" icon="gtk-justify-fill"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
</tree>
</field>
</record>
<!-- test -->
<record id="view_move_tree_reception_picking_board" model="ir.ui.view">
<field name="name">stock.move.tree3</field>
<field name="model">stock.move</field>
<field name="type">tree</field>
<field eval="6" name="priority"/>
<field name="arch" type="xml">
<tree string="Moves">
<field name="picking_id" string="Reference"/>
<field name="partner_id" string="Partner"/>
<field name="product_id"/>
<field name="product_qty" />
<field name="product_uom" string="UoM"/>
<field name="date"/>
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
</tree>
</field>
</record>
<record id="view_move_form_reception_picking" model="ir.ui.view">
<field name="name">stock.move.form2</field>
@ -1689,38 +1749,37 @@
<field eval="6" name="priority"/>
<field name="arch" type="xml">
<form string="Moves">
<group colspan="4" col="7">
<field name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, address_id)"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
<field name="product_uom" widget="selection"/>
<group colspan="2" col="4">
<separator colspan="4" string="Move Information"/>
<field name="name" colspan="4"/>
<field name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, address_id)" colspan="4"/>
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)" colspan="3"/>
<button name="%(stock.move_scrap)d" groups="base.group_extended"
string="Scrap" type="action"
icon="gtk-convert" context="{'scrap': True}"
states="draft,waiting,confirmed,assigned" colspan="1"/>
<newline/>
<field name="name" string="Reason"/>
<field name="product_uos_qty" groups="product.product_uos"/>
<field name="product_uos" widget="selection" groups="product.product_uos"/>
<newline/>
<field name="location_id"/>
<field name="location_dest_id"/>
</group>
<group colspan="2" col="2">
<separator string="Dates &amp; Priority" colspan="2" />
<field name="date" groups="base.group_extended"/>
<field name="date_planned"/>
<field name="date_expected"/>
<field name="priority" groups="base.group_extended"/>
<field name="product_uom" widget="selection" colspan="4"/>
<field name="product_uos_qty" groups="product.product_uos" colspan="4"/>
<field name="product_uos" widget="selection" groups="product.product_uos" colspan="4"/>
</group>
<group colspan="2" col="2">
<separator string="Locations &amp; Picking" colspan="2" />
<field name="address_id" context="{'contact_display':'partner'}"/>
<field name="location_id" widget="selection"/>
<field name="location_dest_id" widget="selection"/>
<field name="picking_id"/>
<field name="address_id" context="{'contact_display':'partner'}"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group colspan="2" col="2">
<separator string="Dates &amp; Priority" colspan="2" />
<field name="create_date"/>
<field name="date"/>
<field name="date_expected"/>
<field name="priority"/>
</group>
<group colspan="2" col="4" groups="base.group_extended">
<separator string="Traceability" colspan="4" groups="base.group_extended"/>
<field name="tracking_id" colspan="3" groups="base.group_extended"/>
@ -1740,11 +1799,11 @@
<separator colspan="4"/>
<field name="state"/>
<group col="5" colspan="2">
<button name="action_cancel" states="assigned,confirmed" string="Cancel" type="object" icon="gtk-cancel"/>
<button name="action_confirm" states="draft" string="Process Later" type="object" icon="gtk-apply"/>
<button name="force_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="action_confirm" states="draft" string="Confirm" type="object" icon="gtk-apply"/>
<button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
<button name="action_cancel" states="assigned,confirmed" string="_Cancel" type="object" icon="gtk-cancel"/>
<button name="%(action_partial_move)d" states="assigned,confirmed" string="Partial" type="action" icon="gtk-justify-fill"/>
<button name="action_done" states="draft,confirmed,assigned" string="Done" type="object" icon="gtk-go-forward"/>
<button name="action_done" states="assigned" string="Done" type="object" icon="gtk-jump-to"/>
</group>
</form>
</field>
@ -1756,9 +1815,9 @@
<field name="type">search</field>
<field eval="6" name="priority"/>
<field name="arch" type="xml">
<search string="Inventory Moves">
<search string="Stock Moves">
<group col="8" colspan="4">
<filter icon="terp-go-today" string="Today" domain="[('date_planned','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date_planned','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders planned for today"/>
<filter icon="terp-go-today" string="Today" domain="[('date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders planned for today"/>
<separator orientation="vertical"/>
<filter icon="terp-gtk-go-back-rtl" name="receive" string="To Do" domain="[('state','in',('confirmed','assigned'))]" help="Stock to be received"/>
<filter icon="terp-check" name="received" string="Done" domain="[('state','=','done')]"/>
@ -1770,12 +1829,13 @@
<newline/>
<group expand="0" string="Group By..." colspan="4" col="8">
<filter string="Supplier" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Order" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'origin'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_planned'}" />
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}" />
</group>
<newline/>
<group expand="0" string="Extended options..." groups="base.group_extended">
@ -1793,7 +1853,7 @@
<field name="view_mode">tree,form</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','in')]</field>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context" eval="'{\'search_default_receive\':1,\'full\':1,\'default_location_dest_id\': '+str(ref('stock.stock_location_stock'))+', \'default_location_id\': '+str(ref('stock.stock_location_suppliers'))+'}'"/>
<field name="context">{"search_default_receive":1}</field>
<field name="search_view_id" ref="view_move_search_reception_picking"/>
</record>
@ -1855,7 +1915,7 @@
<act_window
context="{'location': active_id, 'search_default_done': 1,'search_default_product_id': [active_id]}"
id="act_product_stock_move_open"
name="Inventory Moves"
name="Stock Moves"
res_model="stock.move"
src_model="product.product"/>
@ -1870,7 +1930,7 @@
context="{'location': active_id, 'search_default_future': 1,'search_default_product_id': [active_id]}"
domain="[('state','in',('waiting','confirmed','assigned'))]"
id="act_product_stock_move_futur_open"
name="Future Inventory Moves"
name="Future Stock Moves"
res_model="stock.move"
src_model="product.product"
groups="base.group_extended"/>
@ -1891,80 +1951,6 @@
<field eval="'ir.actions.act_window,%d'%action_view_stock_location_product" name="value"/>
<field eval="True" name="object"/>
</record>
<!-- Graph Views -->
<!-- Products To Received Vs Planned -->
<record model="ir.ui.view" id="view_move_graph_reception_picking_tree">
<field name="name">Products To Received</field>
<field name="model">report.products.to.received.planned</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Products To Received" >
<field name="qty" />
<field name="planned_qty" />
<field name="date"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_move_graph_reception_picking">
<field name="name">Products To Received</field>
<field name="model">report.products.to.received.planned</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Products To Received" type="bar" orientation="vertical">
<field name="date"/>
<field name="qty" operator="+"/>
<field name="planned_qty" operator="+"/>
</graph>
</field>
</record>
<record id="action_move_graph_reception_picking" model="ir.actions.act_window">
<field name="name">Number of Products to receive vs planned</field>
<field name="res_model">report.products.to.received.planned</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="view_id" ref="view_move_graph_reception_picking"/>
</record>
<!-- Delivery Product Vs Planned -->
<record model="ir.ui.view" id="view_move_delivery_products_planned_tree">
<field name="name">Delivered Products</field>
<field name="model">report.delivery.products.planned</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Products To Received" >
<field name="qty" />
<field name="planned_qty" />
<field name="date"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_move_delivery_products_planned_graph">
<field name="name">Delivered Products</field>
<field name="model">report.delivery.products.planned</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Products To Received" type="bar" orientation="vertical">
<field name="date"/>
<field name="qty" operator="+"/>
<field name="planned_qty" operator="+"/>
</graph>
</field>
</record>
<record id="action_move_delivery_products_planned" model="ir.actions.act_window">
<field name="name">Delivered Products Vs Planned</field>
<field name="res_model">report.delivery.products.planned</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="view_id" ref="view_move_delivery_products_planned_graph"/>
</record>
<record id="action_picking_tree_out" model="ir.actions.act_window">
<field name="name">Customers Packings</field>
<field name="res_model">stock.picking</field>
@ -2001,7 +1987,7 @@
<field name="view_mode">tree,form</field>
<field name="domain">['|','&amp;',('picking_id','=',False),('location_dest_id.usage', 'in', ['customer','supplier']),'&amp;',('picking_id','!=',False),('picking_id.type','=','out')]</field>
<field name="view_id" ref="view_move_tree_reception_picking"/>
<field name="context" eval="'{\'search_default_receive\':1,\'full\':1,\'default_location_id\': '+str(ref('stock.stock_location_stock'))+', \'default_location_dest_id\': '+str(ref('stock.stock_location_customers'))+'}'"/>
<field name="context">{"search_default_receive":1}</field>
<field name="search_view_id" ref="view_move_search_reception_picking"/>
</record>
@ -2064,7 +2050,7 @@
<menuitem
action="action_stock_journal_form"
id="menu_action_stock_journal_form"
groups="base.group_extended"
groups="group_stock_manager,base.group_extended"
parent="menu_warehouse_config" />
</data>

View File

@ -96,11 +96,13 @@
<record id="trans_assigned_cancel" model="workflow.transition">
<field name="act_from" ref="act_assigned"/>
<field name="act_to" ref="act_cancel"/>
<field name="condition">allow_cancel()</field>
<field name="signal">button_cancel</field>
</record>
<record id="trans_confirmed_cancel" model="workflow.transition">
<field name="act_from" ref="act_confirmed"/>
<field name="act_to" ref="act_cancel"/>
<field name="condition">allow_cancel()</field>
<field name="signal">button_cancel</field>
</record>
<record id="trans_draft_cancel" model="workflow.transition">

View File

@ -53,7 +53,7 @@
I create Receivable Account .
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000'
code: '40000-stock-test'
company_id: base.main_company
currency_mode: current
name: Receivable
@ -65,7 +65,7 @@
I create Payable Account.
-
!record {model: account.account, id: account_account_payable0}:
code: '440000'
code: '440000-stock-test'
company_id: base.main_company
currency_mode: current
name: Payable
@ -111,7 +111,7 @@
I create Product Sale Account.
-
!record {model: account.account, id: account_account_productsale0}:
code: '001'
code: '001-stock-test'
company_id: base.main_company
currency_mode: current
name: Product Sale
@ -123,7 +123,7 @@
I create Product Purchase Account.
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002'
code: '0002-stock-test'
company_id: base.main_company
currency_mode: current
name: Product Purchase
@ -267,7 +267,7 @@
-
!record {model: stock.move.split, id: stock_move_split_0}:
line_ids:
- name: '00001'
- name: '00001-stock-test'
quantity: 5
product_id: stock.product_product_hpcdwriters0
@ -294,7 +294,7 @@
invoice_state: none
move_lines:
- company_id: base.main_company
date_planned: '2010-05-11 15:18:57'
date: '2010-05-11 15:18:57'
location_dest_id: stock.stock_location_customers
location_id: stock.stock_location_stock
name: HP CD writers

View File

@ -27,7 +27,6 @@ import stock_partial_move
import stock_replacement
import stock_ups
import stock_inventory_merge
import stock_inventory_set_stock_zero
import stock_fill_inventory
import stock_inventory_line_split
import stock_invoice_onshipping

View File

@ -21,12 +21,13 @@
from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
class change_standard_price(osv.osv_memory):
_name = "stock.change.standard.price"
_description = "Change Standard Price"
_columns = {
'new_price': fields.float('Price', required=True,
'new_price': fields.float('Price', required=True, digits_compute=dp.get_precision('Account'),
help="If cost price is increased, stock variation account will be debited "
"and stock output account will be credited with the value = (difference of amount * quantity available).\n"
"If cost price is decreased, stock variation account will be creadited and stock input account will be debited."),

View File

@ -24,14 +24,32 @@ from tools.translate import _
class stock_fill_inventory(osv.osv_memory):
_name = "stock.fill.inventory"
_description = "Fill Inventory"
_description = "Import Inventory"
_columns = {
'location_id': fields.many2one('stock.location', 'Location', required=True),
'recursive': fields.boolean("Include all children for the location"),
'recursive': fields.boolean("Include children",help="If checked, products contained in child locations of selected location will be included as well."),
'set_stock_zero': fields.boolean("Set to zero",help="If checked, all product quantities will be set to zero to help ensure a real physical inventory is done"),
}
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
if context==None:
context={}
res = super(stock_fill_inventory, self).view_init(cr, uid, fields_list, context=context)
if context.get('active_id', False):
stock = self.pool.get('stock.inventory').browse(cr, uid, context.get('active_id', False))
if stock.state=='done':
raise osv.except_osv('Error!','Stock Inventory is done')
True
def fill_inventory(self, cr, uid, ids, context):
""" To fill stock inventory according to products available in the selected locations.
def fill_inventory(self, cr, uid, ids, context=None):
""" To Import stock inventory according to products available in the selected locations.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@ -39,36 +57,43 @@ class stock_fill_inventory(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
if context==None:
context={}
inventory_line_obj = self.pool.get('stock.inventory.line')
location_obj = self.pool.get('stock.location')
product_obj = self.pool.get('product.product')
stock_location_obj = self.pool.get('stock.location')
for fill_inventory in self.browse(cr, uid, ids):
res = {}
res_location = {}
if fill_inventory.recursive :
location_ids = location_obj.search(cr, uid, [('location_id',
'child_of', fill_inventory.location_id.id)])
for location in location_ids :
res = location_obj._product_get(cr, uid, location)
res_location[location] = res
else:
context.update({'compute_child': False})
res = location_obj._product_get(cr, uid,
fill_inventory.location_id.id, context=context)
res_location[fill_inventory.location_id.id] = res
if ids and len(ids):
ids = ids[0]
else:
return {}
fill_inventory = self.browse(cr, uid, ids)
res = {}
res_location = {}
if fill_inventory.recursive :
location_ids = location_obj.search(cr, uid, [('location_id',
'child_of', fill_inventory.location_id.id)])
for location in location_ids :
res = location_obj._product_get(cr, uid, location)
res_location[location] = res
else:
context.update({'compute_child': False})
res = location_obj._product_get(cr, uid,
fill_inventory.location_id.id, context=context)
res_location[fill_inventory.location_id.id] = res
product_ids = []
for location in res_location.keys():
res = res_location[location]
for product_id in res.keys():
prod = product_obj.browse(cr, uid, [product_id])[0]
uom = prod.uom_id.id
context.update({'uom': uom})
context.update(uom=uom, compute_child=False)
amount = stock_location_obj._product_get(cr, uid,
location, [product_id], context=context)[product_id]
if(amount):
if fill_inventory.set_stock_zero:
amount = 0
line_ids=inventory_line_obj.search(cr, uid,
[('inventory_id', '=', context['active_ids']),
('location_id', '=', location),

View File

@ -2,28 +2,30 @@
<openerp>
<data>
<record id="view_stock_fill_inventory" model="ir.ui.view">
<field name="name">Fill Inventory</field>
<field name="name">Import Inventory</field>
<field name="model">stock.fill.inventory</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Fill Inventory">
<separator string="Fill Inventory for specific location" colspan="4" />
<form string="Import Inventory">
<separator string="Import current product inventory from the following location" colspan="4" />
<field name="location_id"/>
<newline/>
<field name="recursive"/>
<newline/>
<field name="set_stock_zero"/>
<separator string="" colspan="4" />
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button special="cancel" string="_Cancel" icon='gtk-cancel'/>
<button name="fill_inventory" string="Fill Inventory" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
<act_window name="Fill Inventory"
<act_window name="Import Inventory"
res_model="stock.fill.inventory"
src_model="stock.inventory"
view_mode="form"
target="new"
context="{'search_default_in_location':1}"
key2="client_action_multi"
id="action_view_stock_fill_inventory"/>

View File

@ -25,7 +25,25 @@ from tools.translate import _
class stock_inventory_merge(osv.osv_memory):
_name = "stock.inventory.merge"
_description = "Merge Inventory"
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
if not context:
context={}
res = super(stock_inventory_merge, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if context.get('active_model','') == 'stock.inventory' and len(context['active_ids']) < 2:
raise osv.except_osv(_('Warning'),
_('Please select multiple physical inventories to merge in the list view.'))
return res
def do_merge(self, cr, uid, ids, context):
""" To merge selected Inventories.
@param self: The object pointer.
@ -37,13 +55,7 @@ class stock_inventory_merge(osv.osv_memory):
"""
invent_obj = self.pool.get('stock.inventory')
invent_line_obj = self.pool.get('stock.inventory.line')
invent_lines = {}
if len(context['active_ids']) < 2:
raise osv.except_osv(_('Warning'),
_('Please select at least two inventories.'))
for inventory in invent_obj.browse(cr, uid, context['active_ids'], context=context):
if inventory.state == "done":
raise osv.except_osv(_('Warning'),

View File

@ -12,7 +12,7 @@
<label string="Do you want to merge theses inventories ?"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button special="cancel" string="_Cancel" icon='gtk-cancel'/>
<button name="do_merge" string="Yes" type="object" icon="gtk-apply"/>
</group>
</form>

View File

@ -1,74 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
class inventory_set_stock_zero(osv.osv_memory):
_name = "stock.inventory.set.stock.zero"
_description = "Set Stock to 0"
_columns = {
'location_id': fields.many2one('stock.location', 'Location', required=True),
}
def do_merge(self, cr, uid, ids, context):
""" To set stock to Zero
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: the ID or list of IDs if we want more than one
@param context: A standard dictionary
@return:
"""
invent_obj = self.pool.get('stock.inventory')
invent_line_obj = self.pool.get('stock.inventory.line')
prod_obj = self.pool.get('product.product')
if len(context['active_ids']) <> 1:
raise osv.except_osv(_('Warning'),
_('Please select one and only one inventory !'))
for id in ids:
datas = self.read(cr, uid, id)
loc = str(datas['location_id'])
cr.execute('select distinct location_id,product_id \
from stock_inventory_line \
where inventory_id=%s', (context['active_id'],))
inv = cr.fetchall()
cr.execute('select distinct product_id from stock_move where \
location_dest_id=%s or location_id=%s', (loc, loc,))
stock = cr.fetchall()
for s in stock:
if (loc, s[0]) not in inv:
p = prod_obj.browse(cr, uid, s[0])
invent_line_obj.create(cr, uid, {
'inventory_id': context['active_id'],
'location_id': loc,
'product_id': s[0],
'product_uom': p.uom_id.id,
'product_qty': 0.0,
})
return {}
inventory_set_stock_zero()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_inventory_set_stock_zero" model="ir.ui.view">
<field name="name">Set Stock to Zero</field>
<field name="model">stock.inventory.set.stock.zero</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Set Stock to Zero">
<separator string="Set Stocks to Zero" colspan="4" />
<field name="location_id"/>
<newline/>
<label colspan="4" string="Do you want to set stocks to zero ?"/>
<separator string="" colspan="4" />
<button special="cancel" icon='gtk-cancel' string="Cancel" />
<button name="do_merge" string="Set Stock to Zero" type="object" icon="gtk-ok"/>
</form>
</field>
</record>
<act_window name="Set Stock to Zero"
res_model="stock.inventory.set.stock.zero"
src_model="stock.inventory"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_inventory_set_stock_zero"/>
</data>
</openerp>

View File

@ -48,22 +48,22 @@ class stock_invoice_onshipping(osv.osv_memory):
if context is None:
context = {}
picking_obj = self.pool.get('stock.picking')
usage = 'customer'
src_usage = dest_usage = None
pick = picking_obj.browse(cr, uid, context['active_id'], context=context)
if pick.invoice_state == 'invoiced':
raise osv.except_osv(_('UserError'), _('Invoice is already created.'))
if pick.invoice_state == 'none':
raise osv.except_osv(_('UserError'), _('This picking does not require any invoicing.'))
if pick.move_lines:
usage = pick.move_lines[0].location_id.usage
if pick.type == 'out' and usage == 'supplier':
src_usage = pick.move_lines[0].location_id.usage
dest_usage = pick.move_lines[0].location_dest_id.usage
if pick.type == 'out' and dest_usage == 'supplier':
type = 'in_refund'
elif pick.type == 'out' and usage == 'customer':
elif pick.type == 'out' and dest_usage == 'customer':
type = 'out_invoice'
elif pick.type == 'in' and usage == 'supplier':
elif pick.type == 'in' and src_usage == 'supplier':
type = 'in_invoice'
elif pick.type == 'in' and usage == 'customer':
elif pick.type == 'in' and src_usage == 'customer':
type = 'out_refund'
else:
type = 'out_invoice'

View File

@ -16,7 +16,7 @@
<newline/>
<field name="invoice_date" />
<separator string="" colspan="4" />
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button special="cancel" string="_Cancel" icon='gtk-cancel'/>
<button name="create_invoice" string="Create Invoices" type="object" icon="gtk-ok"/>
</form>
</field>

View File

@ -16,7 +16,7 @@
<label string="(Keep empty to open the current situation. Adjust HH:MM:SS to 00:00:00 to filter all resources of the day for the 'From' date and 23:59:59 for the 'To' date)" align="0.0" colspan="3"/>
<separator string="" colspan="4" />
<label string=""/>
<button special="cancel" string="Cancel" icon="gtk-cancel" />
<button special="cancel" string="_Cancel" icon="gtk-cancel" />
<button name="action_open_window" string="Open Product" type="object" icon="gtk-ok"/>
</form>
</field>

View File

@ -13,7 +13,7 @@
<newline/>
<separator string="" colspan="4" />
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
string="_Cancel" />
<button name="track_lines" string="Ok"
type="object" icon="gtk-ok" />
</form>

View File

@ -47,7 +47,9 @@ class stock_partial_move(osv.osv_memory):
self._columns['move%s_product_qty'%(m.id)] = fields.float("Quantity")
if 'move%s_product_uom'%(m.id) not in self._columns:
self._columns['move%s_product_uom'%(m.id)] = fields.many2one('product.uom',string="Product UOM")
if 'move%s_prodlot_id'%(m.id) not in self._columns:
self._columns['move%s_prodlot_id'%(m.id)] = fields.many2one('stock.production.lot', string="Lot")
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
if 'move%s_product_price'%(m.id) not in self._columns:
self._columns['move%s_product_price'%(m.id)] = fields.float("Price")
@ -89,7 +91,12 @@ class stock_partial_move(osv.osv_memory):
'relation': 'product.uom',
'required' : True,
'readonly' : True,
}
},
'move%s_prodlot_id'%(m.id): {
'string': _('Production Lot'),
'type': 'many2one',
'relation': 'stock.production.lot',
}
})
_moves_arch_lst += """
@ -97,7 +104,8 @@ class stock_partial_move(osv.osv_memory):
<field name="move%s_product_id" nolabel="1"/>
<field name="move%s_product_qty" string="Qty" />
<field name="move%s_product_uom" nolabel="1" />
"""%(m.id, m.id, m.id)
<field name="move%s_prodlot_id" domain="[('product_id','=',move%s_product_id)]" groups="base.group_extended" />
"""%(m.id, m.id, m.id,m.id,m.id)
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):
_moves_fields.update({
'move%s_product_price'%(m.id) : {
@ -162,29 +170,11 @@ class stock_partial_move(osv.osv_memory):
res['move%s_product_qty'%(m.id)] = m.product_qty
if 'move%s_product_uom'%(m.id) in fields:
res['move%s_product_uom'%(m.id)] = m.product_uom.id
if (m.picking_id.type == 'out') and (m.product_id.cost_method == 'average') and 'sale_id' in m.picking_id._columns.keys():
price = 0
if hasattr(m, 'sale_line_id') and m.sale_line_id:
price = m.sale_line_id.price_unit
if 'move%s_prodlot_id'%(m.id) in fields:
res['move%s_prodlot_id'%(m.id)] = m.prodlot_id.id
if m.product_id.cost_method == 'average' :
price = m.product_id.standard_price
currency = False
if hasattr(m.picking_id, 'sale_id') and m.picking_id.sale_id:
currency = m.picking_id.sale_id.pricelist_id.currency_id.id
if 'move%s_product_price'%(m.id) in fields:
res['move%s_product_price'%(m.id)] = price
if 'move%s_product_currency'%(m.id) in fields:
res['move%s_product_currency'%(m.id)] = currency
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average') and 'purchase_id' in m.picking_id._columns.keys():
price = 0
if hasattr(m, 'purchase_line_id') and m.purchase_line_id:
price = m.purchase_line_id.price_unit
currency = False
if hasattr(m.picking_id, 'purchase_id') and m.picking_id.purchase_id:
currency = m.picking_id.purchase_id.pricelist_id.currency_id.id
if 'move%s_product_price'%(m.id) in fields:
res['move%s_product_price'%(m.id)] = price
if 'move%s_product_currency'%(m.id) in fields:
@ -213,7 +203,8 @@ class stock_partial_move(osv.osv_memory):
partial_datas['move%s'%(m.id)] = {
'product_id' : getattr(partial, 'move%s_product_id'%(m.id)).id,
'product_qty' : getattr(partial, 'move%s_product_qty'%(m.id)),
'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id
'product_uom' : getattr(partial, 'move%s_product_uom'%(m.id)).id,
'prodlot_id' : getattr(partial, 'move%s_prodlot_id'%(m.id)).id
}
if (m.picking_id.type == 'in') and (m.product_id.cost_method == 'average'):

View File

@ -97,7 +97,6 @@ class stock_partial_picking(osv.osv_memory):
'string': _('Production Lot'),
'type': 'many2one',
'relation': 'stock.production.lot',
'readonly': True,
}
})
@ -106,8 +105,8 @@ class stock_partial_picking(osv.osv_memory):
<field name="move%s_product_id" nolabel="1"/>
<field name="move%s_product_qty" string="Qty" />
<field name="move%s_product_uom" nolabel="1" />
<field name="move%s_prodlot_id" />
"""%(m.id, m.id, m.id, m.id)
<field name="move%s_prodlot_id" domain="[('product_id','=',move%s_product_id)]" groups="base.group_extended" />
"""%(m.id, m.id, m.id, m.id,m.id)
if (m.product_id.cost_method == 'average'):
_moves_fields.update({
'move%s_product_price'%(m.id) : {
@ -171,20 +170,9 @@ class stock_partial_picking(osv.osv_memory):
res['move%s_product_uom'%(m.id)] = m.product_uom.id
if 'move%s_prodlot_id'%(m.id) in fields:
res['move%s_prodlot_id'%(m.id)] = m.prodlot_id.id
if (m.product_id.cost_method == 'average'):
currency = False
price = 0
if (pick.type == 'in') and 'purchase_id' in pick._columns.keys():
if hasattr(m, 'purchase_line_id') and m.purchase_line_id:
price = m.purchase_line_id.price_unit
if hasattr(pick, 'purchase_id') and pick.purchase_id:
currency = pick.purchase_id.pricelist_id.currency_id.id
if (pick.type == 'out') and 'sale_id' in pick._columns.keys():
if hasattr(m, 'sale_line_id') and m.sale_line_id:
price = m.sale_line_id.price_unit
if hasattr(pick, 'sale_id') and pick.sale_id:
currency = pick.sale_id.pricelist_id.currency_id.id
price = m.product_id.standard_price
if 'move%s_product_price'%(m.id) in fields:
res['move%s_product_price'%(m.id)] = price
if 'move%s_product_currency'%(m.id) in fields:

View File

@ -12,7 +12,7 @@
width="600" height="300"/>
<separator string="" colspan="4" />
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
string="_Cancel" />
<button name="make_packing" string="Ok"
type="object" icon="gtk-apply" />
</form>

View File

@ -9,7 +9,7 @@
<form string="Replace a component">
<label string="Component" colspan="4"/>
<separator string="" colspan="4" />
<button icon='gtk-cancel' special="cancel" string="Cancel" />
<button icon='gtk-cancel' special="cancel" string="_Cancel" />
<button name="replace_composant" string="Replace" type="object" />
</form>
</field>

View File

@ -65,18 +65,27 @@ class stock_return_picking(osv.osv_memory):
@return: New arch of view with new columns.
"""
res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context)
record_id = context and context.get('active_id', False) or False
record_id = context and context.get('active_id', False)
if record_id:
pick_obj = self.pool.get('stock.picking')
try:
pick = pick_obj.browse(cr, uid, record_id)
for m in [line for line in pick.move_lines]:
if 'return%s'%(m.id) not in self._columns:
self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True)
if 'invoice_state' not in self._columns:
self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be Invoiced'), ('none', 'None')], string='Invoice State', required=True)
except Exception:
return res
pick = pick_obj.browse(cr, uid, record_id)
if pick.state not in ['done','confirmed','assigned']:
raise osv.except_osv(_('Warning !'), _("You may only return pickings that are Confirmed, Available or Done!"))
return_history = {}
valid_lines = 0
for m in [line for line in pick.move_lines]:
if m.state == 'done':
return_history[m.id] = 0
for rec in m.move_history_ids2:
return_history[m.id] += (rec.product_qty * rec.product_uom.factor)
if m.product_qty * m.product_uom.factor > return_history[m.id]:
valid_lines += 1
if 'return%s'%(m.id) not in self._columns:
self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True)
if 'invoice_state' not in self._columns:
self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be Invoiced'), ('none', 'None')], string='Invoice State', required=True)
if not valid_lines:
raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!"))
return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
@ -97,36 +106,29 @@ class stock_return_picking(osv.osv_memory):
if record_id:
pick_obj = self.pool.get('stock.picking')
pick = pick_obj.browse(cr, uid, record_id)
if pick.state != 'done':
raise osv.except_osv(_('Warning !'), _("The Picking is not completed yet!\nYou cannot return picking which is not in 'Done' state!"))
return_history = {}
for m_line in pick.move_lines:
return_history[m_line.id] = 0
for rec in m_line.move_history_ids2:
return_history[m_line.id] += rec.product_qty
res['fields'].clear()
arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Provide the quantities of the returned products.')]
for m in [line for line in pick.move_lines]:
for m in pick.move_lines:
return_history[m.id] = 0
for rec in m.move_history_ids2:
return_history[m.id] += rec.product_qty
quantity = m.product_qty
if quantity > return_history[m.id] and (quantity - return_history[m.id])>0:
if m.state=='done' and quantity > return_history[m.id]:
arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,))
res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True}
res.setdefault('returns', []).append(m.id)
if not res.get('returns',False):
raise osv.except_osv(_('Warning!'),_('There is no product to return!'))
arch_lst.append('<field name="invoice_state"/>\n<newline/>')
res['fields']['invoice_state']={'string':_('Invoice state'), 'type':'selection','required':True, 'selection':[('2binvoiced', _('To Be Invoiced')), ('none', _('None'))]}
arch_lst.append('<group col="2" colspan="4">')
arch_lst.append('<button icon="gtk-cancel" special="cancel" string="Cancel" />')
arch_lst.append('<button name="action_open_window" string="Return" colspan="1" type="object" icon="gtk-apply" />')
arch_lst.append('<button name="create_returns" string="Return" colspan="1" type="object" icon="gtk-apply" />')
arch_lst.append('</group>')
arch_lst.append('</form>')
res['arch'] = '\n'.join(arch_lst)
return res
def _create_returns(self, cr, uid, ids, context):
def create_returns(self, cr, uid, ids, context):
"""
Creates return picking.
@param self: The object pointer.
@ -149,6 +151,7 @@ class stock_return_picking(osv.osv_memory):
move_ids = [m.id for m in [line for line in pick.move_lines]]
set_invoice_state_to_none = True
returned_lines = 0
for move in move_obj.browse(cr, uid, move_ids):
if not new_picking:
if pick.type=='out':
@ -161,57 +164,45 @@ class stock_return_picking(osv.osv_memory):
'move_lines':[], 'state':'draft', 'type':new_type,
'date':date_cur, 'invoice_state':data['invoice_state'],})
new_location=move.location_dest_id.id
if move.state=='done':
new_qty = data['return%s' % move.id]
returned_qty = move.product_qty
new_qty = data['return%s' % move.id]
returned_qty = move.product_qty
for rec in move.move_history_ids2:
returned_qty -= rec.product_qty
if returned_qty != new_qty:
set_invoice_state_to_none = False
new_move=move_obj.copy(cr, uid, move.id, {
'product_qty': new_qty,
'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id,
new_qty, move.product_uos.id),
'picking_id':new_picking, 'state':'draft',
'location_id':new_location, 'location_dest_id':move.location_id.id,
'date':date_cur, 'date_planned':date_cur,})
move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]})
for rec in move.move_history_ids2:
returned_qty -= rec.product_qty
if returned_qty != new_qty:
set_invoice_state_to_none = False
if new_qty:
returned_lines += 1
new_move=move_obj.copy(cr, uid, move.id, {
'product_qty': new_qty,
'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id,
new_qty, move.product_uos.id),
'picking_id':new_picking, 'state':'draft',
'location_id':new_location, 'location_dest_id':move.location_id.id,
'date':date_cur,})
move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]})
if not returned_lines:
raise osv.except_osv(_('Warning !'), _("Please specify at least one non-zero quantity!"))
if set_invoice_state_to_none:
pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'})
if new_picking:
if new_picking:
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
pick_obj.force_assign(cr, uid, [new_picking], context)
return new_picking
def action_open_window(self, cr, uid, ids, context):
"""
Opens return picking list.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of ids selected
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = self._create_returns(cr, uid, ids, context)
if not res:
return {}
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
pick_obj.force_assign(cr, uid, [new_picking], context)
return {
'domain': "[('id', 'in', ["+str(res)+"])]",
'domain': "[('id', 'in', ["+str(new_picking)+"])]",
'name': 'Picking List',
'view_type':'form',
'view_mode':'tree,form',
'res_model':'stock.picking',
'view_id':False,
'type':'ir.actions.act_window',
'context':context,
}
stock_return_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,13 +21,13 @@
from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
class stock_split_into(osv.osv_memory):
_name = "stock.split.into"
_description = "Split into"
_columns = {
'quantity': fields.float('Quantity', digits=(16,2)),
'quantity': fields.float('Quantity',digits_compute=dp.get_precision('Product UOM')),
}
_defaults = {
'quantity': lambda *x: 0,

View File

@ -10,7 +10,7 @@
<separator string="Quantity to leave in the current pack" colspan="4"/>
<field name="quantity"/>
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
string="_Cancel" />
<button name="split" string="Ok"
type="object" icon="gtk-ok" />
</form>

View File

@ -11,7 +11,7 @@
<separator string="UPS generator" colspan="4"/>
<field name="weight" />
<separator string="" colspan="4" />
<button icon='gtk-cancel' special="cancel" string="Cancel" />
<button icon='gtk-cancel' special="cancel" string="_Cancel" />
<button name="ups_save" string="Get xml file" type="object" />
<button name="ups_upload" string="Upload xml file" type="object" />
</form>

View File

@ -21,29 +21,70 @@
{
'name': 'Stock Location Paths',
'name': 'Warehouse Locations Paths',
'version': '1.0',
'category': 'Generic Modules/Inventory Control',
'description': """
Manages product's path in locations.
This module supplements the Warehouse application by adding support for per-product
location paths, effectively implementing Push and Pull inventory flows.
This module may be useful for different purposes:
* Manages the product in his whole manufacturing chain
* Manages different default locations by products
* Define paths within the warehouse to route products based on operations:
Typically this could be used to:
* Manage product manufacturing chains
* Manage default locations per product
* Define routes within your warehouse according to business needs, such as:
- Quality Control
- After Sales Services
- Supplier Return
* Manage products to be rent.
- Supplier Returns
* Help rental management, by generating automated return moves for rented products
Once this module is installed, an additional tab appear on the product form, where you can add
Push and Pull flow specifications. The demo data of CPU1 product for that push/pull :
Push flows
----------
Push flows are useful when the arrival of certain products in a given location should always
be followed by a corresponding move to another location, optionally after a certain delay.
The original Warehouse application already supports such Push flow specifications on the
Locations themselves, but these cannot be refined per-product.
A push flow specification indicates which location is chained with which location, and with
what parameters. As soon as a given quantity of products is moved in the source location,
a chained move is automatically foreseen according to the parameters set on the flow specification
(destination location, delay, type of move, journal, etc.) The new move can be automatically
processed, or require a manual confirmation, depending on the parameters.
Pull flows
----------
Pull flows are a bit different from Pull flows, in the sense that they are not related to
the processing of product moves, but rather to the processing of procurement orders.
What is being pulled is a need, not directly products.
A classical example of Push flow is when you have an Outlet company, with a parent Company
that is responsible for the supplies of the Outlet.
[ Customer ] <- A - [ Outlet ] <- B - [ Holding ] <~ C ~ [ Supplier ]
When a new procurement order (A, coming from the confirmation of a Sale Order for example) arrives
in the Outlet, it is converted into another procurement (B, via a Push flow of type 'move')
requested from the Holding. When procurement order B is processed by the Holding company, and
if the product is out of stock, it can be converted into a Purchase Order (C) from the Supplier
(Push flow of type Purchase). The result is that the procurement order, the need, is pushed
all the way between the Customer and Supplier.
Technically, Pull flows allow to process procurement orders differently, not only depending on
the product being considered, but also depending on which location holds the "need" for that
product (i.e. the destination location of that procurement order).
""",
'author': 'OpenERP SA',
'depends': ['procurement','stock'],
'init_xml': [],
'update_xml': ['stock_location_view.xml', 'security/ir.model.access.csv', 'mrp_pull_workflow.xml'],
'demo_xml': [],
'demo_xml': ['stock_location_demo.xml',],
'installable': True,
'test':[
'test/stock_location.yml'
'test':[''
'test/stock_location_pull_flow.yml',
'test/stock_location_push_flow.yml',
],
'active': False,
'certificate': '0046505115101',

View File

@ -18,13 +18,8 @@
#
##############################################################################
from osv import fields,osv
import tools
import ir
import pooler
from osv import osv
import netsvc
from mx import DateTime
import time
from tools.translate import _
class procurement_order(osv.osv):
@ -32,7 +27,6 @@ class procurement_order(osv.osv):
def check_buy(self, cr, uid, ids, context=None):
for procurement in self.browse(cr, uid, ids):
for line in procurement.product_id.flow_pull_ids:
if line.location_id==procurement.location_id:
return line.type_proc=='buy'
return super(procurement_order, self).check_buy(cr, uid, ids)
@ -56,7 +50,7 @@ class procurement_order(osv.osv):
def action_move_create(self, cr, uid, ids,context=None):
proc_obj = self.pool.get('procurement.order')
move_obj = self.pool.get('stock.move')
location_obj = self.pool.get('stock.location')
picking_obj=self.pool.get('stock.picking')
wf_service = netsvc.LocalService("workflow")
for proc in proc_obj.browse(cr, uid, ids, context=context):
line = None
@ -65,7 +59,7 @@ class procurement_order(osv.osv):
break
assert line, 'Line can not be False if we are on this state of the workflow'
origin = (proc.origin or proc.name or '').split(':')[0] +':'+line.name
picking_id = self.pool.get('stock.picking').create(cr, uid, {
picking_id =picking_obj.create(cr, uid, {
'origin': origin,
'company_id': line.company_id and line.company_id.id or False,
'type': line.picking_type,
@ -75,12 +69,12 @@ class procurement_order(osv.osv):
'note': line.name, # TODO: note on procurement ?
'invoice_state': line.invoice_state,
})
move_id = self.pool.get('stock.move').create(cr, uid, {
move_id =move_obj.create(cr, uid, {
'name': line.name,
'picking_id': picking_id,
'company_id': line.company_id and line.company_id.id or False,
'product_id': proc.product_id.id,
'date_planned': proc.date_planned,
'date': proc.date_planned,
'product_qty': proc.product_qty,
'product_uom': proc.product_uom.id,
'product_uos_qty': (proc.product_uos and proc.product_uos_qty)\
@ -97,10 +91,10 @@ class procurement_order(osv.osv):
'note': line.name, # TODO: same as above
})
if proc.move_id and proc.move_id.state in ('confirmed'):
self.pool.get('stock.move').write(cr,uid, [proc.move_id.id], {
move_obj.write(cr,uid, [proc.move_id.id], {
'state':'waiting'
}, context=context)
proc_id = self.pool.get('procurement.order').create(cr, uid, {
proc_id = proc_obj.create(cr, uid, {
'name': line.name,
'origin': origin,
'company_id': line.company_id and line.company_id.id or False,
@ -120,7 +114,7 @@ class procurement_order(osv.osv):
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
if proc.move_id:
self.pool.get('stock.move').write(cr, uid, [proc.move_id.id],
move_obj.write(cr, uid, [proc.move_id.id],
{'location_id':proc.location_id.id})
self.write(cr, uid, [proc.id], {'state':'running','message':_('Moved from other location')})

View File

@ -0,0 +1,89 @@
<?xml version="1.0" ?>
<openerp>
<data noupdate="1">
<record id="product.product_product_cpu1" model="product.product">
<field name="description">This product is configured with example of push/pull flows</field>
</record>
<record id="stock_location_input0" model="stock.location">
<field name="location_id" ref="stock.stock_location_company"/>
<field eval="0" name="scrap_location"/>
<field name="company_id" ref="base.main_company"/>
<field name="usage">internal</field>
<field name="chained_location_type">none</field>
<field name="name">Input</field>
<field name="chained_auto_packing">manual</field>
</record>
<record id="stock_location_qualitytest0" model="stock.location">
<field name="location_id" ref="stock.stock_location_company"/>
<field eval="0" name="scrap_location"/>
<field name="company_id" ref="base.main_company"/>
<field name="usage">internal</field>
<field name="chained_location_type">none</field>
<field name="name">Quality test</field>
<field name="chained_auto_packing">manual</field>
</record>
<record id="stock.warehouse0" model="stock.warehouse">
<field name="lot_input_id" ref="stock_location_input0"/>
</record>
<record id="stock_location_path_3" model="stock.location.path">
<field name="location_from_id" ref="stock.stock_location_suppliers"/>
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="auto">auto</field>
<field name="invoice_state">none</field>
<field eval="1" name="delay"/>
<field model="stock.location" name="location_dest_id" search="[('name', '=', u'Input')]"/>
<field name="picking_type">out</field>
</record>
<record id="stock_location_path_4" model="stock.location.path">
<field model="stock.location" name="location_from_id" search="[('name', '=', u'Input')]"/>
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="auto">auto</field>
<field name="invoice_state">none</field>
<field eval="1" name="delay"/>
<field model="stock.location" name="location_dest_id" search="[('name', '=', u'Quality test')]"/>
<field name="picking_type">out</field>
</record>
<record id="stock_location_path_5" model="stock.location.path">
<field model="stock.location" name="location_from_id" search="[('name', '=', u'Quality test')]"/>
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="auto">auto</field>
<field name="invoice_state">none</field>
<field eval="5" name="delay"/>
<field name="location_dest_id" ref="stock.stock_location_stock"/>
<field name="picking_type">out</field>
</record>
<record id="product_pulled_flow_l0" model="product.pulled.flow">
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="location_src_id" ref="stock.stock_location_stock"/>
<field name="location_id" ref="stock.stock_location_shop0"/>
<field name="partner_address_id" ref="base.main_address"/>
<field name="invoice_state">none</field>
<field name="company_id" ref="base.main_company"/>
<field name="type_proc">move</field>
<field eval="0" name="cancel_cascade"/>
<field name="procure_method">make_to_stock</field>
<field name="picking_type">internal</field>
<field name="name">L001</field>
</record>
<record id="product_pulled_flow_l1" model="product.pulled.flow">
<field name="product_id" ref="product.product_product_cpu1"/>
<field name="location_id" ref="stock.stock_location_suppliers"/>
<field name="invoice_state">none</field>
<field name="company_id" ref="base.main_company"/>
<field name="type_proc">buy</field>
<field eval="0" name="cancel_cascade"/>
<field name="procure_method">make_to_stock</field>
<field name="picking_type">out</field>
<field name="name">L002</field>
</record>
<record id="stock_warehouse_orderpoint_shop1_cpu1" model="stock.warehouse.orderpoint">
<field name="product_max_qty">10.0</field>
<field name="product_min_qty">20.0</field>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="warehouse_id" ref="stock.stock_warehouse_shop0"/>
<field name="location_id" ref="stock.stock_location_shop0"/>
<field model="product.product" name="product_id" ref="product.product_product_cpu1"/>
</record>
</data>
</openerp>

View File

@ -1,270 +0,0 @@
-
In order to test the stock location module, I will create product, locations, SO, warehouse.
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_asset0}:
close_method: balance
code: asset
name: Asset
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: income
name: Income
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: expense
name: Expense
sign: 1
-
Creating a account.account.type record
-
!record {model: account.account.type, id: account_account_type_receivable0}:
close_method: balance
code: receivable
name: Receivable
sign: 1
-
Creating a account.account record
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000'
company_id: base.main_company
currency_mode: current
name: Receivable
parent_left: 1
parent_right: 2
type: receivable
user_type: account_account_type_receivable0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_payable0}:
code: '440000'
company_id: base.main_company
currency_mode: current
name: Payable
parent_left: 3
parent_right: 4
type: payable
user_type: account_account_type_expense0
-
Creating a account.journal record
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: pur
company_id: base.main_company
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_bank_view
-
Creating a account.journal record
-
!record {model: account.journal, id: account_journal_salejouran0}:
code: sal
company_id: base.main_company
name: Sale Jouran
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
Creating a account.account record
-
!record {model: account.account, id: account_account_expenseaccount0}:
code: Expe
company_id: base.main_company
currency_mode: current
name: Expense Account
parent_left: 5
parent_right: 6
type: consolidation
user_type: account_account_type_asset0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_productsale0}:
code: '001'
company_id: base.main_company
currency_mode: current
name: Product Sale
type: other
user_type: account_account_type_income0
-
Creating a account.account record
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002'
company_id: base.main_company
currency_mode: current
name: Product Purchase
type: other
user_type: account_account_type_expense0
-
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_shawtrust0}:
address:
- country_id: base.in
- street: St James House, Vicar Lane, Sheffield
lang: en_US
name: 'Shaw Trust '
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
-
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_diasorinltd0}:
address:
- country_id: base.in
street: Ash House, Ash Road
name: DiaSorin Ltd
supplier: true
-
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
address:
- street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
supplier: true
-
Creating a res.partner.address record
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: res_partner_microlinktechnologies0
street: Ash House, Ash Road
title: base.res_partner_title_miss
-
Creating a product.category record
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
Creating a stock.location record
-
!record {model: stock.location, id: stock_location_suppiler0}:
chained_auto_packing: auto
chained_delay: 15
chained_location_type: none
company_id: base.main_company
name: Suppiler1
usage: supplier
-
Creating a product.product record
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: product_category_computer0
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: HP CD writers
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_shawtrust0
min_qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_productpurchase0
property_account_income: account_account_productsale0
path_ids:
- auto: auto
delay: 30
location_dest_id: stock.location_inventory
location_from_id: stock_location_suppiler0
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
-
Creating a stock.location record
-
!record {model: stock.location, id: stock_location_suppiler0}:
address_id: res_partner_address_0
chained_auto_packing: manual
chained_delay: 20
chained_location_type: none
company_id: base.main_company
name: Suppiler 1
usage: internal
-
I create warehouse.
-
!record {model: stock.warehouse, id: warehouse0}:
company_id: base.main_company
lot_input_id: stock.stock_location_stock
lot_output_id: stock_location_suppiler0
lot_stock_id: stock_location_suppiler0
name: OpenERP S.A.
partner_address_id: res_partner_address_0
-
I create Sale order for HP CD writers.
-
!record {model: sale.order, id: sale_order_01}:
date_order: '2010-04-20'
invoice_quantity: order
name: Test/location
order_line:
- name: HP CD writers
price_unit: 1000.0
product_uom: product.product_uom_unit
product_uom_qty: 5.0
state: draft
product_id: product_product_hpcdwriters0
type: make_to_order
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_01}
-
I check the delay mentioned in pushed flow in move.
-
!python {model: stock.move}: |
product_id=self.pool.get('product.product').search(cr,uid,[('name','=','HP CD writers')])
location_id=self.pool.get('stock.location').search(cr,uid,[('name','=','Inventory loss')])
move_ids =self.search(cr, uid, [('product_id','in',product_id),('location_dest_id','=',location_id)])
if move_ids:
move_obj=self.browse(cr,uid,move_ids)[0]
import time
from_dt = time.mktime(time.strptime(move_obj.date,'%Y-%m-%d %H:%M:%S'))
to_dt = time.mktime(time.strptime(move_obj.date_planned,'%Y-%m-%d %H:%M:%S'))
diff_day = (to_dt-from_dt)/(3600*24)
assert (round(diff_day)+1 ==30)

View File

@ -0,0 +1,226 @@
-
In order to test the product pulled flow , I create ,partner,product,procurement
-
I create a account type Asset.
-
!record {model: account.account.type, id: account_account_type_asset0}:
close_method: balance
code: asset
name: Asset
sign: 1
-
I create a account type income.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: income
name: Income
sign: 1
-
I create a account type Expense.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: expense
name: Expense
sign: 1
-
I create a account type Receivable.
-
!record {model: account.account.type, id: account_account_type_receivable0}:
close_method: balance
code: receivable
name: Receivable
sign: 1
-
I create a account Receivable.
-
!record {model: account.account, id: account_account_receivable0}:
code: '40000'
company_id: base.main_company
currency_mode: current
name: Receivable
parent_left: 1
parent_right: 2
type: receivable
user_type: account_account_type_receivable0
-
I create a account Payable.
-
!record {model: account.account, id: account_account_payable0}:
code: '440000'
company_id: base.main_company
currency_mode: current
name: Payable
parent_left: 3
parent_right: 4
type: payable
user_type: account_account_type_expense0
-
I create a Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: pur
company_id: base.main_company
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_bank_view
-
I create a Sale Journal.
-
!record {model: account.journal, id: account_journal_salejouran0}:
code: sal
company_id: base.main_company
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create a Sale Journal.
-
!record {model: account.account, id: account_account_expenseaccount0}:
code: Expe
company_id: base.main_company
currency_mode: current
name: Expense Account
parent_left: 5
parent_right: 6
type: consolidation
user_type: account_account_type_asset0
-
I create Product Sale account.
-
!record {model: account.account, id: account_account_productsale0}:
code: '001'
company_id: base.main_company
currency_mode: current
name: Product Sale
type: other
user_type: account_account_type_income0
-
I create Product Product Purchase.
-
!record {model: account.account, id: account_account_productpurchase0}:
code: '0002'
company_id: base.main_company
currency_mode: current
name: Product Purchase
type: other
user_type: account_account_type_expense0
-
I create Supplier.
-
!record {model: res.partner, id: res_partner_shawtrust0}:
address:
- country_id: base.in
- street: St James House, Vicar Lane, Sheffield
lang: en_US
name: 'Shaw Trust '
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
-
I create product category.
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create product and define the pulled flow condition for stock move.
I set shipping type Sending Goods. and set Procurement type move.
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: product_category_computer0
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: HP CD writers
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_shawtrust0
min_qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_productpurchase0
property_account_income: account_account_productsale0
flow_pull_ids:
- invoice_state: none
location_id: stock.stock_location_shop0
location_src_id: stock.stock_location_shop1
name: E001
partner_address_id: base.res_partner_address_2
picking_type: out
procure_method: make_to_stock
type_proc: move
- invoice_state: none
location_id: stock.stock_location_shop1
location_src_id: stock.stock_location_suppliers
name: E002
partner_address_id: base.res_partner_address_7
picking_type: out
procure_method: make_to_stock
type_proc: move
- invoice_state: none
location_id: stock.stock_location_suppliers
location_src_id: stock.stock_location_stock
name: E003
type_proc: buy
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
qty_available: 15
-
I create procurement order.
-
!record {model: procurement.order, id: procurement_order_test0}:
company_id: base.main_company
date_planned: '2010-10-07 18:24:24'
location_id: stock.stock_location_shop0
name: Testing pulled flow
priority: '1'
procure_method: make_to_order
product_id: product_product_hpcdwriters0
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos: product.product_uom_unit
product_uos_qty: 0.0
-
I confirm procurement order.
-
!workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test0}
-
I launch the scheduler to compute procurement.
-
!python {model: procurement.order.compute.all}: |
proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr,uid)
-
I check the state of procurement order is cancel and stock move is cancel.
-
!python {model: procurement.order }: |
from tools.translate import _
procurement_ids=self.search(cr, uid, [('id', '=', ref('procurement_order_test0'))])
if procurement_ids:
order=self.browse(cr,uid,procurement_ids)[0]
assert(order.state=='cancel')
-
I check the new of procurement order create .
-
!python {model: procurement.order }: |
from tools.translate import _
procurement_ids=self.search(cr, uid, [('name','=','E001')])
assert len(procurement_ids), "Procurement order hasn't Created."
-
I check the Outgoing Picking is create for source location Shop 2 and destination shop1.
-
!python {model: stock.picking }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Testing pulled flow:E001'),('type','=','out')])
assert len(picking_id), "Picking hasn't Created."

View File

@ -0,0 +1,134 @@
-
In order to test the product pushed flow , I create account ,partner,product,shipment
Push flow specification indicates which location is chained with which location.
-
I create product category.
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create Supplier.
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
address:
- street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
property_account_payable: account_account_payable0
property_account_receivable: account_account_receivable0
supplier: true
-
I create Supplier address.
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: res_partner_microlinktechnologies0
street: Ash House, Ash Road
title: base.res_partner_title_miss
-
I create product and define the pushed flow .
-
I set the chain location Supplier to stock Input
Stock Input to Quality test and Quality test -Stock .
-
!record {model: product.product, id: product_product_hpcdwriters0}:
categ_id: product_category_computer0
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: HP CD writers
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_microlinktechnologies0
min_qty: 5.0
path_ids:
- auto: auto
invoice_state: none
location_dest_id: stock_location.stock_location_input0
location_from_id: stock.stock_location_suppliers
- auto: auto
invoice_state: none
location_dest_id: stock_location.stock_location_qualitytest0
location_from_id: stock_location.stock_location_input0
- auto: auto
invoice_state: none
location_dest_id: stock.stock_location_stock
location_from_id: stock_location.stock_location_qualitytest0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
-
In order to test pushed flow .I buy the product from Micro Link Technologies supplier. I create a Picking.
-
!record {model: stock.picking , id: stock_picking_in0}:
address_id: res_partner_address_0
company_id: base.main_company
invoice_state: none
move_lines:
- date_expected: '2010-10-08 15:36:53'
location_dest_id: stock_location.stock_location_input0
location_id: stock.stock_location_suppliers
name: 'HP CD writers'
product_id: product_product_hpcdwriters0
product_qty: 6.0
product_uom: product.product_uom_unit
product_uos_qty: 6.0
name: Pushed Flow Test
type: in
-
I confirm picking.
-
!python {model: stock.picking }: |
self.draft_force_assign(cr, uid, [ref("stock_picking_in0")], {"lang": "en_US",
"search_default_available": 1, "tz": False, "active_model": "ir.ui.menu",
"contact_display": "partner_address", "active_ids": [ref("stock.menu_action_picking_tree4")],
"active_id": ref("stock.menu_action_picking_tree4"), })
-
I check that the outgoing order of the supplier is create with two move line.
Stock/Input To Quality test and Quality test To Stock.
-
I check the move is in waiting state.
-
!python {model: stock.picking }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
for move in pick.move_lines:
assert(move.state == 'waiting'), _('Stock is not in waiting state')
-
I receive the order of the supplier Micro Link Technologies from the Incoming Shipments menu.
-
!python {model: stock.picking }: |
import time
picking_id = self.search(cr, uid, [('address_id.partner_id','=',ref('res_partner_microlinktechnologies0')),('type','=','in')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, picking_id,partial_datas)
-
I check the Outgoing Orders is automatically done.
-
!python {model: stock.picking }: |
from tools.translate import _
picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
assert(pick.state == 'done'), _('Picking is not in done state')

View File

@ -691,7 +691,7 @@ class stock_planning(osv.osv):
'name': _('MPS(') + str(user.login) +') '+ obj.period_id.name,
'picking_id': picking_id,
'product_id': obj.product_id.id,
'date_planned': obj.period_id.date_start,
'date': obj.period_id.date_start,
'product_qty': uom_qty,
'product_uom': uom,
'product_uos_qty': uos_qty,