diff --git a/addons/stock/product.py b/addons/stock/product.py
index ca3d19f6878..c6b5500c38c 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -233,13 +233,13 @@ class product_product(osv.osv):
date_str = False
date_values = False
if from_date and to_date:
- date_str = "date_planned>=%s and date_planned<=%s"
+ date_str = "date>=%s and date<=%s"
date_values = [from_date, to_date]
elif from_date:
- date_str = "date_planned>=%s"
+ date_str = "date>=%s"
date_values = [from_date]
elif to_date:
- date_str = "date_planned<=%s"
+ date_str = "date<=%s"
date_values = [to_date]
where = [tuple(location_ids),tuple(location_ids),tuple(ids),tuple(states)]
diff --git a/addons/stock/report/product_stock.py b/addons/stock/report/product_stock.py
index e55405381b4..b7dd254234c 100644
--- a/addons/stock/report/product_stock.py
+++ b/addons/stock/report/product_stock.py
@@ -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:
diff --git a/addons/stock/report/report_stock_move.py b/addons/stock/report/report_stock_move.py
index 460e7a6d0ab..3e005c3a51a 100644
--- a/addons/stock/report/report_stock_move.py
+++ b/addons/stock/report/report_stock_move.py
@@ -28,7 +28,7 @@ class report_stock_move(osv.osv):
_description = "Moves Statistics"
_auto = False
_columns = {
- 'date_planned': fields.date('Date', 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'),
@@ -57,7 +57,7 @@ class report_stock_move(osv.osv):
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,
@@ -82,13 +82,13 @@ class report_stock_move(osv.osv):
CASE WHEN sp.type in ('in') THEN
sum(sm.product_qty) END AS in_qty,
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,
@@ -107,7 +107,7 @@ class report_stock_move(osv.osv):
left join stock_location sl on (sm.location_id = sl.id)
group by
- sm.id,sp.type, sm.date_planned,sm.address_id,
+ 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)
@@ -129,7 +129,7 @@ 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),
'location_id': fields.many2one('stock.location', 'Location', readonly=True),
@@ -147,7 +147,7 @@ class report_stock_inventory(osv.osv):
cr.execute("""
create or replace view report_stock_inventory as (
(select
- min(m.id) as id, m.date_planned as date_planned,
+ 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.company_id,
@@ -163,10 +163,10 @@ create or replace view report_stock_inventory as (
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
+ m.date, m.state, l.usage, m.company_id
) union all (
select
- -m.id as id, m.date_planned as date_planned,
+ -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.company_id,
@@ -182,7 +182,7 @@ create or replace view report_stock_inventory as (
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
+ m.prodlot_id, m.date, m.state, l.usage, m.company_id
)
);
""")
diff --git a/addons/stock/report/report_stock_move_view.xml b/addons/stock/report/report_stock_move_view.xml
index 2c8c1ad80e9..2ee9809f86d 100644
--- a/addons/stock/report/report_stock_move_view.xml
+++ b/addons/stock/report/report_stock_move_view.xml
@@ -13,7 +13,7 @@
tree
-
+
@@ -62,7 +62,7 @@
@@ -99,7 +99,7 @@
-
+
@@ -109,7 +109,7 @@
-
+
@@ -134,7 +134,7 @@
tree
-
+
@@ -182,7 +182,7 @@
-
+
@@ -197,7 +197,7 @@
-
+
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 4e6d6c81f18..6e23e89506d 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -554,12 +554,12 @@ class stock_picking(osv.osv):
ids = [ids]
for pick in self.browse(cr, uid, ids, context):
sql_str = """update stock_move set
- date_planned='%s'
+ date='%s'
where
picking_id=%d """ % (value, pick.id)
if pick.max_date:
- sql_str += " and (date_planned='" + pick.max_date + "' or date_planned>'" + value + "')"
+ sql_str += " and (date='" + pick.max_date + "' or date>'" + value + "')"
cr.execute(sql_str)
return True
@@ -576,11 +576,11 @@ class stock_picking(osv.osv):
ids = [ids]
for pick in self.browse(cr, uid, ids, context=context):
sql_str = """update stock_move set
- date_planned='%s'
+ date='%s'
where
picking_id=%s """ % (value, pick.id)
if pick.min_date:
- sql_str += " and (date_planned='" + pick.min_date + "' or date_planned<'" + value + "')"
+ sql_str += " and (date='" + pick.min_date + "' or date<'" + value + "')"
cr.execute(sql_str)
return True
@@ -595,8 +595,8 @@ class stock_picking(osv.osv):
return res
cr.execute("""select
picking_id,
- min(date_planned),
- max(date_planned)
+ min(date),
+ max(date)
from
stock_move
where
@@ -1457,9 +1457,8 @@ class stock_move(osv.osv):
_columns = {
'name': fields.char('Name', size=64, required=True, select=True),
'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'),
-
- 'date': fields.datetime('Creation Date', select=True),
- 'date_planned': fields.datetime('Date', required=True, help="Scheduled date for the movement of the products or real date if the move is done."),
+ 'create_date': fields.datetime('Creation Date', readonly=True),
+ 'date': fields.datetime('Date Planned', required=True, help="Scheduled date for the movement of the products or real date if the move is done."),
'date_expected': fields.datetime('Date Expected', readonly=True,required=True, help="Scheduled date for the movement of the products"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
@@ -1540,7 +1539,6 @@ class stock_move(osv.osv):
'priority': '1',
'product_qty': 1.0,
'scrapped' : False,
- 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S'),
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c),
'date_expected': time.strftime('%Y-%m-%d %H:%M:%S'),
@@ -1673,7 +1671,7 @@ class stock_move(osv.osv):
if dest:
if dest[1] == 'transparent':
self.write(cr, uid, [m.id], {
- 'date_planned': (datetime.strptime(m.date_planned, '%Y-%m-%d %H:%M:%S') + \
+ 'date': (datetime.strptime(m.date, '%Y-%m-%d %H:%M:%S') + \
relativedelta(days=dest[2] or 0)).strftime('%Y-%m-%d'),
'location_dest_id': dest[0].id})
else:
@@ -1734,7 +1732,7 @@ class stock_move(osv.osv):
'state': 'waiting',
'company_id': company_id or res_obj._company_default_get(cr, uid, 'stock.company', context=context) ,
'move_history_ids': [],
- 'date_planned': (datetime.strptime(move.date_planned, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'),
+ 'date': (datetime.strptime(move.date, '%Y-%m-%d %H:%M:%S') + relativedelta(days=delay or 0)).strftime('%Y-%m-%d'),
'move_history_ids2': []}
)
move_obj.write(cr, uid, [move.id], {
@@ -1996,7 +1994,7 @@ class stock_move(osv.osv):
self._create_product_valuation_moves(cr, uid, move, context=context)
- self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')})
+ self.write(cr, uid, ids, {'state': 'done', 'date': time.strftime('%Y-%m-%d %H:%M:%S')})
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'stock.move', id, cr)
@@ -2426,7 +2424,7 @@ class stock_inventory(osv.osv):
'product_uom': line.product_uom.id,
'prodlot_id': lot_id,
'date': inv.date,
- 'date_planned': inv.date,
+ 'date': inv.date,
'state': 'done'
}
if change > 0:
@@ -2591,21 +2589,21 @@ class report_products_to_received_planned(osv.osv):
tools.drop_view_if_exists(cr, 'report_products_to_received_planned')
cr.execute("""
create or replace view report_products_to_received_planned as (
- select stock.date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty
+ select stock.create_date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty
from stock_picking picking
inner join stock_move stock
on picking.id = stock.picking_id and picking.type = 'in'
- where stock.date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7)
- group by stock.date
+ where stock.create_date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7)
+ group by stock.create_date
union
- select stock.date_planned, min(stock.id) as id, 0 as actual_qty, sum(stock.product_qty) as planned_qty
+ select stock.date, min(stock.id) as id, 0 as actual_qty, sum(stock.product_qty) as planned_qty
from stock_picking picking
inner join stock_move stock
on picking.id = stock.picking_id and picking.type = 'in'
- where stock.date_planned between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7)
- group by stock.date_planned
+ where stock.date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7)
+ group by stock.date
)
""")
@@ -2626,21 +2624,21 @@ class report_delivery_products_planned(osv.osv):
tools.drop_view_if_exists(cr, 'report_delivery_products_planned')
cr.execute("""
create or replace view report_delivery_products_planned as (
- select stock.date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty
+ select stock.create_date, min(stock.id) as id, sum(stock.product_qty) as qty, 0 as planned_qty
from stock_picking picking
inner join stock_move stock
on picking.id = stock.picking_id and picking.type = 'out'
- where stock.date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7)
- group by stock.date
+ where stock.create_date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7)
+ group by stock.create_date
union
- select stock.date_planned, min(stock.id), 0 as actual_qty, sum(stock.product_qty) as planned_qty
+ select stock.date, min(stock.id), 0 as actual_qty, sum(stock.product_qty) as planned_qty
from stock_picking picking
inner join stock_move stock
on picking.id = stock.picking_id and picking.type = 'out'
- where stock.date_planned between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7)
- group by stock.date_planned
+ where stock.date between (select cast(date_trunc('week', current_date) as date)) and (select cast(date_trunc('week', current_date) as date) + 7)
+ group by stock.date
)
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index b1cd4f20baf..d8bebd97fce 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -390,8 +390,8 @@
-
-
+
+
@@ -415,8 +415,8 @@
-
-
+
+
@@ -683,7 +683,7 @@
states="draft,assigned,confirmed,done"/>
-
+
@@ -711,8 +711,8 @@
-
-
+
+
@@ -868,7 +868,7 @@
groups="base.group_extended"/>
-
+
@@ -896,8 +896,8 @@
-
-
+
+
@@ -1083,7 +1083,7 @@
groups="base.group_extended"
states="draft,assigned,confirmed,done"/>
-
+
@@ -1112,8 +1112,8 @@
-
-
+
+
@@ -1323,8 +1323,8 @@
-
-
+
+
@@ -1497,10 +1497,10 @@
tree
-
+
-
+
@@ -1528,7 +1528,7 @@
states="draft,assigned,confirmed,done"/>
-
+
@@ -1570,8 +1570,8 @@
+
-
@@ -1613,7 +1613,7 @@
-
+
@@ -1622,7 +1622,7 @@
-
+
@@ -1636,8 +1636,8 @@
-
-
+
+
@@ -1699,7 +1699,7 @@
groups="base.group_extended"
icon="terp-stock_effects-object-colorize"
states="draft,assigned,confirmed,done"/>
-
+
@@ -1740,8 +1740,8 @@
+
-
@@ -1783,7 +1783,7 @@
-
+
@@ -1800,7 +1800,7 @@
-
+
diff --git a/addons/stock/test/stock_test.yml b/addons/stock/test/stock_test.yml
index 442cc8735b9..77b398a94bb 100644
--- a/addons/stock/test/stock_test.yml
+++ b/addons/stock/test/stock_test.yml
@@ -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
diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py
index fc49abb62a1..662772faf96 100644
--- a/addons/stock/wizard/stock_return_picking.py
+++ b/addons/stock/wizard/stock_return_picking.py
@@ -177,7 +177,7 @@ class stock_return_picking(osv.osv_memory):
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,})
+ 'date':date_cur, 'date':date_cur,})
move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]})
if set_invoice_state_to_none: