From bbf8ca67fa11a3c399020413d3885f040e9ceb2d Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Tue, 13 Aug 2013 10:54:24 +0530
Subject: [PATCH 01/35] [IMP] make chnages anglo_saxon_yml
bzr revid: rma@tinyerp.com-20130813052424-bdolzw3yl93kggay
---
.../account_anglo_saxon/test/anglo_saxon.yml | 40 +++++++++++--------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml
index 6e9ebc0068e..77dc05836bc 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon.yml
@@ -123,10 +123,15 @@
-
Reception is ready for process so now done the reception.
-
- !python {model: stock.partial.picking}: |
- pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001")).picking_ids
- partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
+ !python {model: stock.picking}: |
+ order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001"))
+ for pick in order.picking_ids:
+ self.pool.get('stock.pack.operation').create(cr, uid, {
+ 'picking_id': pick.id,
+ 'product_qty': 1
+ })
+ pick.do_partial(context=context)
+
-
I check the Stock Interim account (Received) is credited successfully.
-
@@ -189,7 +194,6 @@
-
!record {model: stock.picking, id: stock_picking_out001}:
partner_id: base.res_partner_13
- invoice_state: 2binvoiced
move_lines:
- company_id: base.main_company
location_id: stock.stock_location_stock
@@ -198,29 +202,31 @@
product_uom: product.product_uom_unit
location_dest_id: stock.stock_location_customers
move_type: direct
- type: out
+ picking_type_id: 1
-
I need to check the availability of the product, So I make my picking order for processing later.
-
!python {model: stock.picking}: |
- self.draft_force_assign(cr, uid, [ref("stock_picking_out001")], {"lang": "en_US", "search_default_available":
- 1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
- "active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
- })
+ self.action_confirm(cr, uid, [ref('stock_picking_out001')], context=context)
+
-
I check the product availability, Product is available in the stock and ready to be sent.
-
!python {model: stock.picking}: |
- self.action_assign(cr, uid, [ref("stock_picking_out001")], {"lang": "en_US", "search_default_available":
- 1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
- "active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
- })
+ self.action_confirm(cr, uid, [ref('stock_picking_out001')], context=context)
+
-
I process the delivery.
-
- !python {model: stock.partial.picking}: |
- partial_id = self.create(cr, uid, {}, context={'active_model':'stock.picking','active_ids':[ref('stock_picking_out001')]})
- self.do_partial(cr, uid, [partial_id])
+ !python {model: stock.picking}: |
+ order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001"))
+ pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001"))
+ for pick in pick_order.picking_ids:
+ self.pool.get('stock.pack.operation').create(cr, uid, {
+ 'picking_id': pick.id,
+ 'product_qty': 1
+ })
+ pick.do_partial(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
-
From ea891054bc7ea9e5de6bd759edbcccf6fef16928 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Tue, 13 Aug 2013 12:57:14 +0530
Subject: [PATCH 02/35] [IMP] improve anglo_saxon_yml
bzr revid: rma@tinyerp.com-20130813072714-7apay9hbt5m0ja6o
---
addons/account_anglo_saxon/test/anglo_saxon.yml | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml
index 77dc05836bc..ecb5d291535 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon.yml
@@ -202,7 +202,7 @@
product_uom: product.product_uom_unit
location_dest_id: stock.stock_location_customers
move_type: direct
- picking_type_id: 1
+ picking_type_id: self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context).id
-
I need to check the availability of the product, So I make my picking order for processing later.
-
@@ -213,20 +213,21 @@
I check the product availability, Product is available in the stock and ready to be sent.
-
!python {model: stock.picking}: |
- self.action_confirm(cr, uid, [ref('stock_picking_out001')], context=context)
+ picking = self.browse(cr, uid, ref("stock_picking_out001"))
+ assert picking.state == "confirmed", "Picking should be confirmed."
+ for move_line in picking.move_lines:
+ assert move_line.state == "confirmed", "Move should be confirmed."
-
I process the delivery.
-
!python {model: stock.picking}: |
- order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001"))
pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001"))
- for pick in pick_order.picking_ids:
- self.pool.get('stock.pack.operation').create(cr, uid, {
- 'picking_id': pick.id,
- 'product_qty': 1
+ self.pool.get('stock.pack.operation').create(cr, uid, {
+ 'picking_id': pick_order.id,
+ 'product_qty': 1
})
- pick.do_partial(context=context)
+ pick_order.do_partial(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
-
From b46d71d2b3ff56ce8c1ab9238e57caf511a5c8a2 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Tue, 13 Aug 2013 15:07:15 +0530
Subject: [PATCH 03/35] [IMP] make changes in acc_anglo_saxon_lifo
bzr revid: rma@tinyerp.com-20130813093715-mqgkxfd8suxy9nye
---
.../account_anglo_saxon/test/anglo_saxon.yml | 2 +-
.../test/anglo_saxon_avg_fifo.yml | 38 ++++++++++---------
.../wizard/stock_invoice.py | 2 +-
3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml
index ecb5d291535..73034497d14 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon.yml
@@ -202,7 +202,7 @@
product_uom: product.product_uom_unit
location_dest_id: stock.stock_location_customers
move_type: direct
- picking_type_id: self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context).id
+ picking_type_id: 1
-
I need to check the availability of the product, So I make my picking order for processing later.
-
diff --git a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
index f7d52f4f5a8..387f9bce715 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
@@ -131,10 +131,14 @@
-
Reception is ready for process so now done the reception.
-
- !python {model: stock.partial.picking}: |
- pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001_fifo")).picking_ids
- partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
+ !python {model: stock.picking}: |
+ order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001_fifo"))
+ for pick in order.picking_ids:
+ self.pool.get('stock.pack.operation').create(cr, uid, {
+ 'picking_id': pick.id,
+ 'product_qty': 1
+ })
+ pick.do_partial(context=context)
-
I check the Stock Interim account (Received) is credit successfully.
-
@@ -192,7 +196,6 @@
-
!record {model: stock.picking, id: stock_picking_out001_fifo}:
partner_id: base.res_partner_13
- invoice_state: 2binvoiced
move_lines:
- company_id: base.main_company
location_id: stock.stock_location_stock
@@ -200,29 +203,30 @@
product_qty: 1.0
location_dest_id: stock.stock_location_customers
move_type: direct
- type: out
+ picking_type_id: 1
-
I need to check the availability of the product, So I make my picking order for processing later.
-
!python {model: stock.picking}: |
- self.draft_force_assign(cr, uid, [ref("stock_picking_out001_fifo")], {"lang": "en_US", "search_default_available":
- 1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
- "active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
- })
+ self.action_confirm(cr, uid, [ref('stock_picking_out001')], context=context)
-
I check the product availability, Product is available in the stock and ready to be sent.
-
!python {model: stock.picking}: |
- self.action_assign(cr, uid, [ref("stock_picking_out001_fifo")], {"lang": "en_US", "search_default_available":
- 1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner",
- "active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"),
- })
+ picking = self.browse(cr, uid, ref("stock_picking_out001"))
+ assert picking.state == "confirmed", "Picking should be confirmed."
+ for move_line in picking.move_lines:
+ assert move_line.state == "confirmed", "Move should be confirmed."
-
I process the delivery.
-
- !python {model: stock.partial.picking}: |
- partial_id = self.create(cr, uid, {}, context={'active_model':'stock.picking','active_ids':[ref('stock_picking_out001_fifo')]})
- self.do_partial(cr, uid, [partial_id])
+ !python {model: stock.picking}: |
+ pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001_fifo"))
+ self.pool.get('stock.pack.operation').create(cr, uid, {
+ 'picking_id': pick_order.id,
+ 'product_qty': 1
+ })
+ pick_order.do_partial(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
-
diff --git a/addons/stock_invoice_directly/wizard/stock_invoice.py b/addons/stock_invoice_directly/wizard/stock_invoice.py
index ba41de626da..171eda3d5ab 100644
--- a/addons/stock_invoice_directly/wizard/stock_invoice.py
+++ b/addons/stock_invoice_directly/wizard/stock_invoice.py
@@ -22,7 +22,7 @@
from openerp.osv import fields, osv
class invoice_directly(osv.osv_memory):
- _inherit = 'stock.partial.picking'
+ _inherit = 'stock.picking'
def do_partial(self, cr, uid, ids, context=None):
"""Launch Create invoice wizard if invoice state is To be Invoiced,
From f8730cdf22d3624b589a9c049e6d815873046fb3 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Tue, 13 Aug 2013 15:43:28 +0530
Subject: [PATCH 04/35] [IMP] chnage picking_type_id
bzr revid: rma@tinyerp.com-20130813101328-f3qu81wr5yda69va
---
addons/account_anglo_saxon/test/anglo_saxon.yml | 2 +-
addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml
index 73034497d14..1223c9472d7 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon.yml
@@ -202,7 +202,7 @@
product_uom: product.product_uom_unit
location_dest_id: stock.stock_location_customers
move_type: direct
- picking_type_id: 1
+ picking_type_id: stock.picking_type_out
-
I need to check the availability of the product, So I make my picking order for processing later.
-
diff --git a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
index 387f9bce715..a98f6afc882 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
@@ -203,7 +203,7 @@
product_qty: 1.0
location_dest_id: stock.stock_location_customers
move_type: direct
- picking_type_id: 1
+ picking_type_id: stock.picking_type_out
-
I need to check the availability of the product, So I make my picking order for processing later.
-
From ade7b86291a0dfdefec2dc52468f368c272b9930 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Tue, 13 Aug 2013 17:09:24 +0530
Subject: [PATCH 05/35] [IMP] remove extra changes
bzr revid: rma@tinyerp.com-20130813113924-wwvchvxf131qtk3d
---
addons/stock_invoice_directly/wizard/stock_invoice.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/stock_invoice_directly/wizard/stock_invoice.py b/addons/stock_invoice_directly/wizard/stock_invoice.py
index 171eda3d5ab..ba41de626da 100644
--- a/addons/stock_invoice_directly/wizard/stock_invoice.py
+++ b/addons/stock_invoice_directly/wizard/stock_invoice.py
@@ -22,7 +22,7 @@
from openerp.osv import fields, osv
class invoice_directly(osv.osv_memory):
- _inherit = 'stock.picking'
+ _inherit = 'stock.partial.picking'
def do_partial(self, cr, uid, ids, context=None):
"""Launch Create invoice wizard if invoice state is To be Invoiced,
From dfeb8597fd2ee7d58c34fe3ebfdadd5047c089b8 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Wed, 14 Aug 2013 11:34:17 +0530
Subject: [PATCH 06/35] [IMP] remove stock.pack.operation opeartion on
do_partial
bzr revid: rma@tinyerp.com-20130814060417-b5rggizg5lgzsk2w
---
addons/account_anglo_saxon/test/anglo_saxon.yml | 14 ++------------
.../test/anglo_saxon_avg_fifo.yml | 13 ++-----------
2 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml
index 1223c9472d7..2dadc420e41 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon.yml
@@ -124,14 +124,8 @@
Reception is ready for process so now done the reception.
-
!python {model: stock.picking}: |
- order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001"))
- for pick in order.picking_ids:
- self.pool.get('stock.pack.operation').create(cr, uid, {
- 'picking_id': pick.id,
- 'product_qty': 1
- })
- pick.do_partial(context=context)
-
+ order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001")).picking_ids[0]
+ order.do_partial(context=context)
-
I check the Stock Interim account (Received) is credited successfully.
-
@@ -223,10 +217,6 @@
-
!python {model: stock.picking}: |
pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001"))
- self.pool.get('stock.pack.operation').create(cr, uid, {
- 'picking_id': pick_order.id,
- 'product_qty': 1
- })
pick_order.do_partial(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
diff --git a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
index a98f6afc882..4e9eb5d3738 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
@@ -132,13 +132,8 @@
Reception is ready for process so now done the reception.
-
!python {model: stock.picking}: |
- order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001_fifo"))
- for pick in order.picking_ids:
- self.pool.get('stock.pack.operation').create(cr, uid, {
- 'picking_id': pick.id,
- 'product_qty': 1
- })
- pick.do_partial(context=context)
+ order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001_fifo")).picking_ids[0]
+ order.do_partial(context=context)
-
I check the Stock Interim account (Received) is credit successfully.
-
@@ -222,10 +217,6 @@
-
!python {model: stock.picking}: |
pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001_fifo"))
- self.pool.get('stock.pack.operation').create(cr, uid, {
- 'picking_id': pick_order.id,
- 'product_qty': 1
- })
pick_order.do_partial(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
From 4af5d29679589d6b79608b17ccdcf8735a060c6c Mon Sep 17 00:00:00 2001
From: "Mansi Kariya (OpenERP Trainee)"
Date: Wed, 14 Aug 2013 17:55:54 +0530
Subject: [PATCH 07/35] [IMP] Added a product and sale order.
bzr revid: mansi.mk.179@gmail.com-20130814122554-dkjy8vjnmeibzqeu
---
.../sale_stock/test/prepaid_order_policy.yml | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/addons/sale_stock/test/prepaid_order_policy.yml b/addons/sale_stock/test/prepaid_order_policy.yml
index e35a9a82cf9..38652cb165d 100644
--- a/addons/sale_stock/test/prepaid_order_policy.yml
+++ b/addons/sale_stock/test/prepaid_order_policy.yml
@@ -1,12 +1,27 @@
+-
+ In order to test the Prepaid Order Policy, I create a product
+-
+ !record {model: product.product, id: product_prepaid1}:
+ name: 'OpenERP Documentation Book'
+ list_price: 60.60
+-
+ Now i create a sale order that uses my new product
+-
+ !record {model: sale.order, id: sale_order_prepaid1}:
+ partner_id: base.res_partner_2
+ order_policy: prepaid
+ order_line:
+ - product_id: sale_stock.product_prepaid1
+ product_uom_qty: 10
-
Now I confirm the Quotation with "Pay before delivery" policy.
-
- !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_4}
+ !workflow {model: sale.order, action: order_confirm, ref: sale_order_prepaid1}
-
I check that delivery order should not created before invoice is paid.
-
!python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("sale.sale_order_4"))
+ sale_order = self.browse(cr, uid, ref("sale_order_prepaid1"))
assert len(sale_order.picking_ids) == False, "Delivery order should not created before invoice."
assert sale_order.invoice_ids, "Invoice should be created."
From 592475349ab606b1bf758f94def99246b807d135 Mon Sep 17 00:00:00 2001
From: "Jitendra Prajapati (OpenERP)"
Date: Fri, 16 Aug 2013 12:33:09 +0530
Subject: [PATCH 08/35] [IMP]improve rfq2order2done yml
bzr revid: prajapatijitendra7969@gmail.com-20130816070309-k1rj401ltvxbkv93
---
addons/purchase/test/process/rfq2order2done.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/addons/purchase/test/process/rfq2order2done.yml b/addons/purchase/test/process/rfq2order2done.yml
index ff9158b3c09..8a8dd946c92 100644
--- a/addons/purchase/test/process/rfq2order2done.yml
+++ b/addons/purchase/test/process/rfq2order2done.yml
@@ -45,10 +45,10 @@
-
Reception is ready for process so now done the reception.
-
- !python {model: stock.partial.picking}: |
+ !python {model: stock.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_1")).picking_ids
- partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
+ self.do_prepare_partial(cr, uid, [pick_ids[0].id], context=context)
+ self.do_partial(cr, uid, [pick_ids[0].id], context=context)
-
I check that purchase order is shipped.
-
From 02aef6ff11218a66d366b0fa28a114e0945f5db5 Mon Sep 17 00:00:00 2001
From: "Bharat R. Devnani (OpenERP)"
Date: Mon, 19 Aug 2013 11:36:09 +0530
Subject: [PATCH 09/35] [IMP] improved according to new wms
bzr revid: bde@tinyerp.com-20130819060609-blgi8tornvbfztg4
---
.../sale_stock/test/picking_order_policy.yml | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml
index e28b4b066d4..22e26f706b7 100644
--- a/addons/sale_stock/test/picking_order_policy.yml
+++ b/addons/sale_stock/test/picking_order_policy.yml
@@ -31,15 +31,15 @@
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
order = self.browse(cr, uid, ref("sale.sale_order_6"))
for order_line in order.order_line:
- procurement = order_line.procurement_id
- sale_order_date = self.date_to_datetime(cr, uid, order.date_order, context)
- date_planned = datetime.strptime(sale_order_date, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
+ procurements = order_line.procurement_ids
+ date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
- assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
- assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
- assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
- assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
- assert procurement.procure_method == order_line.type, "Procurement method is not correspond."
+ for procurement in procurements:
+ assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
+ assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
+ assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
+ assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
+ assert procurement.move_dest_id.procure_method == order_line.type, "Procurement method is not correspond."
-
I run the scheduler.
-
@@ -57,7 +57,7 @@
for picking in sale_order.picking_ids:
assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state."
assert picking.origin == sale_order.name,"Origin of Delivery order is not correspond with sequence number of sale order."
- assert picking.type == 'out',"Shipment should be Outgoing."
+ assert picking.picking_type_id == self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context),"Shipment should be Outgoing."
assert picking.move_type == sale_order.picking_policy,"Delivery Method is not corresponding with delivery method of sale order."
assert picking.partner_id.id == sale_order.partner_shipping_id.id,"Shipping Address is not correspond with sale order."
assert picking.note == sale_order.note,"Note is not correspond with sale order."
@@ -66,7 +66,7 @@
location_id = sale_order.warehouse_id.lot_stock_id.id
output_id = sale_order.warehouse_id.lot_output_id.id
for move in picking.move_lines:
- order_line = move.sale_line_id
+ order_line = move.procurement_id.sale_line_id
sale_order_date = self.date_to_datetime(cr, uid, sale_order.date_order, context)
date_planned = datetime.strptime(sale_order_date, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
date_planned = (date_planned - timedelta(days=sale_order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
@@ -84,13 +84,12 @@
-
Now, I dispatch delivery order.
-
- !python {model: stock.partial.picking}: |
+ !python {model: stock.picking}: |
order = self.pool.get('sale.order').browse(cr, uid, ref("sale.sale_order_6"))
for pick in order.picking_ids:
data = pick.force_assign()
if data == True:
- partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
- self.do_partial(cr, uid, [partial_id])
+ pick.do_partial(context=context)
-
I check sale order to verify shipment.
-
From 735692618065cba85e7453350d36c794402acf85 Mon Sep 17 00:00:00 2001
From: "Bharat R. Devnani (OpenERP)"
Date: Mon, 19 Aug 2013 11:56:08 +0530
Subject: [PATCH 10/35] [ADD] added parameters in various methods in order to
get proper output for picking-order-policy-yml test cases of sale_stock
module
bzr revid: bde@tinyerp.com-20130819062608-o51cjq7s4ayhsttx
---
addons/sale/sale.py | 2 +-
addons/stock/procurement.py | 2 ++
addons/stock/stock.py | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index b55fccc8984..f733cfd9ff1 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -658,7 +658,7 @@ class sale_order(osv.osv):
for order in self.browse(cr, uid, ids, context=context):
proc_ids = []
group_id = self.pool.get("procurement.group").create(cr, uid, {
- 'name': order.name, 'partner_id': order.partner_shipping_id.id
+ 'name': order.name, 'partner_id': order.partner_shipping_id.id, 'move_type': order.picking_policy
}, context=context)
order.write({'procurement_group_id': group_id}, context=context)
for line in order.order_line:
diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py
index 7f36871b9d1..4eeca78e0a1 100644
--- a/addons/stock/procurement.py
+++ b/addons/stock/procurement.py
@@ -86,6 +86,7 @@ class procurement_order(osv.osv):
'rule_id': procurement.rule_id.id,
'origin': procurement.origin,
'picking_type_id': procurement.rule_id.picking_type_id.id,
+ 'price_unit': procurement.sale_line_id.product_id.standard_price
}
def _run(self, cr, uid, procurement, context=None):
@@ -96,6 +97,7 @@ class procurement_order(osv.osv):
move_obj = self.pool.get('stock.move')
move_dict = self._run_move_create(cr, uid, procurement, context=context)
move_id = move_obj.create(cr, uid, move_dict, context=context)
+ self.write(cr, uid, procurement.id, {'move_dest_id': move_id}, context=context)
move_obj.action_confirm(cr, uid, [move_id], context=context)
return move_id
return super(procurement_order, self)._run(cr, uid, procurement, context)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 2dff89acfa2..af8e418002c 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1212,6 +1212,7 @@ class stock_move(osv.osv):
'state': 'confirmed',
'group_id': move.group_id and move.group_id.id or False,
'picking_type_id': move.picking_type_id and move.picking_type_id.id or False,
+ 'move_lines': [(6, 0, [move.id])]
}
pick = pick_obj.create(cr, uid, values, context=context)
move.write({'picking_id': pick})
From 64fee2e674ac8484fc8f8e1021ee8ecb63911f3b Mon Sep 17 00:00:00 2001
From: "Bharat R. Devnani (OpenERP)"
Date: Wed, 21 Aug 2013 10:55:28 +0530
Subject: [PATCH 11/35] [IMP] value of invoice.comment should be blank if value
is False
bzr revid: bde@tinyerp.com-20130821052528-wfo71cmpwcu1593r
---
addons/sale_stock/test/picking_order_policy.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml
index 22e26f706b7..bdad1424b2a 100644
--- a/addons/sale_stock/test/picking_order_policy.yml
+++ b/addons/sale_stock/test/picking_order_policy.yml
@@ -122,7 +122,7 @@
assert invoice.reference == order.client_order_ref or order.name,"Reference is not correspond."
assert invoice.partner_id.id == order.partner_invoice_id.id,"Customer does not correspond."
assert invoice.currency_id.id == order.pricelist_id.currency_id.id, "Currency is not correspond."
- assert invoice.comment == (order.note or ''),"Note is not correspond."
+ assert (invoice.comment or '') == (order.note or ''),"Note is not correspond."
assert invoice.journal_id.id in journal_ids,"Sales Journal is not link on Invoice."
assert invoice.payment_term.id == order.payment_term.id, "Payment term is not correspond."
for so_line in order.order_line:
From 0d3437e753cc4b4b9a42508efc7c8ea6435d13ea Mon Sep 17 00:00:00 2001
From: "Bharat R. Devnani (OpenERP)"
Date: Wed, 21 Aug 2013 11:12:53 +0530
Subject: [PATCH 12/35] [IMP] As the system creates one procurement per sale
order line so checked the assert statements without for loop for procurements
bzr revid: bde@tinyerp.com-20130821054253-kbtjbyosjukc9con
---
addons/sale_stock/test/picking_order_policy.yml | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml
index bdad1424b2a..3cefc8e2529 100644
--- a/addons/sale_stock/test/picking_order_policy.yml
+++ b/addons/sale_stock/test/picking_order_policy.yml
@@ -31,15 +31,14 @@
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
order = self.browse(cr, uid, ref("sale.sale_order_6"))
for order_line in order.order_line:
- procurements = order_line.procurement_ids
+ procurement = order_line.procurement_ids[0]
date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
- for procurement in procurements:
- assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
- assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
- assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
- assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
- assert procurement.move_dest_id.procure_method == order_line.type, "Procurement method is not correspond."
+ assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
+ assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
+ assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
+ assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
+ assert procurement.move_dest_id.procure_method == order_line.type, "Procurement method is not correspond."
-
I run the scheduler.
-
From b1139e0affd5635e5592cf3ded77ad63a9a9c87a Mon Sep 17 00:00:00 2001
From: "Jitendra Prajapati (OpenERP)"
Date: Thu, 22 Aug 2013 12:16:18 +0530
Subject: [PATCH 13/35] [IMP]improve rfq2order2done yml
bzr revid: prajapatijitendra7969@gmail.com-20130822064618-l03lwozp4d6fth5p
---
addons/purchase/test/process/rfq2order2done.yml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/addons/purchase/test/process/rfq2order2done.yml b/addons/purchase/test/process/rfq2order2done.yml
index 8a8dd946c92..a6999686026 100644
--- a/addons/purchase/test/process/rfq2order2done.yml
+++ b/addons/purchase/test/process/rfq2order2done.yml
@@ -46,9 +46,8 @@
Reception is ready for process so now done the reception.
-
!python {model: stock.picking}: |
- pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_1")).picking_ids
- self.do_prepare_partial(cr, uid, [pick_ids[0].id], context=context)
- self.do_partial(cr, uid, [pick_ids[0].id], context=context)
+ pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_1")).picking_ids[0]
+ pick_ids.do_partial(context=context)
-
I check that purchase order is shipped.
-
From 67bcf36f137c2834965f9b55350db174b7c96b04 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Thu, 22 Aug 2013 18:21:50 +0530
Subject: [PATCH 14/35] [IMP] place lifo_price yml into complex_routs and make
changes
bzr revid: rma@tinyerp.com-20130822125150-zdj1lo96axkwor0e
---
addons/purchase/__openerp__.py | 28 +++++++-------
addons/stock_complex_routes/__openerp__.py | 2 +-
.../test/lifo_price.yml | 37 +++++++++++--------
3 files changed, 37 insertions(+), 30 deletions(-)
rename addons/{purchase => stock_complex_routes}/test/lifo_price.yml (76%)
diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py
index 56512be09da..36df07a95bd 100644
--- a/addons/purchase/__openerp__.py
+++ b/addons/purchase/__openerp__.py
@@ -67,20 +67,20 @@ Dashboard / Reports for Purchase Management will include:
'res_config_view.xml',
],
'test': [
- 'test/fifo_price.yml',
- 'test/fifo_returns.yml',
- #'test/costmethodchange.yml',
- 'test/process/cancel_order.yml',
- 'test/process/rfq2order2done.yml',
- 'test/process/generate_invoice_from_reception.yml',
- 'test/process/run_scheduler.yml',
- 'test/process/merge_order.yml',
- 'test/process/edi_purchase_order.yml',
- 'test/process/invoice_on_poline.yml',
- 'test/ui/print_report.yml',
- 'test/ui/duplicate_order.yml',
- 'test/ui/delete_order.yml',
- 'test/average_price.yml',
+# 'test/fifo_price.yml',
+# 'test/fifo_returns.yml',
+# #'test/costmethodchange.yml',
+# 'test/process/cancel_order.yml',
+# 'test/process/rfq2order2done.yml',
+# 'test/process/generate_invoice_from_reception.yml',
+# 'test/process/run_scheduler.yml',
+# 'test/process/merge_order.yml',
+# 'test/process/edi_purchase_order.yml',
+# 'test/process/invoice_on_poline.yml',
+# 'test/ui/print_report.yml',
+# 'test/ui/duplicate_order.yml',
+# 'test/ui/delete_order.yml',
+# 'test/average_price.yml',
'test/lifo_price.yml',
],
'demo': [
diff --git a/addons/stock_complex_routes/__openerp__.py b/addons/stock_complex_routes/__openerp__.py
index 5426e2c7aca..c9bdff7c7a8 100644
--- a/addons/stock_complex_routes/__openerp__.py
+++ b/addons/stock_complex_routes/__openerp__.py
@@ -38,7 +38,7 @@ This adds a route on the sales order and sales order line (mini module)
'init_xml': [],
'update_xml': ['stock_complex_routes.xml'],
'demo_xml': [],
- 'test': [],
+ 'test': ['lifo_price.yml'],
'installable': True,
'auto_install': True,
}
diff --git a/addons/purchase/test/lifo_price.yml b/addons/stock_complex_routes/test/lifo_price.yml
similarity index 76%
rename from addons/purchase/test/lifo_price.yml
rename to addons/stock_complex_routes/test/lifo_price.yml
index ea30317b996..5c3aa5bb3b6 100644
--- a/addons/purchase/test/lifo_price.yml
+++ b/addons/stock_complex_routes/test/lifo_price.yml
@@ -1,8 +1,15 @@
+-
+ For check product removal create removal strategy "LIFO"
+-
+ !record {model: product.removal, id: product_removal_lifo}:
+ product_categ_id: product.product_category_1
+ method: lifo
+ location_id: stock.stock_location_stock
-
- Set product category removal strategy as LIFO
+ Set product category removal strategy as LIFO
-
!record {model: product.category, id: product.product_category_1}:
- removal_strategy: lifo
+ removal_strategy_ids: product_removal_lifo
-
Set a product as using lifo price
-
@@ -58,10 +65,9 @@
-
Process the reception of purchase order 1
-
- !python {model: stock.partial.picking}: |
- pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo1")).picking_ids
- partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
+ !python {model: stock.picking}: |
+ order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo1")).picking_ids[0]
+ order.do_partial(context=context)
-
Check the standard price of the product (lifo icecream)
-
@@ -74,10 +80,9 @@
-
Process the reception of purchase order 2
-
- !python {model: stock.partial.picking}: |
- pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo2")).picking_ids
- partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
+ !python {model: stock.picking}: |
+ order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo2")).picking_ids[0]
+ order.do_partial(context=context)
-
Check the standard price should not have changed
-
@@ -87,7 +92,7 @@
Let us send some goods
-
!record {model: stock.picking, id: outgoing_lifo_shipment}:
- type: out
+ picking_type_id: stock.picking_type_out
-
Picking needs movement from stock
-
@@ -95,8 +100,10 @@
picking_id: outgoing_lifo_shipment
product_id: product_lifo_icecream
product_uom: product.product_uom_kgm
+ location_id: stock.stock_location_stock
+ location_dest_id: stock.stock_location_customers
product_qty: 20.0
- type: out
+ picking_type_id: stock.picking_type_out
-
I assign this outgoing shipment
-
@@ -105,9 +112,9 @@
-
Process the delivery of the outgoing shipment
-
- !python {model: stock.partial.picking}: |
- partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_lifo_shipment")], 'default_type':'out'})
- self.do_partial(cr, uid, [partial_id])
+ !python {model: stock.picking}: |
+ pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_lifo_shipment"))
+ pick_order.do_partial(context=context)
-
Check standard price became 80 euro
-
From 15ac070679805fc4834d5d3bba30114e9b2f2218 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Fri, 23 Aug 2013 12:20:53 +0530
Subject: [PATCH 15/35] [IMP] improve code for lifo_price_yml
bzr revid: rma@tinyerp.com-20130823065053-phiq6p3tccck61fv
---
addons/stock_complex_routes/__openerp__.py | 2 +-
addons/stock_complex_routes/test/lifo_price.yml | 15 ++++++---------
addons/stock_location/stock_location.py | 2 +-
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/addons/stock_complex_routes/__openerp__.py b/addons/stock_complex_routes/__openerp__.py
index c9bdff7c7a8..872f42d98b5 100644
--- a/addons/stock_complex_routes/__openerp__.py
+++ b/addons/stock_complex_routes/__openerp__.py
@@ -38,7 +38,7 @@ This adds a route on the sales order and sales order line (mini module)
'init_xml': [],
'update_xml': ['stock_complex_routes.xml'],
'demo_xml': [],
- 'test': ['lifo_price.yml'],
+ 'test': ['test/lifo_price.yml'],
'installable': True,
'auto_install': True,
}
diff --git a/addons/stock_complex_routes/test/lifo_price.yml b/addons/stock_complex_routes/test/lifo_price.yml
index 5c3aa5bb3b6..8365eb79f48 100644
--- a/addons/stock_complex_routes/test/lifo_price.yml
+++ b/addons/stock_complex_routes/test/lifo_price.yml
@@ -1,15 +1,12 @@
--
- For check product removal create removal strategy "LIFO"
--
- !record {model: product.removal, id: product_removal_lifo}:
- product_categ_id: product.product_category_1
- method: lifo
- location_id: stock.stock_location_stock
-
Set product category removal strategy as LIFO
-
- !record {model: product.category, id: product.product_category_1}:
- removal_strategy_ids: product_removal_lifo
+ !record {model: product.category, id: product.product_category_001}:
+ name : Lifo Category
+ removal_strategy_ids:
+ - product_categ_id: product.product_category_1
+ method: lifo
+ location_id: stock.stock_location_stock
-
Set a product as using lifo price
-
diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py
index 7f27496ff0d..8a389721733 100644
--- a/addons/stock_location/stock_location.py
+++ b/addons/stock_location/stock_location.py
@@ -215,7 +215,7 @@ class product_category(osv.osv):
_inherit = 'product.category'
_columns = {
'route_ids': fields.many2many('stock.location.route', 'stock_location_route_categ', 'categ_id', 'route_id', 'Routes'),
- #'removal_strategy_ids': fields.one2many('product.removal', 'product_categ_id', 'Removal Strategies'),
+ 'removal_strategy_ids': fields.one2many('product.removal', 'product_categ_id', 'Removal Strategies'),
#'putaway_strategy_ids': fields.one2many('product.putaway', 'product_categ_id', 'Put Away Strategies'),
}
From a6cc542eef21107792c154d59903189f46a05997 Mon Sep 17 00:00:00 2001
From: "Bharat R. Devnani (OpenERP)"
Date: Fri, 23 Aug 2013 15:10:20 +0530
Subject: [PATCH 16/35] [IMP] run the scheduler after picking is done
bzr revid: bde@tinyerp.com-20130823094020-gacp65206rn8mxzv
---
addons/sale_stock/test/picking_order_policy.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/addons/sale_stock/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml
index 0f63a16a335..f903d160400 100644
--- a/addons/sale_stock/test/picking_order_policy.yml
+++ b/addons/sale_stock/test/picking_order_policy.yml
@@ -39,11 +39,6 @@
assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
assert procurement.move_ids[0].procure_method == order_line.type, "Procurement method is not correspond."
--
- I run the scheduler.
--
- !python {model: procurement.order}: |
- self.run_scheduler(cr, uid)
-
I check the details of delivery order after confirmed quotation.
-
@@ -88,6 +83,11 @@
data = pick.force_assign()
if data == True:
pick.do_partial(context=context)
+-
+ I run the scheduler.
+-
+ !python {model: procurement.order}: |
+ self.run_scheduler(cr, uid)
-
I check sale order to verify shipment.
-
From 290af983bc110f8f2fc4da167d89857bfadb25a0 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Fri, 23 Aug 2013 15:40:39 +0530
Subject: [PATCH 17/35] [IMP] remove extra changes
bzr revid: rma@tinyerp.com-20130823101039-ibhn7qz3t3ta288g
---
addons/purchase/__openerp__.py | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py
index 36df07a95bd..56512be09da 100644
--- a/addons/purchase/__openerp__.py
+++ b/addons/purchase/__openerp__.py
@@ -67,20 +67,20 @@ Dashboard / Reports for Purchase Management will include:
'res_config_view.xml',
],
'test': [
-# 'test/fifo_price.yml',
-# 'test/fifo_returns.yml',
-# #'test/costmethodchange.yml',
-# 'test/process/cancel_order.yml',
-# 'test/process/rfq2order2done.yml',
-# 'test/process/generate_invoice_from_reception.yml',
-# 'test/process/run_scheduler.yml',
-# 'test/process/merge_order.yml',
-# 'test/process/edi_purchase_order.yml',
-# 'test/process/invoice_on_poline.yml',
-# 'test/ui/print_report.yml',
-# 'test/ui/duplicate_order.yml',
-# 'test/ui/delete_order.yml',
-# 'test/average_price.yml',
+ 'test/fifo_price.yml',
+ 'test/fifo_returns.yml',
+ #'test/costmethodchange.yml',
+ 'test/process/cancel_order.yml',
+ 'test/process/rfq2order2done.yml',
+ 'test/process/generate_invoice_from_reception.yml',
+ 'test/process/run_scheduler.yml',
+ 'test/process/merge_order.yml',
+ 'test/process/edi_purchase_order.yml',
+ 'test/process/invoice_on_poline.yml',
+ 'test/ui/print_report.yml',
+ 'test/ui/duplicate_order.yml',
+ 'test/ui/delete_order.yml',
+ 'test/average_price.yml',
'test/lifo_price.yml',
],
'demo': [
From b412701b94e016c78d31120e94703a0fc3c86d61 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Fri, 23 Aug 2013 15:43:59 +0530
Subject: [PATCH 18/35] [IMP] improve code
bzr revid: rma@tinyerp.com-20130823101359-989r7eriohaey3xo
---
addons/stock_complex_routes/test/lifo_price.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/stock_complex_routes/test/lifo_price.yml b/addons/stock_complex_routes/test/lifo_price.yml
index 8365eb79f48..4bf1922c251 100644
--- a/addons/stock_complex_routes/test/lifo_price.yml
+++ b/addons/stock_complex_routes/test/lifo_price.yml
@@ -1,7 +1,7 @@
-
Set product category removal strategy as LIFO
-
- !record {model: product.category, id: product.product_category_001}:
+ !record {model: product.category, id: product.product_category_001}:
name : Lifo Category
removal_strategy_ids:
- product_categ_id: product.product_category_1
From 457d7f278e963a3eec9390b4888b18e8a563349a Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Mon, 26 Aug 2013 11:45:03 +0530
Subject: [PATCH 19/35] [IMP] change action_invoice_create method
bzr revid: rma@tinyerp.com-20130826061503-4r9lv7ywbhfffikj
---
.../test/process/generate_invoice_from_reception.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/addons/purchase/test/process/generate_invoice_from_reception.yml b/addons/purchase/test/process/generate_invoice_from_reception.yml
index 6390413b418..37cf615c6ec 100644
--- a/addons/purchase/test/process/generate_invoice_from_reception.yml
+++ b/addons/purchase/test/process/generate_invoice_from_reception.yml
@@ -11,9 +11,9 @@
-
Now I create an invoice for order on reception.
-
- !python {model: stock.picking}: |
- pick_ids = self.search(cr, uid, [('purchase_id','=',ref('purchase_order_2'))])
- self.action_invoice_create(cr, uid, pick_ids, ref('account.expenses_journal'))
+ !python {model: purchase.order}: |
+ pick_ids = [self.browse(cr, uid, ref("purchase_order_2")).id]
+ self.action_invoice_create(cr, uid, pick_ids)
-
I check that the invoice of order.
-
From c21e07a303e7f3037b69b296b3ddadaff7fb5c74 Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Mon, 26 Aug 2013 12:32:24 +0200
Subject: [PATCH 20/35] [IMP] Remaining qty and store of reservation_id +
do_reserve for button
bzr revid: jco@openerp.com-20130826103224-2k224ekqtpzx920y
---
addons/stock/stock.py | 39 +++++++++++++++++++++++++++++--------
addons/stock/stock_view.xml | 4 ++--
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index f4be5ee0bfa..f40e4e7a806 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -318,8 +318,22 @@ class stock_quant(osv.osv):
def _price_update(self, cr, uid, quant, newprice, context=None):
self.write(cr, uid, [quant.id], {'cost': newprice}, context=context)
+ def write(self, cr, uid, ids, vals, context=None):
+ #We want to trigger the move with nothing on reserved_quant_ids for the store of the remaining quantity
+ if 'reservation_id' in vals:
+ reservation_ids = self.browse(cr, uid, ids, context=context)
+ moves_to_warn = set()
+ for reser in reservation_ids:
+ if reser.reservation_id:
+ moves_to_warn.add(reser.reservation_id.id)
+ self.pool.get('stock.move').write(cr, uid, list(moves_to_warn), {'reserved_quant_ids': []}, context=context)
+ return super(stock_quant, self).write(cr, uid, ids, vals, context=context)
+
def quants_unreserve(self, cr, uid, move, context=None):
- cr.execute('update stock_quant set reservation_id=NULL where reservation_id=%s', (move.id,))
+ #cr.execute('update stock_quant set reservation_id=NULL where reservation_id=%s', (move.id,))
+ #need write for related store of remaining qty
+ related_quants = self.search(cr, uid, [('reservation_id', '=', move.id)], context=context)
+ self.write(cr, uid, related_quants, {'reservation_id': False}, context=context)
return True
#
@@ -684,6 +698,13 @@ class stock_picking(osv.osv):
moves.append(move)
return moves
+ def do_rereserve(self, cr, uid, picking_ids, context=None):
+ '''
+ Needed for parameter create
+ '''
+ self.rereserve(cr, uid, picking_ids, context=context)
+
+
def rereserve(self, cr, uid, picking_ids, create=False, context=None):
"""
This will unreserve all products and reserve the quants from the operations
@@ -704,6 +725,7 @@ class stock_picking(osv.osv):
for ops in picking.pack_operation_ids:
#Find moves that correspond
if ops.product_id:
+ #TODO: Should have order such that things with lots and packings are searched first
move_ids = move_obj.search(cr, uid, [('picking_id','=',picking.id), ('product_id', '=', ops.product_id.id), ('remaining_qty', '>', 0.0)], context=context)
qty_to_do = ops.product_qty
while qty_to_do > 0 and move_ids:
@@ -1112,7 +1134,8 @@ class stock_move(osv.osv):
'reserved_quant_ids': fields.one2many('stock.quant', 'reservation_id', 'Reserved quants'),
'remaining_qty': fields.function(_get_remaining_qty, type='float', string='Remaining Quantity',
digits_compute=dp.get_precision('Product Unit of Measure'), states={'done': [('readonly', True)]},
- store = {'stock.quant': (_get_move, ['reservation_id'], 10)}),
+ store = {'stock.move': (lambda self, cr, uid, ids, c={}: ids , ['product_qty', 'product_uom', 'reserved_quant_ids'], 10),
+ 'stock.quant': (_get_move, ['reservation_id'], 10)}),
'procurement_id': fields.many2one('procurement.order', 'Procurement'),
'group_id': fields.related('procurement_id', 'group_id', type='many2one', relation="procurement.group", string='Procurement Group'),
'rule_id': fields.many2one('procurement.rule', 'Procurement Rule'),
@@ -2075,15 +2098,15 @@ class stock_pack_operation(osv.osv):
}
def _get_preferred_order(self, cr, uid, id, context=None):
- pack = self.browse(cr, uid, id, context=context)
+ ops = self.browse(cr, uid, id, context=context)
res = ""
- if pack.package_id:
- res += "package_id <> " + pack.package_id.id
- if pack.lot_id:
+ if ops.package_id:
+ res += "package_id <> " + str(ops.package_id.id)
+ if ops.lot_id:
if res:
- res += ", lot_id <> " + pack.lot_id.id
+ res += ", lot_id <> " + str(ops.lot_id.id)
else:
- res += "lot_id <> " + pack.lot_id.id
+ res += "lot_id <> " + str(ops.lot_id.id)
return res
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index c0c6ba97976..af3fa1153f4 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -583,7 +583,7 @@
-
+
@@ -804,7 +804,7 @@
-
+
From 56d0336f2cb8520e1921a92b8f8450e3f1d944bd Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Mon, 26 Aug 2013 13:51:17 +0200
Subject: [PATCH 21/35] [IMP] Adding price_unit on sales order line form
bzr revid: jco@openerp.com-20130826115117-xfdpc9h3jqokdxyp
---
addons/sale_stock_location/sale_stock_location_view.xml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/addons/sale_stock_location/sale_stock_location_view.xml b/addons/sale_stock_location/sale_stock_location_view.xml
index 0a8ad68f060..7fd0f1853b2 100644
--- a/addons/sale_stock_location/sale_stock_location_view.xml
+++ b/addons/sale_stock_location/sale_stock_location_view.xml
@@ -30,7 +30,10 @@
sale.order
-
+
+
+
+
From dc500465de96f216cd6e6238b76b42d3520bc672 Mon Sep 17 00:00:00 2001
From: "Randhir Mayatra (OpenERP)"
Date: Mon, 26 Aug 2013 17:45:05 +0530
Subject: [PATCH 22/35] [IMP] optimize code
bzr revid: rma@tinyerp.com-20130826121505-ags8sgw4ufixc9fl
---
addons/account_anglo_saxon/test/anglo_saxon.yml | 8 ++++----
addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/addons/account_anglo_saxon/test/anglo_saxon.yml b/addons/account_anglo_saxon/test/anglo_saxon.yml
index 2dadc420e41..3ea85fc0d73 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon.yml
@@ -124,8 +124,8 @@
Reception is ready for process so now done the reception.
-
!python {model: stock.picking}: |
- order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001")).picking_ids[0]
- order.do_partial(context=context)
+ picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001")).picking_ids[0]
+ picking_id.do_partial(context=context)
-
I check the Stock Interim account (Received) is credited successfully.
-
@@ -216,8 +216,8 @@
I process the delivery.
-
!python {model: stock.picking}: |
- pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001"))
- pick_order.do_partial(context=context)
+ picking = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001"))
+ picking.do_partial(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
-
diff --git a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
index 4e9eb5d3738..bb6200e148b 100644
--- a/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
+++ b/addons/account_anglo_saxon/test/anglo_saxon_avg_fifo.yml
@@ -132,8 +132,8 @@
Reception is ready for process so now done the reception.
-
!python {model: stock.picking}: |
- order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001_fifo")).picking_ids[0]
- order.do_partial(context=context)
+ picking_id = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_001_fifo")).picking_ids[0]
+ picking_id.do_partial(context=context)
-
I check the Stock Interim account (Received) is credit successfully.
-
@@ -216,8 +216,8 @@
I process the delivery.
-
!python {model: stock.picking}: |
- pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001_fifo"))
- pick_order.do_partial(context=context)
+ picking = self.pool.get('stock.picking').browse(cr, uid, ref("stock_picking_out001_fifo"))
+ picking.do_partial(context=context)
-
I check Stock Interim account (Delivery) is debited successfully.
-
From 9b1690ac56dff6513c424be88d94bf0dabb8dfca Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Mon, 26 Aug 2013 15:03:22 +0200
Subject: [PATCH 23/35] [IMP] Moves too many are processed, moves short go in
backorder. Needs refresh of picking for backorder
bzr revid: jco@openerp.com-20130826130322-bbk8yxdeug7o18dl
---
addons/stock/stock.py | 27 ++++-----------------------
1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index f40e4e7a806..c0c73d30603 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -786,9 +786,6 @@ class stock_picking(osv.osv):
If no pack operation, we close the whole move
Otherwise, do the pack operations
"""
- #TODO: this variable should be in argument
- quant_obj = self.pool.get('stock.quant')
- quant_package_obj = self.pool.get('stock.quant.package')
stock_move_obj = self.pool.get('stock.move')
for picking in self.browse(cr, uid, picking_ids, context=context):
if not picking.pack_operation_ids:
@@ -799,6 +796,7 @@ class stock_picking(osv.osv):
res = self.rereserve(cr, uid, [picking.id], create = True, context = context) #This time, quants need to be created
orig_moves = picking.move_lines
#Add moves that operations need extra
+ extra_moves = []
for ops in res[0].keys():
for prod in res[0][ops].keys():
product = self.pool.get('product.product').browse(cr, uid, prod, context=context)
@@ -817,31 +815,15 @@ class stock_picking(osv.osv):
'reserved_quant_ids': quant and [(4, quant.id)] or [],
'picking_type_id': picking.picking_type_id.id
}, context=context)
+ extra_moves.append(move_id)
res2 = res[1]
for move in res2.keys():
if res2[move] > 0:
mov = stock_move_obj.browse(cr, uid, move, context=context)
newmove_id = stock_move_obj.split(cr, uid, mov, res2[move], context=context)
-
- for move in orig_moves:
- stock_move_obj.action_done(cr, uid, [move.id], context=context)
- #TODO: op.package_id can not work as quants_get is not defined on quant package => gives traceback
-# if op.package_id:
-# for quant in quant_package_obj.browse(cr, uid, op.package_id.id, context=context).quant_ids:
-# self._do_partial_product_move(cr, uid, picking, quant.product_id, quant.qty, quant, context=context)
-# op.package_id.write(cr, uid, {
-# 'parent_id': op.result_package_id.id
-# }, context=context)
-# elif op.product_id:
-# moves = self._do_partial_product_move(cr, uid, picking, op.product_id, op.product_qty, op.quant_id, context=context)
-# quants = []
-# for m in moves:
-# for quant in m.quant_ids:
-# quants.append(quant.id)
-# quant_obj.write(cr, uid, quants, {
-# 'package_id': op.result_package_id.id
-# }, context=context)
+ stock_move_obj.action_done(cr, uid, extra_moves + [x.id for x in orig_moves], context=context)
+ picking.refresh()
self._create_backorder(cr, uid, picking, context=context)
return True
@@ -1482,7 +1464,6 @@ class stock_move(osv.osv):
"""
context = context or {}
quant_obj = self.pool.get("stock.quant")
- picking_obj = self.pool.get('stock.picking')
todo = [move.id for move in self.browse(cr, uid, ids, context=context) if move.state == "draft"]
if todo:
From ca1f4566b7c5ce8840a8b820424c18aa2bc962fe Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Mon, 26 Aug 2013 17:36:48 +0200
Subject: [PATCH 24/35] [IMP] Back order should not give traceback and
destination move should take quants from original move as reserved quants
into account for quantity to reserve when assigned.
bzr revid: jco@openerp.com-20130826153648-e7bxt0btvcsb1jun
---
addons/stock/stock.py | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index c0c73d30603..54f473f75c1 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -624,16 +624,18 @@ class stock_picking(osv.osv):
backorder_moves = picking.move_lines
backorder_move_ids = [x.id for x in backorder_moves if x.state not in ('done','cancel')]
- backorder_id = self.copy(cr, uid, picking.id, {
- 'name': '/',
- 'move_lines': [],
- 'pack_operation_ids': [],
- 'backorder_id': picking.id,
- })
- back_order_name = self.browse(cr, uid, backorder_id, context=context).name
- self.message_post(cr, uid, picking.id, body=_("Back order %screated.") % (back_order_name), context=context)
- self.pool.get('stock.move').write(cr, uid, backorder_move_ids, {'picking_id': backorder_id}, context=context)
- return backorder_id
+ if backorder_move_ids:
+ backorder_id = self.copy(cr, uid, picking.id, {
+ 'name': '/',
+ 'move_lines': [],
+ 'pack_operation_ids': [],
+ 'backorder_id': picking.id,
+ })
+ back_order_name = self.browse(cr, uid, backorder_id, context=context).name
+ self.message_post(cr, uid, picking.id, body=_("Back order %screated.") % (back_order_name), context=context)
+ self.pool.get('stock.move').write(cr, uid, backorder_move_ids, {'picking_id': backorder_id}, context=context)
+ return backorder_id
+ return False
def do_prepare_partial(self, cr, uid, picking_ids, context=None):
context = context or {}
@@ -1016,7 +1018,6 @@ class stock_move(osv.osv):
return res
-
def _get_lot_ids(self, cr, uid, ids, field_name, args, context=None):
res = dict.fromkeys(ids, False)
for move in self.browse(cr, uid, ids, context=context):
@@ -1419,6 +1420,7 @@ class stock_move(osv.osv):
for m2 in move.move_orig_ids:
for q in m2.quant_ids:
dp.append(str(q.id))
+ qty -= q.qty
domain = ['|', ('reservation_id', '=', False), ('reservation_id', '=', move.id)]
quants = quant_obj.quants_get(cr, uid, move.location_id, move.product_id, qty, domain=domain, prefered_order = dp and ('id not in ('+','.join(dp)+')') or False, context=context)
#Will only reserve physical quants, no negative
From efc01a8a8473dd5ad86e6c23f397c18e886bd00d Mon Sep 17 00:00:00 2001
From: "Pooja Zankhariya (OpenERP Trainee)"
Date: Tue, 27 Aug 2013 16:49:39 +0530
Subject: [PATCH 25/35] [IMP]Replaced type with picking_type_id
bzr revid: pooja.zakhariya@gmail.com-20130827111939-t7memjjkn08yhbum
---
addons/point_of_sale/point_of_sale.py | 2 +-
addons/point_of_sale/wizard/pos_return.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index 2782f822149..591f65cf925 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -700,7 +700,7 @@ class pos_order(osv.osv):
picking_id = picking_obj.create(cr, uid, {
'origin': order.name,
'partner_id': addr.get('delivery',False),
- 'type': 'out',
+ 'picking_type_id': self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context).id,
'company_id': order.company_id.id,
'move_type': 'direct',
'note': order.note or "",
diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py
index eeba6cab676..fac55c593e7 100644
--- a/addons/point_of_sale/wizard/pos_return.py
+++ b/addons/point_of_sale/wizard/pos_return.py
@@ -213,7 +213,7 @@ class add_product(osv.osv_memory):
'name':'%s (Added)' %order_id.name,
'move_lines':[],
'state':'draft',
- 'type':'out',
+ 'picking_type_id': self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context).id,
'date':date_cur
})
stock_move_obj.create(cr, uid, {
From ea3b868f4eebe0523669ea2d5b267a4e2f4399da Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Tue, 27 Aug 2013 15:33:24 +0200
Subject: [PATCH 26/35] [IMP] Destination routes in procurement view
bzr revid: jco@openerp.com-20130827133324-uqlja1012515uxx5
---
addons/stock_location/stock_location_view.xml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml
index 4846ac70644..c50a6ca8a94 100644
--- a/addons/stock_location/stock_location_view.xml
+++ b/addons/stock_location/stock_location_view.xml
@@ -211,5 +211,17 @@
+
+
+
+ procurement.order.form.view.inherit
+
+ procurement.order
+
+
+
+
+
+
From d1febb7b8e908f8de947e646c9562b09ef6d9cc9 Mon Sep 17 00:00:00 2001
From: Cedric Snauwaert
Date: Tue, 27 Aug 2013 17:25:28 +0200
Subject: [PATCH 27/35] [FIX]push/pull rules, picking type should be required
except for pull rule with type manufacture
bzr revid: csn@openerp.com-20130827152528-wm5m8zynlzjjfor9
---
addons/stock/procurement.py | 2 +-
addons/stock/stock_view.xml | 33 ++++++++++++++++++-
addons/stock_location/stock_location.py | 2 +-
addons/stock_location/stock_location_view.xml | 20 +++++++++++
4 files changed, 54 insertions(+), 3 deletions(-)
diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py
index 7f36871b9d1..392e65d1c91 100644
--- a/addons/stock/procurement.py
+++ b/addons/stock/procurement.py
@@ -40,7 +40,7 @@ class procurement_rule(osv.osv):
'location_id': fields.many2one('stock.location', 'Destination Location'),
'location_src_id': fields.many2one('stock.location', 'Source Location',
help="Source location is action=move"),
- 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True,
+ 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type',
help="Picking Type determines the way the picking should be shown in the view, reports, ...")
}
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index af3fa1153f4..e76ce99855c 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -1451,10 +1451,41 @@
-
+
+
+
+
+ stock.procurement.form
+ procurement.rule
+
+
+
+
+
+
diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py
index 8a389721733..5e58b918cb6 100644
--- a/addons/stock_location/stock_location.py
+++ b/addons/stock_location/stock_location.py
@@ -60,7 +60,7 @@ class stock_location_path(osv.osv):
("2binvoiced", "To Be Invoiced"),
("none", "Not Applicable")], "Invoice Status",
required=True,),
- 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', help="This is the picking type associated with the different pickings"),
+ 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', required=True, help="This is the picking type associated with the different pickings"),
'auto': fields.selection(
[('auto','Automatic Move'), ('manual','Manual Operation'),('transparent','Automatic No Step Added')],
'Automatic Move',
diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml
index 8a42f2afb46..4846ac70644 100644
--- a/addons/stock_location/stock_location_view.xml
+++ b/addons/stock_location/stock_location_view.xml
@@ -2,6 +2,26 @@
+
+ stock.procurement.rule.inherit.form
+ procurement.rule
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ stock.location.form
From f9cef80977b798d376594dfc73b677afc07f4eaa Mon Sep 17 00:00:00 2001
From: "Pooja Zankhariya (OpenERP Trainee)"
Date: Tue, 27 Aug 2013 19:39:26 +0530
Subject: [PATCH 28/35] [IMP]Moved stock invoice onshipping wizard to
stock_account
bzr revid: pooja.zakhariya@gmail.com-20130827140926-hegue0mvvdxluqnf
---
addons/sale_stock/__init__.py | 1 -
addons/sale_stock/__openerp__.py | 1 -
addons/sale_stock/wizard/__init__.py | 22 -------------------
addons/stock_account/__openerp__.py | 1 +
addons/stock_account/wizard/__init__.py | 1 +
.../wizard/stock_invoice_onshipping.py | 0
.../wizard/stock_invoice_onshipping_view.xml | 0
7 files changed, 2 insertions(+), 24 deletions(-)
delete mode 100644 addons/sale_stock/wizard/__init__.py
rename addons/{sale_stock => stock_account}/wizard/stock_invoice_onshipping.py (100%)
rename addons/{sale_stock => stock_account}/wizard/stock_invoice_onshipping_view.xml (100%)
diff --git a/addons/sale_stock/__init__.py b/addons/sale_stock/__init__.py
index 9c74739d4c9..f521debcea5 100644
--- a/addons/sale_stock/__init__.py
+++ b/addons/sale_stock/__init__.py
@@ -24,5 +24,4 @@ import stock
import report
import company
import res_config
-import wizard
diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py
index b1686bebb20..059c5a59c1d 100644
--- a/addons/sale_stock/__openerp__.py
+++ b/addons/sale_stock/__openerp__.py
@@ -51,7 +51,6 @@ You can choose flexible invoicing methods:
'security/sale_stock_security.xml',
'security/ir.model.access.csv',
'company_view.xml',
- 'wizard/stock_invoice_onshipping_view.xml',
'sale_stock_view.xml',
'sale_stock_workflow.xml',
'stock_view.xml',
diff --git a/addons/sale_stock/wizard/__init__.py b/addons/sale_stock/wizard/__init__.py
deleted file mode 100644
index e32a95fef96..00000000000
--- a/addons/sale_stock/wizard/__init__.py
+++ /dev/null
@@ -1,22 +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 stock_invoice_onshipping
diff --git a/addons/stock_account/__openerp__.py b/addons/stock_account/__openerp__.py
index 93ffe4006ec..6a22e327bb1 100644
--- a/addons/stock_account/__openerp__.py
+++ b/addons/stock_account/__openerp__.py
@@ -49,6 +49,7 @@ Dashboard / Reports for Warehouse Management will include:
'data': [
'stock_account_data.xml',
'wizard/stock_change_standard_price_view.xml',
+ 'wizard/stock_invoice_onshipping_view.xml',
'product_data.xml',
'product_view.xml',
'stock_account_view.xml',
diff --git a/addons/stock_account/wizard/__init__.py b/addons/stock_account/wizard/__init__.py
index ecb883ed6fb..001a39e763e 100644
--- a/addons/stock_account/wizard/__init__.py
+++ b/addons/stock_account/wizard/__init__.py
@@ -20,3 +20,4 @@
##############################################################################
import stock_change_standard_price
+import stock_invoice_onshipping
diff --git a/addons/sale_stock/wizard/stock_invoice_onshipping.py b/addons/stock_account/wizard/stock_invoice_onshipping.py
similarity index 100%
rename from addons/sale_stock/wizard/stock_invoice_onshipping.py
rename to addons/stock_account/wizard/stock_invoice_onshipping.py
diff --git a/addons/sale_stock/wizard/stock_invoice_onshipping_view.xml b/addons/stock_account/wizard/stock_invoice_onshipping_view.xml
similarity index 100%
rename from addons/sale_stock/wizard/stock_invoice_onshipping_view.xml
rename to addons/stock_account/wizard/stock_invoice_onshipping_view.xml
From 5400aec81bdd9355f90d7cfa44f8ee72adc227d8 Mon Sep 17 00:00:00 2001
From: Cedric Snauwaert
Date: Wed, 28 Aug 2013 14:49:12 +0200
Subject: [PATCH 29/35] [FIX]add warehouse_id to route and show all routes
associated to a warehouse on the warehouse form view
bzr revid: csn@openerp.com-20130828124912-9mvmbzvxmbq02me2
---
addons/stock/stock_view.xml | 2 ++
addons/stock_location/stock_location.py | 9 +++++++++
addons/stock_location/stock_location_view.xml | 10 ++++++++++
3 files changed, 21 insertions(+)
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index e76ce99855c..4488074293e 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -493,6 +493,7 @@
stock.warehouse
diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py
index 5e58b918cb6..77d1a67149a 100644
--- a/addons/stock_location/stock_location.py
+++ b/addons/stock_location/stock_location.py
@@ -28,20 +28,29 @@ class stock_location_route(osv.osv):
_name = 'stock.location.route'
_description = "Inventory Routes"
_order = 'sequence'
+
+ 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
+
_columns = {
'name': fields.char('Route Name', required=True),
'sequence': fields.integer('Sequence'),
'pull_ids': fields.one2many('procurement.rule', 'route_id', 'Pull Rules'),
'push_ids': fields.one2many('stock.location.path', 'route_id', 'Push Rules'),
+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
}
_defaults = {
'sequence': lambda self,cr,uid,ctx: 0,
+ 'warehouse_id': _default_warehouse,
}
class stock_warehouse(osv.osv):
_inherit = 'stock.warehouse'
_columns = {
'route_id': fields.many2one('stock.location.route', 'Default Logistic Route', help='Default route through the warehouse', required=True),
+ 'route_ids': fields.one2many('stock.location.route', 'warehouse_id', 'All Routes'),
}
diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml
index c50a6ca8a94..6c5cc042fef 100644
--- a/addons/stock_location/stock_location_view.xml
+++ b/addons/stock_location/stock_location_view.xml
@@ -157,6 +157,14 @@
+
+
+
+
+
+
+
+
@@ -167,6 +175,7 @@
+
@@ -179,6 +188,7 @@
You can define here the main logistic routes that run through
your warehouses and that define the flows of your products. These
- routes can be assigned to a product, a product category or on a
- location.
+ routes can be assigned to a product, a product category or be fixed
+ on procurement or sales order.
@@ -229,7 +229,7 @@
procurement.order
-
+
From 57c80c4bc10828ccf9e11d895b059aac4919ba20 Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Wed, 28 Aug 2013 17:32:10 +0200
Subject: [PATCH 31/35] [IMP] Adapt average yml and push flow yml, put stock.py
from sale_stock in stock_account
bzr revid: jco@openerp.com-20130828153210-cn97txe5046vo4nk
---
addons/purchase/test/average_price.yml | 27 +--
addons/sale_stock/__init__.py | 1 -
addons/sale_stock/sale_stock_view.xml | 14 --
addons/sale_stock/stock.py | 176 ------------------
addons/stock_account/__init__.py | 1 +
addons/stock_account/stock_account.py | 6 +
addons/stock_account/stock_account_view.xml | 16 ++
.../test/stock_location_push_flow.yml | 2 +
8 files changed, 34 insertions(+), 209 deletions(-)
delete mode 100644 addons/sale_stock/stock.py
diff --git a/addons/purchase/test/average_price.yml b/addons/purchase/test/average_price.yml
index 0fa2dfb0a4f..79bae838f7e 100644
--- a/addons/purchase/test/average_price.yml
+++ b/addons/purchase/test/average_price.yml
@@ -55,10 +55,9 @@
-
Process the reception of purchase order 1
-
- !python {model: stock.partial.picking}: |
+ !python {model: stock.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_average1")).picking_ids
- partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
+ self.do_partial(cr, uid, [pick_ids[0].id])
-
Check the standard price of the product (average icecream).
-
@@ -69,10 +68,9 @@
-
Process the reception of purchase order 2
-
- !python {model: stock.partial.picking}: |
+ !python {model: stock.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_average2")).picking_ids
- partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
+ self.do_partial(cr, uid, [pick_ids[0].id])
-
Check the standard price
-
@@ -82,7 +80,7 @@
Create picking to send some goods
-
!record {model: stock.picking, id: outgoing_average_shipment}:
- type: out
+ picking_type_id: stock.picking_type_out
-
Create move for picking
-
@@ -91,18 +89,12 @@
product_id: product_average_icecream
product_uom: product.product_uom_kgm
product_qty: 20.0
- type: out
-
- I assign this outgoing shipment
+ I assign this outgoing shipment and process the delivery
-
!python {model: stock.picking}: |
self.action_assign(cr, uid, [ref("outgoing_average_shipment")])
--
- Process the delivery of the outgoing shipment
--
- !python {model: stock.partial.picking}: |
- partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [ref("outgoing_average_shipment")], 'default_type':'out'})
- self.do_partial(cr, uid, [partial_id])
+ self.do_partial(cr, uid, [ref("outgoing_average_shipment")])
-
Check the standard price (60 * 10 + 30 * 80) / 40 = 75.0 did not change
-
@@ -129,10 +121,9 @@
-
Process the reception of purchase order 3 in grams
-
- !python {model: stock.partial.picking}: |
+ !python {model: stock.picking}: |
pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_average3")).picking_ids
- partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]})
- self.do_partial(cr, uid, [partial_id])
+ self.do_partial(cr, uid, [pick_ids[0].id])
-
Check price is (75.0*20 + 500) / 20.5 = 97.56097561
-
diff --git a/addons/sale_stock/__init__.py b/addons/sale_stock/__init__.py
index f521debcea5..72b3d5672d5 100644
--- a/addons/sale_stock/__init__.py
+++ b/addons/sale_stock/__init__.py
@@ -20,7 +20,6 @@
##############################################################################
import sale_stock
-import stock
import report
import company
import res_config
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index 03731bd737c..9e14ce46ce1 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -104,21 +104,7 @@
groups="sale.group_delivery_invoice_address"
/>
-
- stock.picking.form.inherit
- stock.picking
-
-
-
-
-
-
-
-
-
-
- stock.picking.search.inherit
diff --git a/addons/sale_stock/stock.py b/addons/sale_stock/stock.py
deleted file mode 100644
index e404ab3dd7b..00000000000
--- a/addons/sale_stock/stock.py
+++ /dev/null
@@ -1,176 +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_picking(osv.osv):
- _inherit = 'stock.picking'
- def __get_invoice_state(self, cr, uid, ids, name, arg, context=None):
- result = {}
- for pick in self.browse(cr, uid, ids, context=context):
- result[pick.id] = 'none'
- for move in pick.move_lines:
- if move.procurement_id:
- if move.procurement_id.invoice_state=='invoiced':
- result[pick.id] = 'invoiced'
- elif move.procurement_id.invoice_state=='2binvoiced':
- result[pick.id] = '2binvoiced'
- break
- return result
-
- def __get_picking_procurement(self, cr, uid, ids, context={}):
- result = {}
- for proc in self.pool.get('procurement.order').browse(cr, uid, ids, context=context):
- for move in proc.move_ids:
- if move.picking_id:
- result[move.picking_id.id] = True
- return result.keys()
-
- def __get_picking_move(self, cr, uid, ids, context={}):
- res = []
- for move in self.pool.get('stock.move').browse(cr, uid, ids, context=context):
- if move.picking_id:
- res.append(move.picking_id.id)
- return res
-
- _columns = {
- 'invoice_state': fields.function(__get_invoice_state, type='selection', selection=[
- ("invoiced", "Invoiced"),
- ("2binvoiced", "To Be Invoiced"),
- ("none", "Not Applicable")
- ], string="Invoice Control", required=True,
- store={
- 'procurement.order': (__get_picking_procurement, ['invoice_state'], 10),
- 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['state'], 10),
- 'stock.move': (__get_picking_move, ['picking_id'], 10),
- },
- ),
- }
- _defaults = {
- 'invoice_state': lambda *args, **argv: 'none'
- }
-
- def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None):
- """ Creates invoice based on the invoice state selected for picking.
- @param journal_id: Id of journal
- @param group: Whether to create a group invoice or not
- @param type: Type invoice to be created
- @return: Ids of created invoices for the pickings
- """
- context = context or {}
- todo = {}
- for picking in self.browse(cr, uid, ids, context=context):
- key = group and picking.id or True
- for move in picking.move_lines:
- if move.procurement_id and (move.procurement_id.invoice_state=='2binvoiced'):
- if (move.state <> 'cancel') and not move.scrapped:
- todo.setdefault(key, [])
- todo[key].append(move)
- invoices = []
- for moves in todo.values():
- invoices = self.__invoice_create_line(cr, uid, moves, journal_id, type, context=context)
- return invoices
-
- def __invoice_create_line(self, cr, uid, moves, journal_id=False, inv_type='out_invoice', context=None):
- invoice_obj = self.pool.get('account.invoice')
- invoices = {}
- for move in moves:
- sale_line = move.procurement_id.sale_line_id
- sale = sale_line.order_id
- partner = sale.partner_invoice_id
-
- currency_id = sale.pricelist_id.currency_id.id
- key = (partner.id, currency_id, sale.company_id.id, sale.user_id and sale.user_id.id or False)
-
- if key not in invoices:
- # Get account and payment terms
- if inv_type in ('out_invoice', 'out_refund'):
- account_id = partner.property_account_receivable.id
- payment_term = partner.property_payment_term.id or False
- else:
- account_id = partner.property_account_payable.id
- payment_term = partner.property_supplier_payment_term.id or False
-
- invoice_id = invoice_obj.create(cr, uid, {
- 'origin': sale.name,
- 'date_invoice': context.get('date_inv', False),
- 'user_id': sale.user_id and sale.user_id.id or False,
- 'partner_id': partner.id,
- 'account_id': account_id,
- 'payment_term': payment_term,
- 'type': inv_type,
- 'fiscal_position': partner.property_account_position.id,
- 'company_id': sale.company_id.id,
- 'currency_id': sale.pricelist_id.currency_id.id,
- 'journal_id': journal_id,
- }, context=context)
- invoices[key] = invoice_id
-
- # Get account_id
- if inv_type in ('out_invoice', 'out_refund'):
- account_id = move.product_id.property_account_income.id
- if not account_id:
- account_id = move.product_id.categ_id.property_account_income_categ.id
- else:
- account_id = move.product_id.property_account_expense.id
- if not account_id:
- account_id = move.product_id.categ_id.property_account_expense_categ.id
- fp_obj = self.pool.get('account.fiscal.position')
- fiscal_position = partner.property_account_position
- account_id = fp_obj.map_account(cr, uid, fiscal_position, account_id)
-
- # set UoS if it's a sale and the picking doesn't have one
- if move.product_uos:
- uos_id = move.product_uos.id
- quantity = move.product_uos_qty
- else:
- uos_id = move.product_uom.id
- quantity = move.product_uom_qty
-
- invoice_line_id = self.pool.get('account.invoice.line').create(cr, uid, {
- 'name': move.name,
- 'origin': move.picking_id and move.picking_id.origin or False,
- 'invoice_id': invoices[key],
- 'account_id': account_id,
- 'product_id': move.product_id.id,
- 'uos_id': uos_id,
- 'quantity': quantity,
- 'price_unit': sale_line.price_unit,
- 'discount': sale_line.discount,
- 'invoice_line_tax_id': [(6, 0, [x.id for x in sale_line.tax_id])],
- 'account_analytic_id': sale.project_id and sale.project_id.id or False,
- }, context=context)
-
- self.pool.get('sale.order.line').write(cr, uid, [sale_line.id], {
- 'invoice_lines': [(4, invoice_line_id)]
- }, context=context)
- self.pool.get('sale.order').write(cr, uid, [sale.id], {
- 'invoice_ids': [(4, invoices[key])],
- })
-
- self.pool.get('procurement.order').write(cr, uid, [move.procurement_id.id], {
- 'invoice_state': 'invoiced',
- }, context=context)
-
- invoice_obj.button_compute(cr, uid, invoices.values(), context=context, set_total=(inv_type in ('in_invoice', 'in_refund')))
- return invoices.values()
diff --git a/addons/stock_account/__init__.py b/addons/stock_account/__init__.py
index 3bab8f50207..d74ac75cb98 100644
--- a/addons/stock_account/__init__.py
+++ b/addons/stock_account/__init__.py
@@ -21,5 +21,6 @@
import product
import stock_account
+import stock
import wizard
diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py
index 2dc3d804ccd..f9e62fa80e2 100644
--- a/addons/stock_account/stock_account.py
+++ b/addons/stock_account/stock_account.py
@@ -34,6 +34,12 @@ import openerp.addons.decimal_precision as dp
import logging
_logger = logging.getLogger(__name__)
+#----------------------------------------------------------
+# Invoice state
+#----------------------------------------------------------
+
+
+
#----------------------------------------------------------
# Stock Location
diff --git a/addons/stock_account/stock_account_view.xml b/addons/stock_account/stock_account_view.xml
index cf9aaebf236..a7e6bc8afe9 100644
--- a/addons/stock_account/stock_account_view.xml
+++ b/addons/stock_account/stock_account_view.xml
@@ -16,5 +16,21 @@
+
+
+ stock.picking.form.inherit
+ stock.picking
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/stock_location/test/stock_location_push_flow.yml b/addons/stock_location/test/stock_location_push_flow.yml
index 3a6f0a1b2c3..0d9c71acd48 100644
--- a/addons/stock_location/test/stock_location_push_flow.yml
+++ b/addons/stock_location/test/stock_location_push_flow.yml
@@ -32,9 +32,11 @@
- invoice_state: none
location_dest_id: stock_location.stock_location_qualitytest0
location_from_id: stock.stock_location_stock
+ picking_type_id: stock.picking_type_internal
- invoice_state: none
location_dest_id: stock.stock_location_components
location_from_id: stock_location.stock_location_qualitytest0
+ picking_type_id: stock.picking_type_internal
-
!record {model: product.product, id: product_product_hpcdwriters01}:
list_price: 1000.0
From 5ca2f661a6b8ad45b4a9c472e729e76aa1d44e80 Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Thu, 29 Aug 2013 09:34:27 +0200
Subject: [PATCH 32/35] [ADD] As stock.py moved, we need to add it
bzr revid: jco@openerp.com-20130829073427-mdx76slvnkr939gq
---
.../wizard/orderpoint_procurement_view.xml | 3 +-
addons/stock_account/stock.py | 176 ++++++++++++++++++
2 files changed, 178 insertions(+), 1 deletion(-)
create mode 100644 addons/stock_account/stock.py
diff --git a/addons/stock/wizard/orderpoint_procurement_view.xml b/addons/stock/wizard/orderpoint_procurement_view.xml
index 227b79b3234..f542db4dd94 100644
--- a/addons/stock/wizard/orderpoint_procurement_view.xml
+++ b/addons/stock/wizard/orderpoint_procurement_view.xml
@@ -31,6 +31,7 @@
target="new"
key2="client_action_multi"
id="action_procurement_compute"/>
-
+
+
diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py
new file mode 100644
index 00000000000..e404ab3dd7b
--- /dev/null
+++ b/addons/stock_account/stock.py
@@ -0,0 +1,176 @@
+# -*- 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_picking(osv.osv):
+ _inherit = 'stock.picking'
+ def __get_invoice_state(self, cr, uid, ids, name, arg, context=None):
+ result = {}
+ for pick in self.browse(cr, uid, ids, context=context):
+ result[pick.id] = 'none'
+ for move in pick.move_lines:
+ if move.procurement_id:
+ if move.procurement_id.invoice_state=='invoiced':
+ result[pick.id] = 'invoiced'
+ elif move.procurement_id.invoice_state=='2binvoiced':
+ result[pick.id] = '2binvoiced'
+ break
+ return result
+
+ def __get_picking_procurement(self, cr, uid, ids, context={}):
+ result = {}
+ for proc in self.pool.get('procurement.order').browse(cr, uid, ids, context=context):
+ for move in proc.move_ids:
+ if move.picking_id:
+ result[move.picking_id.id] = True
+ return result.keys()
+
+ def __get_picking_move(self, cr, uid, ids, context={}):
+ res = []
+ for move in self.pool.get('stock.move').browse(cr, uid, ids, context=context):
+ if move.picking_id:
+ res.append(move.picking_id.id)
+ return res
+
+ _columns = {
+ 'invoice_state': fields.function(__get_invoice_state, type='selection', selection=[
+ ("invoiced", "Invoiced"),
+ ("2binvoiced", "To Be Invoiced"),
+ ("none", "Not Applicable")
+ ], string="Invoice Control", required=True,
+ store={
+ 'procurement.order': (__get_picking_procurement, ['invoice_state'], 10),
+ 'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['state'], 10),
+ 'stock.move': (__get_picking_move, ['picking_id'], 10),
+ },
+ ),
+ }
+ _defaults = {
+ 'invoice_state': lambda *args, **argv: 'none'
+ }
+
+ def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None):
+ """ Creates invoice based on the invoice state selected for picking.
+ @param journal_id: Id of journal
+ @param group: Whether to create a group invoice or not
+ @param type: Type invoice to be created
+ @return: Ids of created invoices for the pickings
+ """
+ context = context or {}
+ todo = {}
+ for picking in self.browse(cr, uid, ids, context=context):
+ key = group and picking.id or True
+ for move in picking.move_lines:
+ if move.procurement_id and (move.procurement_id.invoice_state=='2binvoiced'):
+ if (move.state <> 'cancel') and not move.scrapped:
+ todo.setdefault(key, [])
+ todo[key].append(move)
+ invoices = []
+ for moves in todo.values():
+ invoices = self.__invoice_create_line(cr, uid, moves, journal_id, type, context=context)
+ return invoices
+
+ def __invoice_create_line(self, cr, uid, moves, journal_id=False, inv_type='out_invoice', context=None):
+ invoice_obj = self.pool.get('account.invoice')
+ invoices = {}
+ for move in moves:
+ sale_line = move.procurement_id.sale_line_id
+ sale = sale_line.order_id
+ partner = sale.partner_invoice_id
+
+ currency_id = sale.pricelist_id.currency_id.id
+ key = (partner.id, currency_id, sale.company_id.id, sale.user_id and sale.user_id.id or False)
+
+ if key not in invoices:
+ # Get account and payment terms
+ if inv_type in ('out_invoice', 'out_refund'):
+ account_id = partner.property_account_receivable.id
+ payment_term = partner.property_payment_term.id or False
+ else:
+ account_id = partner.property_account_payable.id
+ payment_term = partner.property_supplier_payment_term.id or False
+
+ invoice_id = invoice_obj.create(cr, uid, {
+ 'origin': sale.name,
+ 'date_invoice': context.get('date_inv', False),
+ 'user_id': sale.user_id and sale.user_id.id or False,
+ 'partner_id': partner.id,
+ 'account_id': account_id,
+ 'payment_term': payment_term,
+ 'type': inv_type,
+ 'fiscal_position': partner.property_account_position.id,
+ 'company_id': sale.company_id.id,
+ 'currency_id': sale.pricelist_id.currency_id.id,
+ 'journal_id': journal_id,
+ }, context=context)
+ invoices[key] = invoice_id
+
+ # Get account_id
+ if inv_type in ('out_invoice', 'out_refund'):
+ account_id = move.product_id.property_account_income.id
+ if not account_id:
+ account_id = move.product_id.categ_id.property_account_income_categ.id
+ else:
+ account_id = move.product_id.property_account_expense.id
+ if not account_id:
+ account_id = move.product_id.categ_id.property_account_expense_categ.id
+ fp_obj = self.pool.get('account.fiscal.position')
+ fiscal_position = partner.property_account_position
+ account_id = fp_obj.map_account(cr, uid, fiscal_position, account_id)
+
+ # set UoS if it's a sale and the picking doesn't have one
+ if move.product_uos:
+ uos_id = move.product_uos.id
+ quantity = move.product_uos_qty
+ else:
+ uos_id = move.product_uom.id
+ quantity = move.product_uom_qty
+
+ invoice_line_id = self.pool.get('account.invoice.line').create(cr, uid, {
+ 'name': move.name,
+ 'origin': move.picking_id and move.picking_id.origin or False,
+ 'invoice_id': invoices[key],
+ 'account_id': account_id,
+ 'product_id': move.product_id.id,
+ 'uos_id': uos_id,
+ 'quantity': quantity,
+ 'price_unit': sale_line.price_unit,
+ 'discount': sale_line.discount,
+ 'invoice_line_tax_id': [(6, 0, [x.id for x in sale_line.tax_id])],
+ 'account_analytic_id': sale.project_id and sale.project_id.id or False,
+ }, context=context)
+
+ self.pool.get('sale.order.line').write(cr, uid, [sale_line.id], {
+ 'invoice_lines': [(4, invoice_line_id)]
+ }, context=context)
+ self.pool.get('sale.order').write(cr, uid, [sale.id], {
+ 'invoice_ids': [(4, invoices[key])],
+ })
+
+ self.pool.get('procurement.order').write(cr, uid, [move.procurement_id.id], {
+ 'invoice_state': 'invoiced',
+ }, context=context)
+
+ invoice_obj.button_compute(cr, uid, invoices.values(), context=context, set_total=(inv_type in ('in_invoice', 'in_refund')))
+ return invoices.values()
From b9e31237647a98e344b392db4d2731e9e2bbf25b Mon Sep 17 00:00:00 2001
From: Cedric Snauwaert
Date: Thu, 29 Aug 2013 09:35:16 +0200
Subject: [PATCH 33/35] [IMP]purchase: add picking_type field and set it by
default as picking in
bzr revid: csn@openerp.com-20130829073516-48qqx63o897ins11
---
addons/purchase/purchase.py | 8 +++++++-
addons/purchase/purchase_view.xml | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 79df9f31103..660b70a488c 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -150,6 +150,10 @@ class purchase_order(osv.osv):
limit=1)
return res and res[0] or False
+ def _get_picking_in(self, cr, uid, context=None):
+ obj_data = self.pool.get('ir.model.data')
+ return obj_data.get_object_reference(cr, uid, 'stock','picking_type_in')[1]
+
STATE_SELECTION = [
('draft', 'Draft PO'),
('sent', 'RFQ Sent'),
@@ -230,6 +234,7 @@ class purchase_order(osv.osv):
'journal_id': fields.many2one('account.journal', 'Journal'),
'bid_date': fields.date('Bid Received On', readonly=True, help="Date on which the bid was received"),
'bid_validity': fields.date('Bid Valid Until', help="Date on which the bid expired"),
+ 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', help="This will determine picking type of incoming shipment"),
}
_defaults = {
'date_order': fields.date.context_today,
@@ -241,7 +246,8 @@ class purchase_order(osv.osv):
'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist_purchase.id,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'purchase.order', context=c),
'journal_id': _get_journal,
- 'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id
+ 'currency_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id,
+ 'picking_type_id': _get_picking_in,
}
_sql_constraints = [
('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique per Company!'),
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index e3af7bd6243..973757770c4 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -198,6 +198,7 @@
+
From b2995fc6da5e5bb0de1f606dfab3bb7ca3f18972 Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Thu, 29 Aug 2013 10:35:43 +0200
Subject: [PATCH 34/35] [FIX] Move menuitem orderpoint, so it loads correctly
bzr revid: jco@openerp.com-20130829083543-dp4i7of9ktg06hho
---
addons/stock/stock_view.xml | 1 +
addons/stock/wizard/orderpoint_procurement_view.xml | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 4488074293e..30038952ce7 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -1571,6 +1571,7 @@
+
diff --git a/addons/stock/wizard/orderpoint_procurement_view.xml b/addons/stock/wizard/orderpoint_procurement_view.xml
index f542db4dd94..20250bb78dd 100644
--- a/addons/stock/wizard/orderpoint_procurement_view.xml
+++ b/addons/stock/wizard/orderpoint_procurement_view.xml
@@ -32,6 +32,6 @@
key2="client_action_multi"
id="action_procurement_compute"/>
-
+
From 7be335a9761af1eb8116ed3145b2e2cf105f0df4 Mon Sep 17 00:00:00 2001
From: Josse Colpaert
Date: Thu, 29 Aug 2013 11:04:31 +0200
Subject: [PATCH 35/35] [IMP] When copying will check if not passing
backorder_id in copy already (from sgo)
bzr revid: jco@openerp.com-20130829090431-65dypmn1tjgr8pbt
---
addons/stock/stock.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 54f473f75c1..740e60b9a50 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -530,7 +530,8 @@ class stock_picking(osv.osv):
picking_obj = self.browse(cr, uid, id, context=context)
if ('name' not in default) or (picking_obj.name == '/'):
default['name'] = '/'
- default['backorder_id'] = False
+ if not default.get('backorder_id'):
+ default['backorder_id'] = False
return super(stock_picking, self).copy(cr, uid, id, default, context)
def action_confirm(self, cr, uid, ids, context=None):