diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index ff9f95fd2ce..57c3cbf1224 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -685,8 +685,6 @@ class sale_order(osv.osv):
order.write(val)
return True
-
-
# TODO add a field price_unit_uos
# - update it on change product and unit price
# - use it in report if there is a uos
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index 451a82f1837..98c74b4f4ad 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -110,9 +110,12 @@
-
-
+
+
+
+
+
diff --git a/addons/sale_stock/stock.py b/addons/sale_stock/stock.py
index 3646b26fc09..af860d174fd 100644
--- a/addons/sale_stock/stock.py
+++ b/addons/sale_stock/stock.py
@@ -51,7 +51,10 @@ class stock_picking(osv.osv):
("2binvoiced", "To Be Invoiced"),
("none", "Not Applicable")
], string="Invoice Control", required=True,
- store={'procurement.order': (__get_picking_procurement, ['invoice_state'], 10)},
+ store={
+ 'procurement.order': (__get_picking_procurement, ['invoice_state'], 10),
+ 'stock.picking': (lambda self, cr, uid, ids, c={}: uid, ['state'], 10)
+ },
),
}
_defaults = {
diff --git a/addons/sale_stock/wizard/stock_invoice_onshipping.py b/addons/sale_stock/wizard/stock_invoice_onshipping.py
index 30f6664f4aa..0d5239e93d2 100644
--- a/addons/sale_stock/wizard/stock_invoice_onshipping.py
+++ b/addons/sale_stock/wizard/stock_invoice_onshipping.py
@@ -20,11 +20,9 @@
##############################################################################
from openerp.osv import fields, osv
-
from openerp.tools.translate import _
class stock_invoice_onshipping(osv.osv_memory):
-
def _get_journal(self, cr, uid, context=None):
res = self._get_journal_id(cr, uid, context=context)
if res:
@@ -34,50 +32,22 @@ class stock_invoice_onshipping(osv.osv_memory):
def _get_journal_id(self, cr, uid, context=None):
if context is None:
context = {}
-
- model = context.get('active_model')
- if not model or 'stock.picking' not in model:
- return []
-
- model_pool = self.pool[model]
journal_obj = self.pool.get('account.journal')
- res_ids = context and context.get('active_ids', [])
+ value = journal_obj.search(cr, uid, [('type', 'in',('sale','sale_Refund'))])
vals = []
- browse_picking = model_pool.browse(cr, uid, res_ids, context=context)
-
- for pick in browse_picking:
- if not pick.move_lines:
- continue
- src_usage = pick.move_lines[0].location_id.usage
- dest_usage = pick.move_lines[0].location_dest_id.usage
- type = pick.type
- if type == 'out' and dest_usage == 'supplier':
- journal_type = 'purchase_refund'
- elif type == 'out' and dest_usage == 'customer':
- journal_type = 'sale'
- elif type == 'in' and src_usage == 'supplier':
- journal_type = 'purchase'
- elif type == 'in' and src_usage == 'customer':
- journal_type = 'sale_refund'
- else:
- journal_type = 'sale'
-
- value = journal_obj.search(cr, uid, [('type', '=',journal_type )])
- for jr_type in journal_obj.browse(cr, uid, value, context=context):
- t1 = jr_type.id,jr_type.name
- if t1 not in vals:
- vals.append(t1)
+ for jr_type in journal_obj.browse(cr, uid, value, context=context):
+ t1 = jr_type.id,jr_type.name
+ if t1 not in vals:
+ vals.append(t1)
return vals
_name = "stock.invoice.onshipping"
_description = "Stock Invoice Onshipping"
-
_columns = {
'journal_id': fields.selection(_get_journal_id, 'Destination Journal',required=True),
'group': fields.boolean("Group by partner"),
'invoice_date': fields.date('Invoiced date'),
}
-
_defaults = {
'journal_id' : _get_journal,
}