diff --git a/addons/delivery/__init__.py b/addons/delivery/__init__.py
index d277419434a..35705c10cb6 100644
--- a/addons/delivery/__init__.py
+++ b/addons/delivery/__init__.py
@@ -21,7 +21,6 @@
import delivery
import partner
-import report
import sale
import stock
diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py
index 1ee6bf413ec..ab00fa9087e 100644
--- a/addons/delivery/__openerp__.py
+++ b/addons/delivery/__openerp__.py
@@ -35,10 +35,10 @@ invoices from picking, OpenERP is able to add and compute the shipping line.
'depends': ['sale_stock'],
'data': [
'security/ir.model.access.csv',
- 'delivery_report.xml',
'delivery_view.xml',
'partner_view.xml',
- 'delivery_data.xml'
+ 'delivery_data.xml',
+ 'views/report_shipping.xml',
],
'demo': ['delivery_demo.xml'],
'test': ['test/delivery_cost.yml'],
diff --git a/addons/delivery/delivery_report.xml b/addons/delivery/delivery_report.xml
deleted file mode 100644
index 3cebbba4eac..00000000000
--- a/addons/delivery/delivery_report.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml
index 055ca985494..6df6cec3ef0 100644
--- a/addons/delivery/delivery_view.xml
+++ b/addons/delivery/delivery_view.xml
@@ -225,10 +225,6 @@
stock.picking
-
-
-
-
diff --git a/addons/delivery/report/__init__.py b/addons/delivery/report/__init__.py
deleted file mode 100644
index 085fa3a3cdc..00000000000
--- a/addons/delivery/report/__init__.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import shipping
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/delivery/report/shipping.py b/addons/delivery/report/shipping.py
deleted file mode 100644
index 6f313c14b11..00000000000
--- a/addons/delivery/report/shipping.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-
-from openerp.report import report_sxw
-
-class shipping(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(shipping, self).__init__(cr, uid, name, context=context)
- self.localcontext.update({
- 'time': time,
- 'get_partner_invoice_info': self.get_partner_invoice_info,
- })
-
- def get_partner_invoice_info(self, origin):
- """This method is used to get information of invoiced partner.
- :param: origin: origin of picking
- :return: tuple contaning partner name and address of invoiced partner
- """
- sale_obj = self.pool.get('sale.order')
- sale_id = sale_obj.search(self.cr, self.uid, [('name', '=', origin)])[0]
- partner_invoice_id = sale_obj.browse(self.cr, self.uid, sale_id).partner_invoice_id
- return partner_invoice_id.name, self.pool.get('res.partner')._display_address(self.cr, self.uid, partner_invoice_id)
-
-report_sxw.report_sxw('report.sale.shipping','stock.picking','addons/delivery/report/shipping.rml',parser=shipping)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/delivery/report/shipping.rml b/addons/delivery/report/shipping.rml
deleted file mode 100644
index d9d90c1b3bd..00000000000
--- a/addons/delivery/report/shipping.rml
+++ /dev/null
@@ -1,212 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Description
-
-
- Quantity
-
-
-
-
- [[repeatIn(objects,'o')]]
-
-
-
-
-
-
-
- Invoiced to
- [[ o.origin and get_partner_invoice_info(o.origin)[0] or '' ]]
- [[ o.origin and get_partner_invoice_info(o.origin)[1] or '' ]]
-
-
- [[ o.partner_id and o.partner_id.name or '' ]]
- [[ o.partner_id and display_address(o.partner_id) ]]
-
-
-
- Delivery Order : [[ o.name ]]
-
-
-
-
-
-
- Order Ref.
-
-
- Order Date
-
-
- Shipping Date
-
-
- Carrier
-
-
- Weight
-
-
-
-
-
-
- [[ o.origin or '' ]]
-
-
- [[ formatLang(o.date,date_time=True) ]]
-
-
- [[ formatLang(o.min_date,date_time = True) ]]
-
-
- [[ o.carrier_id and o.carrier_id.name or '' ]]
-
-
- [[ formatLang(o.weight) ]]
-
-
-
-
-
-
-
-
-
- Description
-
-
- Quantity
-
-
-
-
- [[repeatIn(o.move_lines,'line')]]
-
-
-
- [[line.product_id.code ]] [[ line.product_id and line.product_id.name or '']]
-
-
- [[ formatLang(line.product_qty) ]] [[ line.product_uom and line.product_uom.name ]]
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/delivery/test/delivery_cost.yml b/addons/delivery/test/delivery_cost.yml
index 9d1c352cef9..efa22ca5df7 100644
--- a/addons/delivery/test/delivery_cost.yml
+++ b/addons/delivery/test/delivery_cost.yml
@@ -46,19 +46,6 @@
wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
{'active_ids': ship_ids, 'active_model': 'stock.picking'})
self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]})
--
- I print a Delivery Order report.
--
- !python {model: stock.picking}: |
- import os
- import openerp.report
- from openerp import tools
- sale = self.pool.get('sale.order')
- sale_order = sale.browse(cr, uid, ref("sale_normal_delivery_charges"))
- ship_ids = [x.id for x in sale_order.picking_ids]
- data, format = openerp.report.render_report(cr, uid, ship_ids, 'sale.shipping', {}, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'delivery-shipping'+format), 'wb+').write(data)
-
Create one more sale order with Free Delivery Charges
-
diff --git a/addons/delivery/views/report_shipping.xml b/addons/delivery/views/report_shipping.xml
new file mode 100644
index 00000000000..042ec4f85ac
--- /dev/null
+++ b/addons/delivery/views/report_shipping.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+ Will be invoiced to:
+
+
+
+
+
Carrier
+
Weight
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/hw_escpos/controllers/main.py b/addons/hw_escpos/controllers/main.py
index 9e5656ef986..37c2928179c 100644
--- a/addons/hw_escpos/controllers/main.py
+++ b/addons/hw_escpos/controllers/main.py
@@ -210,8 +210,6 @@ class EscposDriver(Thread):
eprint.text(receipt['company']['name'] + '\n')
eprint.set(align='center',type='b')
- if check(receipt['shop']['name']):
- eprint.text(receipt['shop']['name'] + '\n')
if check(receipt['company']['contact_address']):
eprint.text(receipt['company']['contact_address'] + '\n')
if check(receipt['company']['phone']):
diff --git a/addons/mrp/test/order_process.yml b/addons/mrp/test/order_process.yml
index 9847e5732f3..e0383a10ae6 100644
--- a/addons/mrp/test/order_process.yml
+++ b/addons/mrp/test/order_process.yml
@@ -92,7 +92,7 @@
assert proc.location_id.id == order.location_src_id.id, "Input location and procurement location do not correspond"
assert proc.product_uom.id == order_line.product_uom.id, "UOM does not correspond in procurement."
assert proc.product_uos_qty == order_line.product_uos and order_line.product_uos_qty or order_line.product_qty, "UOS qty does not correspond in procurement."
- # procurement state should be `confirmed` at this stage, except if mrp_jit is installed, in which
+ # procurement state should be `confirmed` at this stage, except if procurement_jit is installed, in which
# case it could already be in `running` or `exception` state (not enough stock)
expected_states = ('confirmed', 'running', 'exception')
assert proc.state in expected_states, 'Procurement state is `%s` for %s, expected one of %s' % \
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index a78c7d2320e..d089fd2e834 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -61,8 +61,8 @@ class pos_config(osv.osv):
'journal_ids' : fields.many2many('account.journal', 'pos_config_journal_rel',
'pos_config_id', 'journal_id', 'Available Payment Methods',
domain="[('journal_user', '=', True ), ('type', 'in', ['bank', 'cash'])]",),
- 'warehouse_id' : fields.many2one('stock.warehouse', 'Warehouse',
- required=True),
+ 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type'),
+ 'stock_location_id': fields.many2one('stock.location', 'Stock Location', domain=[('usage', '=', 'internal')], required=True),
'journal_id' : fields.many2one('account.journal', 'Sale Journal',
domain=[('type', '=', 'sale')],
help="Accounting journal used to post sales entries."),
@@ -87,7 +87,8 @@ class pos_config(osv.osv):
"to customize the reference numbers of your orders."),
'session_ids': fields.one2many('pos.session', 'config_id', 'Sessions'),
'group_by' : fields.boolean('Group Journal Items', help="Check this if you want to group the Journal Items by Product while closing a Session"),
- 'pricelist_id': fields.many2one('product.pricelist','Pricelist', required=True)
+ 'pricelist_id': fields.many2one('product.pricelist','Pricelist', required=True),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
}
def _check_cash_control(self, cr, uid, ids, context=None):
@@ -131,24 +132,39 @@ class pos_config(osv.osv):
res = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', company_id)], limit=1, context=context)
return res and res[0] or False
- def _default_warehouse(self, cr, uid, context=None):
- user = self.pool.get('res.users').browse(cr, uid, uid, context)
- res = self.pool.get('stock.warehouse').search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context)
- return res and res[0] or False
-
def _default_pricelist(self, cr, uid, context=None):
res = self.pool.get('product.pricelist').search(cr, uid, [('type', '=', 'sale')], limit=1, context=context)
return res and res[0] or False
+ def _get_default_location(self, cr, uid, context=None):
+ wh_obj = self.pool.get('stock.warehouse')
+ user = self.pool.get('res.users').browse(cr, uid, uid, context)
+ res = wh_obj.search(cr, uid, [('company_id', '=', user.company_id.id)], limit=1, context=context)
+ if res and res[0]:
+ return wh_obj.browse(cr, uid, res[0], context=context).lot_stock_id.id
+ return False
+
+ def _get_default_company(self, cr, uid, context=None):
+ company_id = self.pool.get('res.users')._get_company(cr, uid, context=context)
+ return company_id
+
_defaults = {
'state' : POS_CONFIG_STATE[0][0],
- 'warehouse_id': _default_warehouse,
'journal_id': _default_sale_journal,
'group_by' : True,
'pricelist_id': _default_pricelist,
'iface_invoicing': True,
+ 'stock_location_id': _get_default_location,
+ 'company_id': _get_default_company,
}
+ def onchange_picking_type_id(self, cr, uid, ids, picking_type_id, context=None):
+ p_type_obj = self.pool.get("stock.picking.type")
+ p_type = p_type_obj.browse(cr, uid, picking_type_id, context=context)
+ if p_type.default_location_src_id and p_type.default_location_src_id.usage == 'internal' and p_type.default_location_dest_id and p_type.default_location_dest_id.usage == 'customer':
+ return {'value': {'stock_location_id': p_type.default_location_src_id.id}}
+ return False
+
def set_active(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state' : 'active'}, context=context)
@@ -334,7 +350,7 @@ class pos_session(osv.osv):
# the .xml files as the CoA is not yet installed.
jobj = self.pool.get('pos.config')
pos_config = jobj.browse(cr, uid, config_id, context=context)
- context.update({'company_id': pos_config.warehouse_id.company_id.id})
+ context.update({'company_id': pos_config.company_id.id})
if not pos_config.journal_id:
jid = jobj.default_get(cr, uid, ['journal_id'], context=context)['journal_id']
if jid:
@@ -361,7 +377,7 @@ class pos_session(osv.osv):
bank_values = {
'journal_id' : journal.id,
'user_id' : uid,
- 'company_id' : pos_config.warehouse_id.company_id.id
+ 'company_id' : pos_config.company_id.id
}
statement_id = self.pool.get('account.bank.statement').create(cr, uid, bank_values, context=context)
bank_statement_ids.append(statement_id)
@@ -642,7 +658,6 @@ class pos_order(osv.osv):
_columns = {
'name': fields.char('Order Ref', size=64, required=True, readonly=True),
'company_id':fields.many2one('res.company', 'Company', required=True, readonly=True),
- 'warehouse_id': fields.related('session_id', 'config_id', 'warehouse_id', relation='stock.warehouse', type='many2one', string='Warehouse', store=True, readonly=True),
'date_order': fields.datetime('Order Date', readonly=True, select=True),
'user_id': fields.many2one('res.users', 'Salesman', help="Person who uses the the cash register. It can be a reliever, a student or an interim employee."),
'amount_tax': fields.function(_amount_all, string='Taxes', digits_compute=dp.get_precision('Account'), multi='all'),
@@ -671,7 +686,8 @@ class pos_order(osv.osv):
'invoice_id': fields.many2one('account.invoice', 'Invoice'),
'account_move': fields.many2one('account.move', 'Journal Entry', readonly=True),
'picking_id': fields.many2one('stock.picking', 'Picking', readonly=True),
- 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True),
+ 'picking_type_id': fields.related('session_id', 'config_id', 'picking_type_id', string="Picking Type", type='many2one', relation='stock.picking.type'),
+ 'location_id': fields.related('session_id', 'config_id', 'stock_location_id', string="Location", type='many2one', store=True, relation='stock.location'),
'note': fields.text('Internal Notes'),
'nb_print': fields.integer('Number of Print', readonly=True),
'pos_reference': fields.char('Receipt Ref', size=64, readonly=True),
@@ -706,7 +722,6 @@ class pos_order(osv.osv):
'session_id': _default_session,
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
'pricelist_id': _default_pricelist,
- 'picking_type_id': _get_out_picking_type,
}
def create(self, cr, uid, values, context=None):
@@ -736,43 +751,55 @@ class pos_order(osv.osv):
continue
addr = order.partner_id and partner_obj.address_get(cr, uid, [order.partner_id.id], ['delivery']) or {}
picking_type = order.picking_type_id
- picking_id = picking_obj.create(cr, uid, {
- 'origin': order.name,
- 'partner_id': addr.get('delivery',False),
- 'picking_type_id': picking_type.id,
- 'company_id': order.company_id.id,
- 'move_type': 'direct',
- 'note': order.note or "",
- 'invoice_state': 'none',
- }, context=context)
- self.write(cr, uid, [order.id], {'picking_id': picking_id}, context=context)
- location_id = picking_type.default_location_src_id.id
+ picking_id = False
+ if picking_type:
+ picking_id = picking_obj.create(cr, uid, {
+ 'origin': order.name,
+ 'partner_id': addr.get('delivery',False),
+ 'picking_type_id': picking_type.id,
+ 'company_id': order.company_id.id,
+ 'move_type': 'direct',
+ 'note': order.note or "",
+ 'invoice_state': 'none',
+ }, context=context)
+ self.write(cr, uid, [order.id], {'picking_id': picking_id}, context=context)
+ location_id = order.location_id.id
if order.partner_id:
destination_id = order.partner_id.property_stock_customer.id
- else:
+ elif picking_type:
+ if not picking_type.default_location_dest_id:
+ raise osv.except_osv(_('Error!'), _('Missing source or destination location for picking type %s. Please configure those fields and try again.' % (picking_type.name,)))
destination_id = picking_type.default_location_dest_id.id
- if not location_id or not destination_id:
- raise osv.except_osv(_('Error!'), _('Missing source or destination location for picking type %s. Please configure those fields and try again.' % (picking_type.name,)))
+ else:
+ destination_id = partner_obj.default_get(cr, uid, ['property_stock_customer'], context=context)['property_stock_customer']
+ move_list = []
for line in order.lines:
if line.product_id and line.product_id.type == 'service':
continue
- move_obj.create(cr, uid, {
+ move_list.append(move_obj.create(cr, uid, {
'name': line.name,
'product_uom': line.product_id.uom_id.id,
'product_uos': line.product_id.uom_id.id,
'picking_id': picking_id,
+ 'picking_type_id': picking_type.id,
'product_id': line.product_id.id,
'product_uos_qty': abs(line.qty),
'product_uom_qty': abs(line.qty),
'state': 'draft',
'location_id': location_id if line.qty >= 0 else destination_id,
'location_dest_id': destination_id if line.qty >= 0 else location_id,
- }, context=context)
- picking_obj.action_confirm(cr, uid, [picking_id], context=context)
- picking_obj.force_assign(cr, uid, [picking_id], context=context)
- picking_obj.action_done(cr, uid, [picking_id], context=context)
+ }, context=context))
+
+ if picking_id:
+ picking_obj.action_confirm(cr, uid, [picking_id], context=context)
+ picking_obj.force_assign(cr, uid, [picking_id], context=context)
+ picking_obj.action_done(cr, uid, [picking_id], context=context)
+ elif move_list:
+ move_obj.action_confirm(cr, uid, move_list, context=context)
+ move_obj.force_assign(cr, uid, move_list, context=context)
+ move_obj.action_done(cr, uid, move_list, context=context)
return True
def cancel_order(self, cr, uid, ids, context=None):
diff --git a/addons/point_of_sale/point_of_sale_data.xml b/addons/point_of_sale/point_of_sale_data.xml
index f5ad5931cad..106075ba3b2 100644
--- a/addons/point_of_sale/point_of_sale_data.xml
+++ b/addons/point_of_sale/point_of_sale_data.xml
@@ -31,6 +31,7 @@
Main
+
diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml
index 14963af5def..9a076d2922c 100644
--- a/addons/point_of_sale/point_of_sale_view.xml
+++ b/addons/point_of_sale/point_of_sale_view.xml
@@ -80,7 +80,7 @@
-
+
@@ -591,7 +591,9 @@
-
+
+
@@ -639,7 +641,7 @@
-
+
@@ -653,7 +655,7 @@
-
+
diff --git a/addons/point_of_sale/report/pos_order_report.py b/addons/point_of_sale/report/pos_order_report.py
index 5489ccf7099..efc46dfe9ce 100644
--- a/addons/point_of_sale/report/pos_order_report.py
+++ b/addons/point_of_sale/report/pos_order_report.py
@@ -36,7 +36,7 @@ class pos_order_report(osv.osv):
'price_total':fields.float('Total Price', readonly=True),
'total_discount':fields.float('Total Discount', readonly=True),
'average_price': fields.float('Average Price', readonly=True,group_operator="avg"),
- 'warehouse_id':fields.many2one('stock.warehouse', 'Warehouse', readonly=True),
+ 'location_id':fields.many2one('stock.location', 'Location', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
'nbr':fields.integer('# of Lines', readonly=True),
'product_qty':fields.integer('# of Qty', readonly=True),
@@ -61,7 +61,7 @@ class pos_order_report(osv.osv):
s.partner_id as partner_id,
s.state as state,
s.user_id as user_id,
- s.warehouse_id as warehouse_id,
+ s.location_id as location_id,
s.company_id as company_id,
s.sale_journal as journal_id,
l.product_id as product_id
@@ -71,7 +71,7 @@ class pos_order_report(osv.osv):
left join product_uom u on (u.id=pt.uom_id)
group by
s.date_order, s.partner_id,s.state,
- s.user_id,s.warehouse_id,s.company_id,s.sale_journal,l.product_id,s.create_date
+ s.user_id,s.location_id,s.company_id,s.sale_journal,l.product_id,s.create_date
having
sum(l.qty * u.factor) != 0)""")
diff --git a/addons/point_of_sale/report/pos_order_report_view.xml b/addons/point_of_sale/report/pos_order_report_view.xml
index a34bab9c559..5cef1f92cbf 100644
--- a/addons/point_of_sale/report/pos_order_report_view.xml
+++ b/addons/point_of_sale/report/pos_order_report_view.xml
@@ -36,6 +36,7 @@
+
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 8de82b4dc0a..16f9f7476b3 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -34,7 +34,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
this.company_logo = null;
this.company_logo_base64 = '';
this.currency = null;
- this.shop = null;
this.company = null;
this.user = null;
this.users = [];
@@ -174,7 +173,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
return self.fetch(
'pos.config',
- ['name','journal_ids','warehouse_id','journal_id','pricelist_id',
+ ['name','journal_ids','journal_id','pricelist_id',
'iface_self_checkout', 'iface_led', 'iface_cashdrawer',
'iface_payment_terminal', 'iface_electronic_scale', 'iface_barscan',
'iface_vkeyboard','iface_print_via_proxy','iface_scan_via_proxy',
@@ -191,10 +190,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
self.config.iface_scan_via_proxy ||
self.config.iface_cashdrawer;
- return self.fetch('stock.warehouse',[],[['id','=', self.config.warehouse_id[0]]]);
- }).then(function(shops){
- self.shop = shops[0];
-
return self.fetch('product.pricelist',['currency_id'],[['id','=',self.config.pricelist_id[0]]]);
}).then(function(pricelists){
self.pricelist = pricelists[0];
@@ -954,7 +949,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
var client = this.get('client');
var cashier = this.pos.cashier || this.pos.user;
var company = this.pos.company;
- var shop = this.pos.shop;
var date = new Date();
return {
@@ -999,9 +993,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
phone: company.phone,
logo: this.pos.company_logo_base64,
},
- shop:{
- name: shop.name,
- },
currency: this.pos.currency,
};
},
diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml
index baea81becb7..51e1cb19717 100644
--- a/addons/point_of_sale/static/src/xml/pos.xml
+++ b/addons/point_of_sale/static/src/xml/pos.xml
@@ -781,7 +781,6 @@
Phone:
User:
- Shop:
diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py
index fac55c593e7..cede85d1d38 100644
--- a/addons/point_of_sale/wizard/pos_return.py
+++ b/addons/point_of_sale/wizard/pos_return.py
@@ -91,85 +91,6 @@ class pos_return(osv.osv_memory):
'context': context,
'type': 'ir.actions.act_window',
}
- def create_returns2(self, cr, uid, ids, context=None):
-
- if context is None:
- context = {}
- active_id = context.get('active_id', False)
- order_obj =self.pool.get('pos.order')
- line_obj = self.pool.get('pos.order.line')
- picking_obj = self.pool.get('stock.picking')
- stock_move_obj = self.pool.get('stock.move')
- property_obj= self.pool.get("ir.property")
- uom_obj =self. pool.get('product.uom')
- statementl_obj = self.pool.get('account.bank.statement.line')
- #Todo :Need to clean the code
- if active_id:
- data = self.browse(cr, uid, ids, context=context)[0]
- date_cur = time.strftime('%Y-%m-%d %H:%M:%S')
-
- for order_id in order_obj.browse(cr, uid, [active_id], context=context):
- source_stock_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
- cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
- "WHERE w.lot_stock_id=s.id AND w.id=%s ",
- (order_id.warehouse_id.id,))
- res = cr.fetchone()
- location_id = res and res[0] or None
- new_picking = picking_obj.copy(cr, uid, order_id.picking_id.id, {'name':'%s (return)' % order_id.name,
- 'move_lines': [],
- 'state':'draft',
- 'type': 'in',
- 'partner_id': order_id.partner_id.id,
- 'date': date_cur })
- new_order = order_obj.copy(cr, uid, order_id.id, {'name': 'Refund %s'%order_id.name,
- 'lines':[],
- 'statement_ids':[],
- 'picking_id':[]})
- account_def = property_obj.get(cr, uid, 'property_account_payable', 'res.partner', context=context)
- amount = 0.0
- for line in order_id.lines:
- for record in data.pos_moves_ids:
- if line.id == record.line_id:
- qty = record.quantity
- amount += qty * line.price_unit
- stock_move_obj.create(cr, uid, {
- 'product_uom_qty': qty,
- 'product_uos_qty': uom_obj._compute_qty(cr, uid, qty ,line.product_id.uom_id.id),
- 'picking_id': new_picking,
- 'product_uom': line.product_id.uom_id.id,
- 'location_id': source_stock_id,
- 'product_id': line.product_id.id,
- 'location_dest_id': location_id,
- 'name': '%s (return)' %order_id.name,
- 'date': date_cur
- })
- if qty != 0.0:
- line_obj.copy(cr, uid, line.id, {'qty': -qty, 'order_id': new_order})
- statementl_obj.create(cr, uid, {
- 'name': 'Refund %s'%order_id.name,
- 'statement_id': order_id.statement_ids[0].statement_id.id,
- 'pos_statement_id': new_order,
- 'date': fields.date.context_today(self, cr, uid, context=context),
- 'account_id': order_id.partner_id and order_id.partner_id.property_account_payable \
- and order_id.partner_id.property_account_payable.id or account_def.id,
- 'amount': -amount,
- })
- order_obj.write(cr,uid, [active_id,new_order], {'state': 'done'})
- picking_obj.signal_button_confirm(cr, uid, [new_picking])
- picking_obj.force_assign(cr, uid, [new_picking], context)
- act = {
- 'domain': "[('id', 'in', ["+str(new_order)+"])]",
- 'name': 'Refunded Orders',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'pos.order',
- 'auto_refresh':0,
- 'res_id':new_order,
- 'view_id': False,
- 'context':context,
- 'type': 'ir.actions.act_window'
- }
- return act
class add_product(osv.osv_memory):
diff --git a/addons/procurement_jit/test/procurement_jit.yml b/addons/procurement_jit/test/procurement_jit.yml
index 1a50fcbe0c2..82a0c5ea480 100644
--- a/addons/procurement_jit/test/procurement_jit.yml
+++ b/addons/procurement_jit/test/procurement_jit.yml
@@ -1,5 +1,5 @@
-
- In order to test mrp_jit module with OpenERP, I create procurement order for
+ In order to test procurement_jit module with OpenERP, I create procurement order for
Computer Case product and check whether it runs without scheduler or not.
-
!record {model: procurement.order, id: procurement_order_test1}:
diff --git a/addons/project_mrp/__openerp__.py b/addons/project_mrp/__openerp__.py
index 1ea7ed60ae2..3730ec74113 100644
--- a/addons/project_mrp/__openerp__.py
+++ b/addons/project_mrp/__openerp__.py
@@ -49,7 +49,7 @@ completed.
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': ['images/product.jpeg', 'images/task_from_SO.jpeg'],
- 'depends': ['project', 'procurement', 'sale', 'mrp_jit'],
+ 'depends': ['project', 'procurement', 'sale', 'procurement_jit'],
'data': ['project_mrp_view.xml'], #'process/project_mrp_process.xml'
'demo': ['project_mrp_demo.xml'],
'test': ['test/project_task_procurement.yml'],
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index a1a901bf41e..a0d21807039 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -1132,9 +1132,13 @@ class procurement_order(osv.osv):
def propagate_cancel(self, cr, uid, procurement, context=None):
if procurement.rule_id.action == 'buy' and procurement.purchase_line_id:
- self.pool.get('purchase.order.line').action_cancel(cr, uid, [procurement.purchase_line_id.id], context=context)
+ purchase_line_obj = self.pool.get('purchase.order.line')
+ if procurement.purchase_line_id.product_qty > procurement.product_qty and procurement.purchase_line_id.order_id.state == 'draft':
+ purchase_line_obj.write(cr, uid, [procurement.purchase_line_id.id], {'product_qty': procurement.purchase_line_id.product_qty - procurement.product_qty}, context=context)
+ else:
+ purchase_line_obj.action_cancel(cr, uid, [procurement.purchase_line_id.id], context=context)
return super(procurement_order, self).propagate_cancel(cr, uid, procurement, context=context)
-
+
def _run(self, cr, uid, procurement, context=None):
if procurement.rule_id and procurement.rule_id.action == 'buy':
#make a purchase order for the procurement
diff --git a/addons/report/models/report.py b/addons/report/models/report.py
index 8abe8e544eb..d469cf946c5 100644
--- a/addons/report/models/report.py
+++ b/addons/report/models/report.py
@@ -403,6 +403,7 @@ class Report(osv.Model):
'report_name': report.report_name,
'report_type': report.report_type,
'report_file': report.report_file,
+ 'context': context,
}
if datas:
diff --git a/addons/report/static/src/js/qwebactionmanager.js b/addons/report/static/src/js/qwebactionmanager.js
index b75003942d2..dac8dcacf25 100644
--- a/addons/report/static/src/js/qwebactionmanager.js
+++ b/addons/report/static/src/js/qwebactionmanager.js
@@ -6,8 +6,6 @@ openerp.report = function(instance) {
var self = this;
instance.web.blockUI();
action = _.clone(action);
- var eval_contexts = ([instance.session.user_context] || []).concat([action.context]);
- action.context = instance.web.pyeval.eval('contexts',eval_contexts);
_t = instance.web._t;
// QWeb reports
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index e0e0b45d33f..c7afb693710 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -440,6 +440,21 @@ class stock_location_route(osv.osv):
class stock_picking(osv.osv):
_inherit = "stock.picking"
+ def _get_sale_id(self, cr, uid, ids, name, args, context=None):
+ sale_obj = self.pool.get("sale.order")
+ res = {}
+ for picking in self.browse(cr, uid, ids, context=context):
+ res[picking.id] = False
+ if picking.group_id:
+ sale_ids = sale_obj.search(cr, uid, [('procurement_group_id', '=', picking.group_id.id)], context=context)
+ if sale_ids:
+ res[picking.id] = sale_ids[0]
+ return res
+
+ _columns = {
+ 'sale_id': fields.function(_get_sale_id, type="many2one", relation="sale.order", string="Sale Order"),
+ }
+
def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None):
sale_obj = self.pool.get('sale.order')
sale_line_obj = self.pool.get('sale.order.line')
diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py
index 5651913c9eb..3da1ccbcc8d 100644
--- a/addons/stock/__openerp__.py
+++ b/addons/stock/__openerp__.py
@@ -69,12 +69,11 @@ Dashboard / Reports for Warehouse Management will include:
],
'data': [
'security/stock_security.xml',
- 'security/ir.model.access.csv',
+ 'security/ir.model.access.csv',
'stock_data.xml',
'stock_data.yml',
'wizard/stock_move_view.xml',
'wizard/stock_change_product_qty_view.xml',
- 'wizard/stock_location_product_view.xml',
'wizard/stock_return_picking_view.xml',
'wizard/make_procurement_view.xml',
'wizard/mrp_procurement_view.xml',
@@ -89,6 +88,8 @@ Dashboard / Reports for Warehouse Management will include:
'board_warehouse_view.xml',
'res_config_view.xml',
'views/report_package_barcode.xml',
+ 'views/report_stockpicking.xml',
+ 'views/report_stockinventory.xml',
],
'test': [
'test/inventory.yml',
diff --git a/addons/stock/report/__init__.py b/addons/stock/report/__init__.py
index e5e6ad45d9f..7f3669174db 100644
--- a/addons/stock/report/__init__.py
+++ b/addons/stock/report/__init__.py
@@ -20,11 +20,7 @@
##############################################################################
import product_stock
-import picking
-import lot_overview_all
import report_stock
-import stock_inventory_move_report
-import lot_overview
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/report/lot_move_label.xml b/addons/stock/report/lot_move_label.xml
deleted file mode 100644
index 028e244b894..00000000000
--- a/addons/stock/report/lot_move_label.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/stock/report/lot_move_label.xsl b/addons/stock/report/lot_move_label.xsl
deleted file mode 100644
index 73f99558932..00000000000
--- a/addons/stock/report/lot_move_label.xsl
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
- 24.5
- 1
- 3.8
- 7
- 3.5cm
- 6.5cm
- 3
- 21
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- cm
-
-
-
- cm
-
-
-
-
-
-
- ,
-
-
-
-
diff --git a/addons/stock/report/lot_overview.py b/addons/stock/report/lot_overview.py
deleted file mode 100644
index c8e80ac54b9..00000000000
--- a/addons/stock/report/lot_overview.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-import time
-from openerp.report import report_sxw
-
-class lot_overview(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(lot_overview, self).__init__(cr, uid, name, context=context)
- self.price_total = 0.0
- self.grand_total = 0.0
- self.localcontext.update({
- 'time': time,
- 'process':self.process,
- 'price_total': self._price_total,
- 'grand_total_price':self._grand_total,
- })
-
- def process(self, location_id):
- location_obj = self.pool['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],['complete_name'])[0]['complete_name']
- self.price_total = 0.0
- self.price_total += data['total_price']
- self.grand_total += data['total_price']
- return [data]
-
- def _price_total(self):
- return self.price_total
-
- def _grand_total(self):
- return self.grand_total
-
-report_sxw.report_sxw('report.lot.stock.overview', 'stock.location', 'addons/stock/report/lot_overview.rml', parser=lot_overview,header='internal')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/stock/report/lot_overview.rml b/addons/stock/report/lot_overview.rml
deleted file mode 100644
index 82c402a3fdf..00000000000
--- a/addons/stock/report/lot_overview.rml
+++ /dev/null
@@ -1,227 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/stock/report/picking.py b/addons/stock/report/picking.py
deleted file mode 100644
index a82e72766ac..00000000000
--- a/addons/stock/report/picking.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-from openerp.report import report_sxw
-from openerp.tools.translate import _
-
-class picking(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(picking, self).__init__(cr, uid, name, context=context)
- self.localcontext.update({
- 'time': time,
- 'get_internal_picking_src_lines': self.get_internal_picking_src_lines,
- 'get_internal_picking_dest_lines': self.get_internal_picking_dest_lines,
- 'get_product_desc': self.get_product_desc,
- })
- def get_product_desc(self, move_line):
- desc = move_line.product_id.name
- if move_line.product_id.default_code:
- desc = '[' + move_line.product_id.default_code + ']' + ' ' + desc
- return desc
-
- def get_internal_picking_src_lines(self, picking):
- res = []
- for line in picking.move_lines:
- if line.state not in ('confirmed', 'done', 'assigned', 'waiting') or line.scrapped:
- continue
- state_label = line.state == 'done' and _('Done') or (line.state == 'confirmed' and _('Waiting Availability') or (line.state == 'assigned' and _('Available') or _('Waiting Availability')))
- row = {
- 'state': state_label,
- 'description': self.get_product_desc(line),
- }
- if not line.lot_ids:
- row['quantity'] = line.product_uom_qty
- row['lot_id'] = ''
- row['uom'] = line.product_uom.name
- row['location_id'] = line.location_id.name
- row['barcode'] = line.product_id.ean13
- res.append(row)
- else:
- for quant in line.lot_ids:
- row2 = row.copy()
- row2['quantity'] = quant.qty
- row2['uom'] = line.product_id.uom_id.name
- row2['location_id'] = quant.location_id.name
- row2['lot_id'] = quant.lot_id and quant.lot_id.name or ''
- row2['barcode'] = quant.lot_id and quant.lot_id.name or line.product_id.ean13
- res.append(row2)
- return res
-
- def get_internal_picking_dest_lines(self, picking):
- res = []
- #TODO: rewrite according to pack ops
-# for line in picking.move_lines:
-# row = {'description': self.get_product_desc(line)}
-# if not line.putaway_ids:
-# row['quantity'] = line.product_uom_qty
-# row['uom'] = line.product_uom.name
-# row['location_id'] = line.location_dest_id.name
-# row['barcode'] = line.product_id.ean13
-# row['lot_id'] = ''
-# res.append(row)
-# else:
-# for rec in line.putaway_ids:
-# row2 = row.copy()
-# row2['quantity'] = rec.quantity
-# row2['uom'] = line.product_id.uom_id.name
-# row2['location_id'] = rec.location_id.name
-# row2['lot_id'] = rec.lot_id and rec.lot_id.name or ''
-# row2['barcode'] = rec.lot_id and rec.lot_id.name or line.product_id.ean13
-# res.append(row2)
- return res
-
-report_sxw.report_sxw('report.stock.picking.list', 'stock.picking', 'addons/stock/report/picking.rml', parser=picking)
-report_sxw.report_sxw('report.stock.picking.list.internal', 'stock.picking', 'addons/stock/report/picking_internal.rml', parser=picking, header='internal')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/report/picking.rml b/addons/stock/report/picking.rml
deleted file mode 100644
index b8dea09f9da..00000000000
--- a/addons/stock/report/picking.rml
+++ /dev/null
@@ -1,255 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Description
-
-
- Lot
-
-
- Status
-
-
- Location
-
-
- Quantity
-
-
-
-
- [[repeatIn(objects,'picking')]]
- [[picking.picking_type_id.code == 'outgoing' and picking.partner_id and setLang(picking.partner_id.lang) or '']]
-
-
-
-
-
-
- Supplier Address : [[ (picking.picking_type_id.code == 'incoming' or removeParentNode('para')) and '' ]]
- Customer Address : [[ (picking.picking_type_id.code == 'outgoing' or removeParentNode('para')) and '' ]]
- Warehouse Address : [[ (picking.picking_type_id.code == 'internal' or removeParentNode('para')) and '' ]]
- [[ (picking.partner_id and picking.partner_id.id and picking.partner_id.title.name) or '' ]] [[ picking.partner_id and picking.partner_id.id and picking.partner_id.name ]]
- [[ picking.partner_id and display_address(picking.partner_id) ]]
- [[ picking.partner_id.phone or picking.partner_id.email or removeParentNode('para')]]
-
-
- Contact Address :
- [[ picking.partner_id and picking.partner_id.title.name or '' ]] [[ picking.partner_id and picking.partner_id.name or '' ]]
- [[ picking.partner_id and display_address(picking.partner_id) ]]
- [[ picking.partner_id.phone or picking.partner_id.email or removeParentNode('para')]]
-
-
-
-
-
-
-
-
-
-
-
-
- Delivery Order : [[ (picking.picking_type_id.code == 'outgoing' or removeParentNode('para')) and '' ]] [[ picking.name ]]
- Incoming Shipment : [[ (picking.picking_type_id.code == 'incoming' or removeParentNode('para')) and '' ]] [[ picking.name ]]
- Internal Shipment : [[ (picking.picking_type_id.code == 'internal' or removeParentNode('para')) and '' ]] [[ picking.name ]]
-
- [[ move_line['barcode'] or removeParentNode('barCode')]]
-
-
-
-
- [[ ([line for line in picking.move_lines if line.state == 'draft']) and 'Non Assigned Products:' or removeParentNode('para') ]]
-
-
- [[ repeatIn([line for line in picking.move_lines if line.state == 'draft'],'move_lines') ]]
-
-
- [[ move_line['barcode'] or removeParentNode('barCode')]]
-
-
-
-
-
-
-
diff --git a/addons/stock/report/product_stock.py b/addons/stock/report/product_stock.py
index db6ac9b5a02..b8994368b70 100644
--- a/addons/stock/report/product_stock.py
+++ b/addons/stock/report/product_stock.py
@@ -66,11 +66,13 @@ class report_stock(report_int):
for name in names:
names[name] = names[name].encode('utf8')
products = {}
- prods = registry['stock.location']._product_all_get(cr, uid, location_id, product_ids)
+ ctx = context.copy()
+ ctx['location_id'] = loc_ids
+ prods = registry['product.product']._product_available(cr, uid, product_ids, context=ctx)
+ for prod in prods.keys():
+ products[prod] = [(now, prods[prod]['qty_available'])]
+ prods[prod] = 0
- for p in prods:
- products[p] = [(now,prods[p])]
- prods[p] = 0
if not loc_ids or not product_ids:
return (False, 'pdf')
diff --git a/addons/stock/report/stock_by_location.py b/addons/stock/report/stock_by_location.py
deleted file mode 100644
index 153b92f077c..00000000000
--- a/addons/stock/report/stock_by_location.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import openerp
-from openerp.report.interface import report_rml
-from openerp.report.interface import toxml
-
-#FIXME: we should use toxml
-
-class report_custom(report_rml):
- def create_xml(self, cr, uid, ids, datas, context=None):
- config = """
-
- 09/09/2005
- 210.00mm,297.00mm
- 595.27
- 841.88
- 60.00mm,60.00mm,60.00mm
- Stock by location
- Generated by OpenERP
-
- """
- header = """
-
- Location
- Product name
- Product quantity
-
- """
-
- def process(location_id, level):
- registry = openerp.registry(cr.dbname)
- xml = ''
- location_name = registry['stock.location'].read(cr, uid, [location_id], ['name'])
- xml += "
"
- xml += location_name[0]['name'] + ''
-
- prod_info = registry['stock.location']._product_get(cr, uid, location_id)
- xml += "
"
- for prod_id in prod_info.keys():
- if prod_info[prod_id] != 0.0:
- prod_name = registry['product.product'].read(cr, uid, [prod_id], ['name'])
- xml += prod_name[0]['name'] + '\n'
- xml += ''
-
- xml += "
-
-
-
-
-
-
-
diff --git a/addons/stock/report/stock_inventory_move_report.py b/addons/stock/report/stock_inventory_move_report.py
deleted file mode 100644
index ee1570b2193..00000000000
--- a/addons/stock/report/stock_inventory_move_report.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-import time
-from openerp.report import report_sxw
-
-class stock_inventory_move(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(stock_inventory_move, self).__init__(cr, uid, name, context=context)
- self.localcontext.update({
- 'time': time,
- 'qty_total':self._qty_total
- })
-
- def _qty_total(self, objects):
- total = 0.0
- uom = objects[0].product_uom_id.name
- for obj in objects:
- total += obj.product_qty
- return {'quantity':total,'uom':uom}
-
-report_sxw.report_sxw(
- 'report.stock.inventory.move',
- 'stock.inventory',
- 'addons/stock/report/stock_inventory_move.rml',
- parser=stock_inventory_move,
- header='internal'
-)
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/res_config.py b/addons/stock/res_config.py
index 1a8b86fd54f..162de1ff5b7 100644
--- a/addons/stock/res_config.py
+++ b/addons/stock/res_config.py
@@ -37,11 +37,11 @@ class stock_config_settings(osv.osv_memory):
_columns = {
'company_id': fields.many2one('res.company', 'Company', required=True),
- 'module_mrp_jit': fields.boolean("Generate procurement in real time",
+ 'module_procurement_jit': fields.boolean("Generate procurement in real time",
help="""This allows Just In Time computation of procurement orders.
All procurement orders will be processed immediately, which could in some
cases entail a small performance impact.
- This installs the module mrp_jit."""),
+ This installs the module procurement_jit."""),
'module_claim_from_delivery': fields.boolean("Allow claim on deliveries",
help='Adds a Claim link to the delivery order.\n'
'-This installs the module claim_from_delivery.'),
diff --git a/addons/stock/res_config_view.xml b/addons/stock/res_config_view.xml
index 4a2f8b2686e..b783caff41e 100644
--- a/addons/stock/res_config_view.xml
+++ b/addons/stock/res_config_view.xml
@@ -63,8 +63,8 @@
-
-
+
+
diff --git a/addons/stock/static/src/js/widgets.js b/addons/stock/static/src/js/widgets.js
index 756d3caf841..f90120a69dc 100644
--- a/addons/stock/static/src/js/widgets.js
+++ b/addons/stock/static/src/js/widgets.js
@@ -829,18 +829,10 @@ function openerp_picking_widgets(instance){
var self = this;
new instance.web.Model('stock.picking.type').call('read', [[self.picking_type_id], ['code'], new instance.web.CompoundContext()])
.then(function(pick_type){
- if (pick_type[0]['code'] == 'outgoing'){
- new instance.web.Model('stock.picking').call('do_print_delivery',[[self.picking.id]])
+ new instance.web.Model('stock.picking').call('do_print_picking',[[self.picking.id]])
.then(function(action){
return self.do_action(action);
});
- }
- else {
- new instance.web.Model('stock.picking').call('do_print_picking',[[self.picking.id]])
- .then(function(action){
- return self.do_action(action);
- });
- }
});
},
picking_next: function(){
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 86c4b8d2082..8c769dbf5c7 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -808,23 +808,10 @@ class stock_picking(osv.osv):
default['date_done'] = False
return super(stock_picking, self).copy(cr, uid, id, default, context)
- def do_print_delivery(self, cr, uid, ids, context=None):
- '''This function prints the delivery order'''
- assert len(ids) == 1, 'This option should only be used for a single id at a time'
- datas = {
- 'model': 'stock.picking',
- 'ids': ids,
- }
- return {'type': 'ir.actions.report.xml', 'report_name': 'stock.picking.list', 'datas': datas, 'nodestroy': True}
def do_print_picking(self, cr, uid, ids, context=None):
'''This function prints the picking list'''
- assert len(ids) == 1, 'This option should only be used for a single id at a time'
- datas = {
- 'model': 'stock.picking',
- 'ids': ids,
- }
- return {'type': 'ir.actions.report.xml', 'report_name': 'stock.picking.list.internal', 'datas': datas, 'nodestroy': True}
+ return self.pool.get("report").get_action(cr, uid, ids, 'stock.report_picking', context=context)
def action_confirm(self, cr, uid, ids, context=None):
todo = []
@@ -2296,6 +2283,8 @@ class stock_move(osv.osv):
""" Splits qty from move move into a new move
:param move: browse record
:param qty: float. quantity to split (given in product UoM)
+ :param restrict_lot_id: optional production lot that can be given in order to force the new move to restrict its choice of quants to this lot.
+ :param restrict_partner_id: optional partner that can be given in order to force the new move to restrict its choice of quants to the ones belonging to this partner.
:param context: dictionay. can contains the special key 'source_location_id' in order to force the source location when copying the move
returns the ID of the backorder move created
@@ -2381,9 +2370,15 @@ class stock_inventory(osv.osv):
res_filter.append(('pack', _('A Pack')))
return res_filter
+ def _get_total_qty(self, cr, uid, ids, field_name, args, context=None):
+ res = {}
+ for inv in self.browse(cr, uid, ids, context=context):
+ res[inv.id] = sum([x.product_qty for x in inv.line_ids])
+ return res
+
_columns = {
'name': fields.char('Inventory Reference', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Inventory Name."),
- 'date': fields.datetime('Inventory Date', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Inventory Create Date."),
+ 'date': fields.datetime('Inventory Date', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="The date that will be used for the validation date of the stock move related to this inventory (and for the valuation accounting entries, if any)"),
'line_ids': fields.one2many('stock.inventory.line', 'inventory_id', 'Inventories', readonly=False, states={'done': [('readonly', True)]}, help="Inventory Lines."),
'move_ids': fields.one2many('stock.move', 'inventory_id', 'Created Moves', help="Inventory Moves.", states={'done': [('readonly', True)]}),
'state': fields.selection([('draft', 'Draft'), ('cancel', 'Cancelled'), ('confirm', 'In Progress'), ('done', 'Validated')], 'Status', readonly=True, select=True),
@@ -2395,6 +2390,7 @@ class stock_inventory(osv.osv):
'lot_id': fields.many2one('stock.production.lot', 'Lot/Serial Number', readonly=True, states={'draft': [('readonly', False)]}, help="Specify Lot/Serial Number to focus your inventory on a particular Lot/Serial Number."),
'move_ids_exist': fields.function(_get_move_ids_exist, type='boolean', string=' Stock Move Exists?', help='technical field for attrs in view'),
'filter': fields.selection(_get_available_filters, 'Selection Filter'),
+ 'total_qty': fields.function(_get_total_qty, type="float"),
}
def _default_stock_location(self, cr, uid, context=None):
diff --git a/addons/stock/stock_demo.yml b/addons/stock/stock_demo.yml
index 46427cb5e09..a9a4d64c564 100644
--- a/addons/stock/stock_demo.yml
+++ b/addons/stock/stock_demo.yml
@@ -42,6 +42,7 @@
-
!record {model: stock.inventory, id: stock_inventory_icecream}:
name: Inventory for icecream
+ filter: 'product'
product_id: product_icecream
-
!record {model: stock.inventory.line, id: stock_inventory_line_icecream_lot0}:
diff --git a/addons/stock/stock_report.xml b/addons/stock/stock_report.xml
index bc32f14579b..f5c98068ef9 100644
--- a/addons/stock/stock_report.xml
+++ b/addons/stock/stock_report.xml
@@ -1,14 +1,25 @@
+
+
+
-
-
-
-
-
-
-
+
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 60c7fde1bcd..2e11995f7c9 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -586,11 +586,7 @@
-
- {'product_id': active_id}
- Stock by Location
- stock.location
-
+
{'search_default_done': 1,'search_default_product_id': active_id, 'default_product_id': active_id}Moves
@@ -725,7 +721,6 @@
-
@@ -1360,29 +1355,6 @@
-
-
-
- tree_but_open
- stock.location
- Products
-
-
-
-
-
- tree_but_open
- stock.location
- Open Products
-
-
-
stock.picking.type.filter
@@ -2053,7 +2025,7 @@
-
+
@@ -2147,7 +2119,7 @@
stock.pickingformtree,form
- [('group_id','=',active_id)]
+ [('group_id','=',active_id)]procurement.group.form.herited
diff --git a/addons/stock/views/report_stockinventory.xml b/addons/stock/views/report_stockinventory.xml
new file mode 100644
index 00000000000..db4d1ac6a02
--- /dev/null
+++ b/addons/stock/views/report_stockinventory.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/stock/wizard/__init__.py b/addons/stock/wizard/__init__.py
index 4e2659f8218..f6fc43f68e6 100644
--- a/addons/stock/wizard/__init__.py
+++ b/addons/stock/wizard/__init__.py
@@ -20,7 +20,6 @@
##############################################################################
import stock_move
-import stock_location_product
import stock_return_picking
import stock_change_product_qty
import make_procurement_product
diff --git a/addons/stock/wizard/stock_location_product.py b/addons/stock/wizard/stock_location_product.py
deleted file mode 100644
index ef7c9848160..00000000000
--- a/addons/stock/wizard/stock_location_product.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from openerp.osv import fields, osv
-from openerp.tools.translate import _
-
-class stock_location_product(osv.osv_memory):
- _name = "stock.location.product"
- _description = "Products by Location"
- _columns = {
- 'from_date': fields.datetime('From'),
- 'to_date': fields.datetime('To'),
- 'type': fields.selection([('inventory','Analyse Current Inventory'),
- ('period','Analyse a Period')], 'Analyse Type', required=True),
- }
-
- def action_open_window(self, cr, uid, ids, context=None):
- """ To open location wise product information specific to given duration
- @param self: The object pointer.
- @param cr: A database cursor
- @param uid: ID of the user currently logged in
- @param ids: An ID or list of IDs (but only the first ID will be processed)
- @param context: A standard dictionary
- @return: Invoice type
- """
- if context is None:
- context = {}
- location_products = self.read(cr, uid, ids, ['from_date', 'to_date'], context=context)
- if location_products:
- return {
- 'name': _('Current Inventory'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'product.product',
- 'type': 'ir.actions.act_window',
- 'context': {'location': context['active_id'],
- 'from_date': location_products[0]['from_date'],
- 'to_date': location_products[0]['to_date']},
- 'domain': [('type', '<>', 'service')],
- }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/wizard/stock_location_product_view.xml b/addons/stock/wizard/stock_location_product_view.xml
deleted file mode 100644
index d6141752636..00000000000
--- a/addons/stock/wizard/stock_location_product_view.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
- Products by Location
- stock.location.product
-
-
-
-
-
-
-
-
-
diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py
index 5856d892bf8..b938c3da10b 100644
--- a/addons/stock_account/wizard/stock_valuation_history.py
+++ b/addons/stock_account/wizard/stock_valuation_history.py
@@ -43,13 +43,21 @@ class stock_history(osv.osv):
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
res = super(stock_history, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby)
+ prod_dict= {}
if 'inventory_value' in fields:
for line in res:
if '__domain' in line:
lines = self.search(cr, uid, line['__domain'], context=context)
inv_value = 0.0
- for line2 in self.browse(cr, uid, lines, context=context):
- inv_value += line2.inventory_value
+ product_obj = self.pool.get("product.product")
+ lines_rec = self.browse(cr, uid, lines, context=context)
+ for line_rec in lines_rec:
+ if not line_rec.product_id.id in prod_dict:
+ if line_rec.product_id.cost_method == 'real':
+ prod_dict[line_rec.product_id.id] = line_rec.price_unit_on_quant
+ else:
+ prod_dict[line_rec.product_id.id] = product_obj.get_history_price(cr, uid, line_rec.product_id.id, line_rec.company_id.id, context=context)
+ inv_value += prod_dict[line_rec.product_id.id]
line['inventory_value'] = inv_value
return res
@@ -93,9 +101,7 @@ class stock_history(osv.osv):
ir_property.value_text AS cost_method,
quant.cost as price_unit_on_quant
FROM
- stock_move
- LEFT JOIN
- stock_quant quant ON quant.id IN (SELECT quant_id FROM stock_quant_move_rel WHERE move_id = stock_move.id)
+ stock_quant as quant, stock_quant_move_rel, stock_move
LEFT JOIN
stock_location location ON stock_move.location_dest_id = location.id
LEFT JOIN
@@ -104,7 +110,8 @@ class stock_history(osv.osv):
product_template ON product_template.id = product_product.product_tmpl_id
LEFT JOIN
ir_property ON (ir_property.name = 'cost_method' and ir_property.res_id = 'product.template,' || product_template.id::text)
- WHERE stock_move.state = 'done' AND location.usage = 'internal'
+ WHERE stock_move.state = 'done' AND location.usage = 'internal' AND stock_quant_move_rel.quant_id = quant.id
+ AND stock_quant_move_rel.move_id = stock_move.id
) UNION
(SELECT
'-' || stock_move.id::text || '-' || quant.id::text AS id,
@@ -117,9 +124,7 @@ class stock_history(osv.osv):
ir_property.value_text AS cost_method,
quant.cost as price_unit_on_quant
FROM
- stock_move
- LEFT JOIN
- stock_quant quant ON quant.id IN (SELECT quant_id FROM stock_quant_move_rel WHERE move_id = stock_move.id)
+ stock_quant as quant, stock_quant_move_rel, stock_move
LEFT JOIN
stock_location location ON stock_move.location_id = location.id
LEFT JOIN
@@ -128,6 +133,7 @@ class stock_history(osv.osv):
product_template ON product_template.id = product_product.product_tmpl_id
LEFT JOIN
ir_property ON (ir_property.name = 'cost_method' and ir_property.res_id = 'product.template,' || product_template.id::text)
- WHERE stock_move.state = 'done' AND location.usage = 'internal'
+ WHERE stock_move.state = 'done' AND location.usage = 'internal' AND stock_quant_move_rel.quant_id = quant.id
+ AND stock_quant_move_rel.move_id = stock_move.id
)
)""")
diff --git a/addons/stock_account/wizard/stock_valuation_history_view.xml b/addons/stock_account/wizard/stock_valuation_history_view.xml
index ea8b983f13e..83d58133de2 100644
--- a/addons/stock_account/wizard/stock_valuation_history_view.xml
+++ b/addons/stock_account/wizard/stock_valuation_history_view.xml
@@ -8,7 +8,7 @@
diff --git a/addons/stock_picking_wave/__init__.py b/addons/stock_picking_wave/__init__.py
index 59d0d9f72d0..4a3f27b2ebd 100644
--- a/addons/stock_picking_wave/__init__.py
+++ b/addons/stock_picking_wave/__init__.py
@@ -21,5 +21,6 @@
import stock_picking_wave
import wizard
+import controllers
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock_picking_wave/controllers/__init__.py b/addons/stock_picking_wave/controllers/__init__.py
new file mode 100644
index 00000000000..039d9715fab
--- /dev/null
+++ b/addons/stock_picking_wave/controllers/__init__.py
@@ -0,0 +1 @@
+import main
\ No newline at end of file
diff --git a/addons/stock_picking_wave/controllers/main.py b/addons/stock_picking_wave/controllers/main.py
new file mode 100644
index 00000000000..9de14934828
--- /dev/null
+++ b/addons/stock_picking_wave/controllers/main.py
@@ -0,0 +1,16 @@
+from openerp.addons.web import http
+from openerp.addons.web.http import request
+
+
+class picking_wave_report(http.Controller):
+ @http.route('/report/stock_picking_wave.report_pickingwave/', type='http', auth='user',
+ website=True, multilang=True)
+ def report_picking_wave(self, ids):
+ self.cr, self.uid, self.pool = request.cr, request.uid, request.registry
+ ids = [int(i) for i in ids.split(',')]
+ picking_wave_obj = self.pool["stock.picking.wave"]
+ wave = picking_wave_obj.browse(self.cr, self.uid, ids[0])
+ docargs = {
+ 'docs': wave.picking_ids,
+ }
+ return request.registry['report'].render(self.cr, self.uid, [], 'stock.report_picking', docargs)
diff --git a/addons/stock_picking_wave/stock_picking_wave.py b/addons/stock_picking_wave/stock_picking_wave.py
index c5e3377b023..3fd7d9cdbc0 100644
--- a/addons/stock_picking_wave/stock_picking_wave.py
+++ b/addons/stock_picking_wave/stock_picking_wave.py
@@ -31,22 +31,16 @@ class stock_picking_wave(osv.osv):
'''
This function print the report for all picking_ids associated to the picking wave
'''
+ if context is None:
+ context = {}
picking_ids = []
for wave in self.browse(cr, uid, ids, context=context):
picking_ids += [picking.id for picking in wave.picking_ids]
if not picking_ids:
raise osv.except_osv(_('Error!'), _('Nothing to print.'))
- datas = {
- 'ids': picking_ids,
- 'model': 'stock.picking',
- 'form': self.read(cr, uid, picking_ids, context=context)
- }
- return {
- 'type': 'ir.actions.report.xml',
- 'report_name': context.get('report', 'stock.picking.list'),
- 'datas': datas,
- 'nodestroy': True
- }
+ context['active_ids'] = picking_ids
+ context['active_model'] = 'stock.picking'
+ return self.pool.get("report").get_action(cr, uid, [], 'stock.report_picking', context=context)
def create(self, cr, uid, vals, context=None):
if vals.get('name', '/') == '/':
diff --git a/addons/stock_picking_wave/stock_picking_wave_view.xml b/addons/stock_picking_wave/stock_picking_wave_view.xml
index 450232603e1..2dec7ad4388 100644
--- a/addons/stock_picking_wave/stock_picking_wave_view.xml
+++ b/addons/stock_picking_wave/stock_picking_wave_view.xml
@@ -13,7 +13,7 @@