[MERGE]sync with parent
bzr revid: sgo@tinyerp.com-20130829121514-q205bhf6uyxzp6ly
This commit is contained in:
commit
3d494a4deb
|
@ -14,8 +14,7 @@
|
|||
!record {model: product.product, id: product_product_hrmanger0}:
|
||||
categ_id: product.product_category_6
|
||||
mes_type: fixed
|
||||
name: HR Manger
|
||||
procure_method: make_to_stock
|
||||
name: HR Manager
|
||||
standard_price: 1.0
|
||||
supply_method: buy
|
||||
type: service
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -62,6 +62,13 @@ class sale_order(osv.osv):
|
|||
res.add(move.procurement_id.sale_line_id.order_id.id)
|
||||
return list(res)
|
||||
|
||||
def _get_orders_procurements(self, cr, uid, ids, context=None):
|
||||
res = set()
|
||||
for proc in self.pool.get('procurement.order').browse(cr, uid, ids, context=context):
|
||||
if proc.sale_line_id:
|
||||
res.add(proc.sale_line_id.order_id.id)
|
||||
return list(res)
|
||||
|
||||
def _get_picking_ids(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for sale in self.browse(cr, uid, ids, context=context):
|
||||
|
@ -107,7 +114,10 @@ class sale_order(osv.osv):
|
|||
('prepaid', 'Before Delivery'),
|
||||
], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
|
||||
help="""On demand: A draft invoice can be created from the sales order when needed. \nOn delivery order: A draft invoice can be created from the delivery order when the products have been delivered. \nBefore delivery: A draft invoice is created from the sales order and must be paid before the products can be delivered."""),
|
||||
'shipped': fields.function(_get_shipped, string='Delivered', type='boolean', store={'stock.move': (_get_orders, ['state'], 10)}),
|
||||
'shipped': fields.function(_get_shipped, string='Delivered', type='boolean', store={
|
||||
'stock.move': (_get_orders, ['state'], 10),
|
||||
'procurement.order': (_get_orders_procurements, ['state'], 10)
|
||||
}),
|
||||
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True),
|
||||
'picking_ids': fields.function(_get_picking_ids, method=True, type='one2many', relation='stock.picking', string='Picking associated to this sale'),
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ This adds a route on the sales order and sales order line (mini module)
|
|||
'test': [
|
||||
'test/crossdock.yml',
|
||||
'test/dropship.yml',
|
||||
'test/procurementexception.yml',
|
||||
'test/lifo_price.yml'
|
||||
],
|
||||
'installable': True,
|
||||
|
|
|
@ -1,37 +1,63 @@
|
|||
-
|
||||
Create product with no seller_ids
|
||||
I create a product with no supplier define for it.
|
||||
-
|
||||
|
||||
!record {model: product.product, id: product_with_no_seller}:
|
||||
name: 'product with no seller'
|
||||
list_price: 20.00
|
||||
standard_price: 15.00
|
||||
categ_id: product.product_category_1
|
||||
-
|
||||
Create a sales order with 1 piece for that product and route crossdock
|
||||
I create a sales order with this product with route crossdock.
|
||||
-
|
||||
!record{sale.order}
|
||||
!record {model: sale.order, id: sale_order_route_crossdock}:
|
||||
partner_id: base.res_partner_2
|
||||
partner_invoice_id: base.res_partner_address_3
|
||||
partner_shipping_id: base.res_partner_address_3
|
||||
note: crossdock route
|
||||
payment_term: account.account_payment_term
|
||||
order_line:
|
||||
- product_id: product_with_no_seller
|
||||
product_uom_qty: 1
|
||||
route_id: stock_location.route_warehouse0_crossdock
|
||||
-
|
||||
Confirm sales order
|
||||
I confirm the sales order.
|
||||
-
|
||||
!python {
|
||||
!workflow {model: sale.order, ref: sale_order_route_crossdock, action: order_confirm}
|
||||
-
|
||||
Check there is a procurement in exception that has the procurement group of the sales order
|
||||
I check there is a procurement in exception that has the procurement group of the sales order created before.
|
||||
-
|
||||
!python {
|
||||
assert
|
||||
!python {model: procurement.order}: |
|
||||
self.run_scheduler(cr, uid)
|
||||
sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock"))
|
||||
proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')])
|
||||
assert proc_id, 'No Procurement!'
|
||||
-
|
||||
Adjust the product that it has at least one seller_id
|
||||
I set the at least one supplier on the product.
|
||||
-
|
||||
!record{id: model: product.product) or in !python
|
||||
!record {model: product.product, id: product_with_no_seller}:
|
||||
seller_ids:
|
||||
- delay: 1
|
||||
name: base.res_partner_2
|
||||
min_qty: 2.0
|
||||
-
|
||||
Run the Scheduler
|
||||
I run the Procurement.
|
||||
-
|
||||
!python
|
||||
!python {model: procurement.order}: |
|
||||
sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock"))
|
||||
proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')])
|
||||
self.run(cr, uid, proc_id)
|
||||
-
|
||||
Check the status changed there is no procurement order in exception any more from that procurement group
|
||||
I check the status changed there is no procurement order in exception any more from that procurement group
|
||||
-
|
||||
!python{model: procurement.order}
|
||||
search procurement from
|
||||
!python {model: procurement.order}: |
|
||||
sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock"))
|
||||
proc_id = self.search(cr, uid, [('group_id.name', '=', sale_id.name), ('state', '=', 'exception')])
|
||||
assert not proc_id, 'Procurement should be in running state'
|
||||
-
|
||||
Check a purchase quotation was created
|
||||
I check a purchase quotation was created.
|
||||
-
|
||||
|
||||
|
||||
|
||||
|
||||
!python {model: procurement.order}: |
|
||||
sale_id = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_route_crossdock"))
|
||||
proc_ids = self.search(cr, uid, [('group_id.name', '=', sale_id.name)])
|
||||
purchase_id = [proc.purchase_id for proc in self.browse(cr, uid, proc_ids) if proc.purchase_id]
|
||||
assert purchase_id, 'No Purchase Quotation is created'
|
||||
|
|
Loading…
Reference in New Issue