[MERGE] merged latest improvements from R&D warehouse branch

bzr revid: odo@openerp.com-20101014010004-wvonp90kbw6ax4pd
This commit is contained in:
Olivier Dony
2010-10-14 03:00:04 +02:00
13 changed files with 37 additions and 181 deletions
@@ -4,9 +4,6 @@
!record {model: account.tax.code, id: account_tax_code_0}:
name : Tax Code Test
sign : 1.00
-
-
In order to test the 'Validate Journal Entries' wizard in OpenERP, I created an account move
+1
View File
@@ -12,6 +12,7 @@
invoice_state: none
move_lines:
- company_id: base.main_company
date: '2010-05-11 15:18:57'
location_dest_id: stock.stock_location_customers
location_id: stock.stock_location_stock
name: HP CD writers
-155
View File
@@ -1,155 +0,0 @@
-
In order to test the delivery module, I will do Configuration -> Delivery -> Delivery Method
And there are two methods for doing that
Delivery based on order quantities,
Delivery based on delivered quantities.
-
I create the partner associated with the transport.
-
I create partner.
-
!record {model: res.partner, id: res_partner_thepost0}:
address:
- country_id: base.in
name: Micro Link
credit_limit: 0.0
name: The Post
property_account_payable: account.a_pay
property_account_receivable: account.a_recv
-
I create associated product for delivery.
-
!record {model: product.product, id: product_product_deliverybypost0}:
categ_id: product.product_category_services
cost_method: standard
mes_type: fixed
name: Delivery Product
procure_method: make_to_stock
supply_method: buy
type: service
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
warranty: 0.0
-
I create the Delivery Method.
-
!record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}:
name: The OpenERP Experss
partner_id: res_partner_thepost0
product_id: product_product_deliverybypost0
-
I create a delivery grid record and define the region for which the tariffs in the grid will be applicable.
Then set the condition for which this rule is applicable.
-
!record {model: delivery.grid, id: delivery_grid_weight0}:
carrier_id: delivery_carrier_theopenerpexperss0
line_ids:
- list_price: 120.0
max_value: 250.0
name: Weight of product
operator: <=
standard_price: 60.0
type: weight
price_type: fixed
variable_factor: weight
- list_price: 0.0
max_value: 500.0
name: Price &gt;= 500
operator: <=
standard_price: 20.0
type: price
price_type: fixed
variable_factor: weight
country_ids:
- base.id
- base.be
- base.in
- base.io
name: Weight
sequence: 1
-
To check the Delivery based on order quantities , I have created sale order and picking_policy is direct .
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-11'
invoice_quantity: order
name: Test/delivery
order_line:
- name: '[PC1] Basic PC'
price_unit: 450.0
product_uom: product.product_uom_unit
product_uom_qty: 10.0
state: draft
delay: 2.0
product_id: product.product_product_pc1
product_uos_qty: 10.0
th_weight: 0.0
type: make_to_stock
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I create delivery.sale.order record.
-
!record {model: delivery.sale.order, id: delivery_sale_order_0}:
carrier_id: delivery_carrier_theopenerpexperss0
-
To add the delivery charges on the quotation, I click on Delivery costs button and select the carrier.
-
!python {model: delivery.sale.order}: |
self.delivery_set(cr, uid, [ref("delivery_sale_order_0")], {"lang": "en_US", "active_model":
"sale.order", "tz": False, "order_id": 8, "active_ids": [ref("sale_order_so0")],
"active_id": ref("sale_order_so0"), })
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
To check the Invoicing based on deliveries.I create new sale order and picking_policy is Complete Delivery.
-
!record {model: sale.order, id: sale_order_test_complete0}:
name: Test/Complete Deliver
carrier_id: delivery.delivery_carrier_theopenerpexperss0
invoice_quantity: procurement
order_line:
- name: '[PC1] Basic PC'
price_unit: 450.0
product_uom: product.product_uom_unit
product_uom_qty: 10.0
state: draft
delay: 2.0
product_id: product.product_product_pc1
product_uos_qty: 10.0
th_weight: 0.0
type: make_to_stock
partner_id: base.res_partner_4
partner_order_id: base.res_partner_address_7
partner_invoice_id: base.res_partner_address_7
partner_shipping_id: base.res_partner_address_7
pricelist_id: product.list0
order_policy: picking
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_test_complete0}
-
I Create stock.invoice.onshipping
-
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
journal_id: account.sales_journal
type: out_invoice
-
I Create Invoice form picking.
-
!python {model: stock.invoice.onshipping}: |
so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0'))
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
"tz": False, "active_model": "stock.picking", "contact_display": "partner",
"active_ids": [so.picking_ids[0].id], "active_id": so.picking_ids[0].id })
+1 -1
View File
@@ -238,7 +238,7 @@
</record>
<act_window
context="{'search_default_warehouse_id': [active_id]}"
context="{'search_default_warehouse_id': active_id}"
id="act_stock_warehouse_2_stock_warehouse_orderpoint"
name="Minimum Stock Rules"
res_model="stock.warehouse.orderpoint"
+6 -1
View File
@@ -24,7 +24,7 @@ import decimal_precision as dp
import math
from _common import rounding
import re
from tools.translate import _
def is_pair(x):
@@ -502,6 +502,11 @@ class product_product(osv.osv):
if not len(ids):
ids = self.search(cr, user, [('default_code',operator,name)]+ args, limit=limit, context=context)
ids += self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
if not len(ids):
ptrn=re.compile('(\[(.*?)\])')
res = ptrn.search(str(name))
if res:
ids = self.search(cr, user, [('default_code','ilike',res.group(2))]+ args, limit=limit, context=context)
else:
ids = self.search(cr, user, args, limit=limit, context=context)
result = self.name_get(cr, user, ids, context)
+19 -11
View File
@@ -730,21 +730,29 @@ class stock_picking(osv.osv):
'button_confirm', cr)
return True
def draft_validate(self, cr, uid, ids, *args):
def draft_validate(self, cr, uid, ids, context=None):
""" Validates picking directly from draft state.
@return: True
"""
if context is None:
context = {}
wf_service = netsvc.LocalService("workflow")
self.draft_force_assign(cr, uid, ids)
for pick in self.browse(cr, uid, ids):
move_ids = [x.id for x in pick.move_lines]
self.pool.get('stock.move').force_assign(cr, uid, move_ids)
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
self.action_move(cr, uid, [pick.id])
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
return True
context.update({'active_ids':ids})
return {
'name': 'Make Picking',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.partial.picking',
'type': 'ir.actions.act_window',
'target': 'new',
'nodestroy': True,
'context':context
}
def cancel_assign(self, cr, uid, ids, *args):
""" Cancels picking and moves.
@return: True
@@ -1434,7 +1442,7 @@ class stock_move(osv.osv):
'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'),
'create_date': fields.datetime('Creation Date', readonly=True),
'date': fields.datetime('Date', required=True, help="Move date: scheduled date until move is done, then date of actual move processing", readonly=True),
'date_expected': fields.datetime('Scheduled Date', required=True, help="Scheduled date for the processing of this move"),
'date_expected': fields.datetime('Scheduled Date', states={'done': [('readonly', True)]},required=True, help="Scheduled date for the processing of this move"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')],states={'done': [('readonly', True)]}),
'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True,states={'done': [('readonly', True)]}),
@@ -2508,16 +2516,16 @@ class stock_picking_move_wizard(osv.osv_memory):
def _get_picking(self, cr, uid, ctx=None):
if ctx is None:
ctx = {}
if ctx.get('action_id', False):
return ctx['action_id']
if ctx.get('active_id', False):
return ctx['active_id']
return False
def _get_picking_address(self, cr, uid, context=None):
picking_obj = self.pool.get('stock.picking')
if context is None:
context = {}
if context.get('action_id', False):
picking = picking_obj.browse(cr, uid, [context['action_id']])[0]
if context.get('active_id', False):
picking = picking_obj.browse(cr, uid, [context['active_id']])[0]
return picking.address_id and picking.address_id.id or False
return False
+1
View File
@@ -264,6 +264,7 @@
<field name="invoice_state">2binvoiced</field>
<field name="address_id" ref="base.main_address"/>
<field name="company_id" ref="base.main_company"/>
<field name="partner_id" ref="base.main_partner"/>
</record>
</data>
</openerp>
+6 -7
View File
@@ -101,7 +101,7 @@
string="Split inventory lines" groups="base.group_extended"
type="action" icon="terp-stock_effects-object-colorize" states="draft"/>
<field colspan="4" domain="[('usage','=','internal')]" name="location_id"/>
<field name="state" />
<field name="state" invisible="True"/>
</tree>
<form string="Products ">
<field colspan="4" context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" domain="[('type','&lt;&gt;','service')]"/>
@@ -127,7 +127,7 @@
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="date" string="Date"/>
<field name="state"/>
<field name="state" invisible="True"/>
</tree>
</field>
</page>
@@ -741,13 +741,13 @@
</field>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-apply"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Process" type="action" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@@ -931,13 +931,13 @@
</field>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-yes"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended" icon="gtk-apply"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Process" type="action" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional info" groups="base.group_extended,base.group_multi_company">
@@ -1146,13 +1146,13 @@
</field>
<group col="10" colspan="4">
<field name="state" readonly="1"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object" icon="gtk-ok"/>
<button name="draft_validate" states="draft" string="Process Now" type="object" icon="gtk-media-play"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" icon="gtk-find"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended" icon="gtk-jump-to"/>
<button name="%(action_partial_picking)d" states="assigned" string="Process" type="action" icon="gtk-go-forward"/>
<button name="%(action_stock_invoice_onshipping)d" string="Create Invoice" type="action" icon="terp-gtk-go-back-rtl" attrs="{'invisible':[('invoice_state','!=','2binvoiced')]}"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel"/>
</group>
</page>
<page string="Additional Info" groups="base.group_extended,base.group_multi_company">
@@ -1611,7 +1611,6 @@
<filter string="Supplier" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Order" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'origin'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
@@ -11,7 +11,7 @@
move_lines:
- company_id: base.main_company
date_expected: '2010-08-03 11:05:47'
date_planned: '2010-08-03 11:05:47'
date: '2010-08-03 11:05:47'
location_id: stock.stock_location_stock
product_id: product.product_product_pc1
product_qty: 3.0
+1 -1
View File
@@ -20,6 +20,6 @@
##############################################################################
import stock_location
import mrp_pull
import procurement_pull
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1 -1
View File
@@ -87,7 +87,7 @@ You can use the demo data as follow:
'author': 'OpenERP SA',
'depends': ['procurement','stock','sale'],
'init_xml': [],
'update_xml': ['stock_location_view.xml', 'security/ir.model.access.csv', 'mrp_pull_workflow.xml'],
'update_xml': ['stock_location_view.xml', 'security/ir.model.access.csv', 'procurement_pull_workflow.xml'],
'demo_xml': [
'stock_location_demo_cpu1.xml',
'stock_location_demo_cpu3.yml',