diff --git a/addons/delivery/delivery_report.xml b/addons/delivery/delivery_report.xml
index 14c1d241131..3cebbba4eac 100644
--- a/addons/delivery/delivery_report.xml
+++ b/addons/delivery/delivery_report.xml
@@ -6,7 +6,8 @@
id="report_shipping"
model="stock.picking"
name="sale.shipping"
- rml="delivery/report/shipping.rml"
+ multi="True"
+ rml="delivery/report/shipping.rml"
string="Delivery order"/>
diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml
index d557f2c0750..57fc4e65dc0 100644
--- a/addons/delivery/delivery_view.xml
+++ b/addons/delivery/delivery_view.xml
@@ -4,6 +4,9 @@
+
+
+
delivery.carrier.treedelivery.carrier
@@ -266,10 +269,23 @@
-
+
+
+ stock.picking.out.form
+ form
+ stock.picking
+
+
+
+
+
+
+
+
+
diff --git a/addons/product/product.py b/addons/product/product.py
index b3fa3c594f4..c723b79d1a5 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -30,6 +30,34 @@ from tools.translate import _
def is_pair(x):
return not x%2
+def check_ean(eancode):
+ if not eancode:
+ return True
+ if len(eancode) <> 13:
+ return False
+ try:
+ int(eancode)
+ except:
+ return False
+ oddsum=0
+ evensum=0
+ total=0
+ eanvalue=eancode
+ reversevalue = eanvalue[::-1]
+ finalean=reversevalue[1:]
+
+ for i in range(len(finalean)):
+ if is_pair(i):
+ oddsum += int(finalean[i])
+ else:
+ evensum += int(finalean[i])
+ total=(oddsum * 3) + evensum
+
+ check = int(10 - math.ceil(total % 10.0))
+
+ if check != int(eancode[-1]):
+ return False
+ return True
#----------------------------------------------------------
# UOM
#----------------------------------------------------------
@@ -452,25 +480,9 @@ class product_product(osv.osv):
return False
def _check_ean_key(self, cr, uid, ids):
- for partner in self.browse(cr, uid, ids):
- if not partner.ean13:
- continue
- if len(partner.ean13) <> 13:
- return False
- try:
- int(partner.ean13)
- except:
- return False
- sum=0
- for i in range(12):
- if is_pair(i):
- sum += int(partner.ean13[i])
- else:
- sum += 3 * int(partner.ean13[i])
- check = int(math.ceil(sum / 10.0) * 10 - sum)
- if check != int(partner.ean13[12]):
- return False
- return True
+ for product in self.browse(cr, uid, ids):
+ res = check_ean(product.ean13)
+ return res
_constraints = [(_check_ean_key, 'Error: Invalid ean code', ['ean13'])]
@@ -600,6 +612,13 @@ class product_packaging(osv.osv):
}
+ def _check_ean_key(self, cr, uid, ids):
+ for pack in self.browse(cr, uid, ids):
+ res = check_ean(pack.ean)
+ return res
+
+ _constraints = [(_check_ean_key, 'Error: Invalid ean code', ['ean'])]
+
def name_get(self, cr, uid, ids, context={}):
if not len(ids):
return []
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index d93a1ec15b1..4920ca034ba 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -646,10 +646,7 @@ class purchase_order_line(osv.osv):
return {'value': {'price_unit': price_unit or 0.0, 'name': name or '',
'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}}
prod= self.pool.get('product.product').browse(cr, uid, product)
- if prod.product_tmpl_id.seller_ids:
- seller_get_id = prod.product_tmpl_id.seller_ids[0].name.id
- else:
- seller_get_id = False
+
lang=False
if partner_id:
@@ -665,12 +662,22 @@ class purchase_order_line(osv.osv):
date_order = time.strftime('%Y-%m-%d')
qty = qty or 1.0
seller_delay = 0
+
+ prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
for s in prod.seller_ids:
if s.name.id == partner_id:
seller_delay = s.delay
temp_qty = s.qty # supplier _qty assigned to temp
if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal.
qty = temp_qty
+ prod_suppl_name = s.product_name
+ prod_suppl_code = s.product_code
+ if not (prod_suppl_name or prod_suppl_code):
+ prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
+ elif (not prod_suppl_name) or (not prod_suppl_code):
+ prod_name= '[' + (prod_suppl_code or prod.default_code or '') + '] '+ (prod_suppl_name or prod.name or '')
+ else:
+ prod_name= '[' + prod_suppl_code + '] '+ prod_suppl_name
if price_unit:
price = price_unit
else:
@@ -680,15 +687,7 @@ class purchase_order_line(osv.osv):
'date': date_order,
})[pricelist]
dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S')
- if seller_get_id == partner_id:
- prod_suppl_name = self.pool.get('product.product').browse(cr, uid, prod.id).seller_ids[0].product_name
- prod_suppl_code = self.pool.get('product.product').browse(cr, uid, prod.id).seller_ids[0].product_code
- if prod_suppl_name == False or prod_suppl_code == False:
- prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
- else:
- prod_name= '[' + prod_suppl_code + '] '+ prod_suppl_name
- else:
- prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
+
res = {'value': {'price_unit': price, 'name': name or prod_name,
'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id),
diff --git a/addons/purchase/test/purchase_from_manual.yml b/addons/purchase/test/purchase_from_manual.yml
index 0c406635b85..6b95748bc4d 100644
--- a/addons/purchase/test/purchase_from_manual.yml
+++ b/addons/purchase/test/purchase_from_manual.yml
@@ -21,17 +21,16 @@
warranty: 0.0
weight: 0.0
weight_net: 0.0
--
+-
In order to test the purchase flow,I create a new record where "invoice_method" is From Manual
-
I create purchase order for iPod.
--
+-
!record {model: purchase.order, id: purchase_order_po1}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: manual
location_id: stock.stock_location_stock
- name: PO00010
order_line:
- date_planned: '2010-05-13'
name: iPod
@@ -47,16 +46,16 @@
Initially purchase order is in the draft state
-
!assert {model: purchase.order, id: purchase_order_po1}:
- - state == 'draft'
+ - state == 'draft'
-
I confirm the purchase order.
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po1}
--
+-
I check that the order which was initially in the draft state has transit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_po1}:
- - state == 'approved'
+ - state == 'approved'
-
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
-
@@ -68,7 +67,7 @@
assert search_ids, _('Purchase order line is not created!')
-
To check that wizard "Create Invoices" gets opened
--
+-
I create purchase order line invoice entry.
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
@@ -77,7 +76,7 @@
I create invoice for products in the purchase order.
-
!python {model: purchase.order.line_invoice}: |
- pur_obj=self.pool.get('purchase.order')
+ pur_obj=self.pool.get('purchase.order')
ids = []
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po1"))
for line in pur_id1.order_line:
@@ -99,13 +98,13 @@
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po1"))
account_obj = self.pool.get('account.invoice')
- ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
+ ids = account_obj.search(cr, uid, [('origin', '=', 'PO-'+str(pur_id1.id))])
assert ids, _('Pending Invoice is not created!')
-
I check that the order which was initially in the confirmed state has transit to approved state.
-
!assert {model: purchase.order, id: purchase_order_po1}:
- - state == 'approved'
+ - state == 'approved'
-
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved.
-
diff --git a/addons/purchase/test/purchase_from_picking.yml b/addons/purchase/test/purchase_from_picking.yml
index 5ef3058cdc2..e68668f408d 100644
--- a/addons/purchase/test/purchase_from_picking.yml
+++ b/addons/purchase/test/purchase_from_picking.yml
@@ -21,17 +21,16 @@
warranty: 0.0
weight: 0.0
weight_net: 0.0
--
+-
In order to test the purchase flow,I create a new record where "invoice_method" is From Picking
-
I create purchase order for iPod.
--
+-
!record {model: purchase.order, id: purchase_order_po2}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: picking
location_id: stock.stock_location_stock
- name: PO00008
order_line:
- date_planned: '2010-05-13'
name: iPod
@@ -47,16 +46,16 @@
Initially purchase order is in the draft state.
-
!assert {model: purchase.order, id: purchase_order_po2}:
- - state == 'draft'
+ - state == 'draft'
-
I confirm the purchase order for iPod.
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po2}
--
+-
I check that the order which was initially in the draft state has transit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_po2}:
- - state == 'approved'
+ - state == 'approved'
-
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line.
-
@@ -68,7 +67,7 @@
assert search_ids, _('Purchase order line is not created!')
-
To check that wizard "Create Invoices" gets opened.
--
+-
I create purchase order line invoice entry.
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
@@ -77,7 +76,7 @@
I create invoice for products in the purchase order.
-
!python {model: purchase.order.line_invoice}: |
- pur_obj=self.pool.get('purchase.order')
+ pur_obj=self.pool.get('purchase.order')
ids = []
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
for line in pur_id1.order_line:
@@ -99,21 +98,21 @@
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po2"))
account_obj = self.pool.get('account.invoice')
- ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
+ ids = account_obj.search(cr, uid, [('origin', '=', 'PO-'+str(pur_id1.id))])
assert ids, _('Pending Invoice is not created!')
-
I check that the order which was initially in the confirmed state has transit to approved state.
-
!assert {model: purchase.order, id: purchase_order_po2}:
- - state == 'approved'
+ - state == 'approved'
-
- I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved.
+ I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved.
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
assert(pur_id.date_approve)
-
- I check that an entry gets created in the stock.picking.
+ I check that an entry gets created in the stock.picking.
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
@@ -130,8 +129,8 @@
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
assert search_id, 'No Incoming Product!'
-
- Then I create an invoice from picking by clicking on "Create Invoice" wizard
--
+ Then I create an invoice from picking by clicking on "Create Invoice" wizard
+-
!python {model: stock.invoice.onshipping}: |
pur_obj=self.pool.get('purchase.order')
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 6fa7a7950bc..207b1b95b0a 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -783,7 +783,7 @@
-
+
@@ -928,7 +928,7 @@
-
+
@@ -937,6 +937,7 @@
+
@@ -1158,6 +1159,7 @@
+
diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py
index 7924ad0a31b..9af23888b4d 100644
--- a/addons/stock/wizard/stock_invoice_onshipping.py
+++ b/addons/stock/wizard/stock_invoice_onshipping.py
@@ -63,7 +63,6 @@ class stock_invoice_onshipping(osv.osv_memory):
_columns = {
-# 'journal_id': fields.many2one('account.journal', 'Destination Journal', required=True,selection=_get_journal_id),
'journal_id': fields.selection(_get_journal_id, 'Destination Journal',required=True),
'group': fields.boolean("Group by partner"),
'invoice_date': fields.date('Invoiced date'),
@@ -86,7 +85,7 @@ class stock_invoice_onshipping(osv.osv_memory):
raise osv.except_osv(_('Warning !'), _('None of these picking lists require invoicing.'))
return res
-
+
def create_invoice(self, cr, uid, ids, context=None):
if context is None:
diff --git a/addons/stock/wizard/stock_return_picking_view.xml b/addons/stock/wizard/stock_return_picking_view.xml
index 36a7c23a66f..3f4f2d296d9 100644
--- a/addons/stock/wizard/stock_return_picking_view.xml
+++ b/addons/stock/wizard/stock_return_picking_view.xml
@@ -1,12 +1,13 @@
-
+ target="new"
+ key2="client_action_multi"
+ multi="True"
+ id="act_stock_return_picking"/>
-
+