[MERGE]:Merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons1
bzr revid: sbh@tinyerp.com-20100514151730-cqckmc8i2ljo2pxy
This commit is contained in:
@@ -437,8 +437,8 @@
|
||||
-
|
||||
!record {model: pos.make.payment, id: pos_make_payment_1}:
|
||||
amount: 680.0
|
||||
journal: '5'
|
||||
payment_date: '2010-05-13'
|
||||
journal: 5
|
||||
payment_date: 2010-05-13
|
||||
payment_name: Payment
|
||||
product_id: product_product_hppaviliondesktoppcs0
|
||||
|
||||
|
||||
@@ -52,6 +52,11 @@
|
||||
'report/purchase_report_view.xml',
|
||||
],
|
||||
'demo_xml': ['purchase_demo.xml'],
|
||||
'test': [
|
||||
'test/purchase_from_order.yml',
|
||||
'test/purchase_from_manual.yml',
|
||||
# 'test/purchase_from_picking.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0057234283549',
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
-
|
||||
In order to test the purchase flow,I start by creating a new product 'iPod'
|
||||
-
|
||||
!record {model: product.product, id: product_product_ipod0}:
|
||||
categ_id: 'product.product_category_3'
|
||||
cost_method: standard
|
||||
mes_type: fixed
|
||||
name: iPod
|
||||
price_margin: 2.0
|
||||
procure_method: make_to_stock
|
||||
property_stock_inventory: stock.location_inventory
|
||||
property_stock_procurement: stock.location_procurement
|
||||
property_stock_production: stock.location_production
|
||||
seller_delay: '1'
|
||||
standard_price: 100.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
volume: 0.0
|
||||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
In order to test the purchase flow,I create a new record where "invoice_method" is From Manual
|
||||
-
|
||||
Creating an purchase.order record
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_po1}:
|
||||
company_id: base.main_company
|
||||
date_order: '2010-05-11'
|
||||
invoice_method: order
|
||||
location_id: stock.stock_location_stock
|
||||
name: PO00010
|
||||
order_line:
|
||||
- date_planned: '2010-05-13'
|
||||
name: iPod
|
||||
price_unit: 100.0
|
||||
product_id: 'product_product_ipod0'
|
||||
product_qty: 10.0
|
||||
product_uom: product.product_uom_unit
|
||||
state: draft
|
||||
partner_address_id: base.res_partner_address_7
|
||||
partner_id: base.res_partner_4
|
||||
pricelist_id: purchase.list0
|
||||
-
|
||||
Initially purchase order is in the draft state
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po1}:
|
||||
- state == 'draft'
|
||||
-
|
||||
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po1")])
|
||||
-
|
||||
Performing a workflow action purchase_confirm on module purchase.order
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po1}
|
||||
-
|
||||
I check that the order which was initially in the draft state has transit to confirm state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po1}:
|
||||
- state == 'confirmed'
|
||||
-
|
||||
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po1"))
|
||||
pur_line=self.pool.get( 'purchase.order.line')
|
||||
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
|
||||
assert search_ids, _('Purchase order line is not created!')
|
||||
-
|
||||
To check that wizard "Create Invoices" gets opened
|
||||
-
|
||||
Creating a purchase.order.line_invoice record
|
||||
-
|
||||
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
|
||||
{}
|
||||
-
|
||||
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
|
||||
-
|
||||
!python {model: purchase.order.line_invoice}: |
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
ids = []
|
||||
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po1"))
|
||||
for line in pur_id1.order_line:
|
||||
ids.append(line.id)
|
||||
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
|
||||
-
|
||||
I check that invoice gets created
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po1"))
|
||||
pur_line=self.pool.get( 'purchase.order.line')
|
||||
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
|
||||
assert search_ids, _('Invoice is not created!')
|
||||
-
|
||||
I check that a record gets created in the Pending Invoices
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_id1=self.browse(cr, uid, ref("purchase_order_po1"))
|
||||
account_obj = self.pool.get('account.invoice')
|
||||
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
assert ids, _('Pending Invoice is not created!')
|
||||
-
|
||||
Then an order is approved by clicking on the "Approved by Supplier" button
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
self.wkf_approve_order(cr, uid, [ref("purchase_order_po1")])
|
||||
-
|
||||
Performing a workflow action purchase_approve on module purchase.order
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po1}
|
||||
-
|
||||
I check that the order which was initially in the confirmed state has transit to approved state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po1}:
|
||||
- state == 'approved'
|
||||
-
|
||||
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id=self.browse(cr, uid, ref("purchase_order_po1"))
|
||||
assert(pur_id.date_approve)
|
||||
-
|
||||
I check that an entry gets created in the stock.picking
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id=self.browse(cr, uid, ref("purchase_order_po1"))
|
||||
assert(pur_id.picking_ids)
|
||||
-
|
||||
I check that an entry gets created in the stock.move
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_id1=self.browse(cr, uid, ref("purchase_order_po1"))
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
pick_id = picking_obj.browse(cr, uid, ids)[0]
|
||||
move_obj = self.pool.get('stock.move')
|
||||
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
|
||||
assert search_id, _('No Incoming Product!')
|
||||
-
|
||||
I check that Traceability moves are created
|
||||
@@ -0,0 +1,154 @@
|
||||
-
|
||||
In order to test the purchase flow,I start by creating a new product 'iPod'
|
||||
-
|
||||
!record {model: product.product, id: product_product_ipod0}:
|
||||
categ_id: 'product.product_category_3'
|
||||
cost_method: standard
|
||||
mes_type: fixed
|
||||
name: iPod
|
||||
price_margin: 2.0
|
||||
procure_method: make_to_stock
|
||||
property_stock_inventory: stock.location_inventory
|
||||
property_stock_procurement: stock.location_procurement
|
||||
property_stock_production: stock.location_production
|
||||
seller_delay: '1'
|
||||
standard_price: 100.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
volume: 0.0
|
||||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
In order to test the purchase flow,I create a new record where "invoice_method" is From Order
|
||||
-
|
||||
Creating a purchase.order record
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_po0}:
|
||||
company_id: base.main_company
|
||||
date_order: '2010-05-11'
|
||||
invoice_method: order
|
||||
location_id: stock.stock_location_stock
|
||||
name: PO00003
|
||||
order_line:
|
||||
- date_planned: '2010-05-13'
|
||||
name: iPod
|
||||
price_unit: 100.0
|
||||
product_id: 'product_product_ipod0'
|
||||
product_qty: 10.0
|
||||
product_uom: product.product_uom_unit
|
||||
state: draft
|
||||
partner_address_id: base.res_partner_address_7
|
||||
partner_id: base.res_partner_4
|
||||
pricelist_id: purchase.list0
|
||||
-
|
||||
Initially purchase order is in the draft state
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po0}:
|
||||
- state == 'draft'
|
||||
-
|
||||
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po0")])
|
||||
-
|
||||
Performing a workflow action purchase_confirm on module purchase.order
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po0}
|
||||
-
|
||||
I check that the order which was initially in the draft state has transit to confirm state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po0}:
|
||||
- state == 'confirmed'
|
||||
-
|
||||
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po0"))
|
||||
pur_line=self.pool.get( 'purchase.order.line')
|
||||
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
|
||||
assert search_ids, _('Purchase order line is not created!')
|
||||
-
|
||||
To check that wizard "Create Invoices" gets called
|
||||
-
|
||||
Creating a purchase.order.line_invoice record
|
||||
-
|
||||
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
|
||||
{}
|
||||
-
|
||||
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
|
||||
-
|
||||
!python {model: purchase.order.line_invoice}: |
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
ids = []
|
||||
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po0"))
|
||||
for line in pur_id1.order_line:
|
||||
ids.append(line.id)
|
||||
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
|
||||
-
|
||||
I check that invoice gets created
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po0"))
|
||||
pur_line=self.pool.get( 'purchase.order.line')
|
||||
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
|
||||
assert search_ids, _('Invoice is not created!')
|
||||
-
|
||||
I check that a record gets created in the Pending Invoices
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_id1=self.browse(cr, uid, ref("purchase_order_po0"))
|
||||
account_obj = self.pool.get('account.invoice')
|
||||
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
assert ids, _('Pending Invoice is not created!')
|
||||
-
|
||||
Then an order is approved by clicking on the "Approved by Supplier" button
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
self.wkf_approve_order(cr, uid, [ref("purchase_order_po0")])
|
||||
-
|
||||
Performing a workflow action purchase_approve on module purchase.order
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po0}
|
||||
-
|
||||
I check that the order which was initially in the confirmed state has transit to approved state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po0}:
|
||||
- state == 'approved'
|
||||
-
|
||||
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id=self.browse(cr, uid, ref("purchase_order_po0"))
|
||||
assert(pur_id.date_approve)
|
||||
-
|
||||
I check that an entry gets created in the stock.picking
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id=self.browse(cr, uid, ref("purchase_order_po0"))
|
||||
assert(pur_id.picking_ids)
|
||||
-
|
||||
I check that an entry gets created in the stock.move
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_id1=self.browse(cr, uid, ref("purchase_order_po0"))
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
pick_id = picking_obj.browse(cr, uid, ids)[0]
|
||||
move_obj = self.pool.get('stock.move')
|
||||
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
|
||||
assert search_id, _('No Incoming Product!')
|
||||
-
|
||||
I check that Traceability moves are created
|
||||
-
|
||||
I check that an invoice_id field of Delivery&Invoices gets bind with the value
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id2=self.browse(cr, uid, ref("purchase_order_po0"))
|
||||
assert(pur_id2.invoice_id)
|
||||
@@ -0,0 +1,174 @@
|
||||
-
|
||||
In order to test the purchase flow,I start by creating a new product 'iPod'
|
||||
-
|
||||
!record {model: product.product, id: product_product_ipod0}:
|
||||
categ_id: 'product.product_category_3'
|
||||
cost_method: standard
|
||||
mes_type: fixed
|
||||
name: iPod
|
||||
price_margin: 2.0
|
||||
procure_method: make_to_stock
|
||||
property_stock_inventory: stock.location_inventory
|
||||
property_stock_procurement: stock.location_procurement
|
||||
property_stock_production: stock.location_production
|
||||
seller_delay: '1'
|
||||
standard_price: 100.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
volume: 0.0
|
||||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
In order to test the purchase flow,I create a new record where "invoice_method" is From Picking
|
||||
-
|
||||
Creating an purchase.order record
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_po2}:
|
||||
company_id: base.main_company
|
||||
date_order: '2010-05-11'
|
||||
invoice_method: picking
|
||||
location_id: stock.stock_location_stock
|
||||
name: PO00008
|
||||
order_line:
|
||||
- date_planned: '2010-05-13'
|
||||
name: iPod
|
||||
price_unit: 100.0
|
||||
product_id: 'product_product_ipod0'
|
||||
product_qty: 10.0
|
||||
product_uom: product.product_uom_unit
|
||||
state: draft
|
||||
partner_address_id: base.res_partner_address_7
|
||||
partner_id: base.res_partner_4
|
||||
pricelist_id: purchase.list0
|
||||
-
|
||||
Initially purchase order is in the draft state
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po2}:
|
||||
- state == 'draft'
|
||||
-
|
||||
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po2")])
|
||||
-
|
||||
Performing a workflow action purchase_confirm on module purchase.order
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po2}
|
||||
-
|
||||
I check that the order which was initially in the draft state has transit to confirm state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po2}:
|
||||
- state == 'confirmed'
|
||||
-
|
||||
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
pur_line=self.pool.get( 'purchase.order.line')
|
||||
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
|
||||
assert search_ids, _('Purchase order line is not created!')
|
||||
-
|
||||
To check that wizard "Create Invoices" gets opened
|
||||
-
|
||||
Creating a purchase.order.line_invoice record
|
||||
-
|
||||
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
|
||||
{}
|
||||
-
|
||||
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
|
||||
-
|
||||
!python {model: purchase.order.line_invoice}: |
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
ids = []
|
||||
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
|
||||
for line in pur_id1.order_line:
|
||||
ids.append(line.id)
|
||||
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
|
||||
-
|
||||
I check that invoice gets created
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
pur_line=self.pool.get( 'purchase.order.line')
|
||||
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
|
||||
assert search_ids, _('Invoice is not created!')
|
||||
-
|
||||
I check that a record gets created in the Pending Invoices
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_id1=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
account_obj = self.pool.get('account.invoice')
|
||||
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
assert ids, _('Pending Invoice is not created!')
|
||||
-
|
||||
Then an order is approved by clicking on the "Approved by Supplier" button
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
self.wkf_approve_order(cr, uid, [ref("purchase_order_po2")])
|
||||
-
|
||||
Performing a workflow action purchase_approve on module purchase.order
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po2}
|
||||
-
|
||||
I check that the order which was initially in the confirmed state has transit to approved state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po2}:
|
||||
- state == 'approved'
|
||||
-
|
||||
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
assert(pur_id.date_approve)
|
||||
-
|
||||
I check that an entry gets created in the stock.picking
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
assert(pur_id.picking_ids)
|
||||
-
|
||||
I check that an entry gets created in the stock.move
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
pur_id1=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
pick_id = picking_obj.browse(cr, uid, ids)[0]
|
||||
move_obj = self.pool.get('stock.move')
|
||||
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
|
||||
assert search_id, _('No Incoming Product!')
|
||||
-
|
||||
I check that Traceability moves are created
|
||||
-
|
||||
Then I create an invoice from picking by clicking on "Create Invoice" wizard
|
||||
-
|
||||
Creating a stock.invoice.onshipping record
|
||||
-
|
||||
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
|
||||
invoice_date: '2010-05-11'
|
||||
journal_id: account.bank_journal
|
||||
type: in_invoice
|
||||
-
|
||||
Performing an osv_memory action create_invoice on module stock.invoice.onshipping
|
||||
-
|
||||
!python {model: stock.invoice.onshipping}: |
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
|
||||
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
|
||||
"tz": False, "search_default_approved": 1, "active_model": "stock.picking",
|
||||
"active_ids": ids, "active_id": ids[0], })
|
||||
-
|
||||
I check that an invoice_id field of Delivery&Invoices gets bind with the value
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
pur_id2=self.browse(cr, uid, ref("purchase_order_po2"))
|
||||
assert(pur_id2.invoice_id)
|
||||
@@ -5,7 +5,7 @@
|
||||
<!-- Make the invoice-->
|
||||
|
||||
<record id="view_purchase_line_invoice" model="ir.ui.view">
|
||||
<field name="name">Control invoices</field>
|
||||
<field name="name">Create invoices</field>
|
||||
<field name="model">purchase.order.line_invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -21,7 +21,7 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Control invoices"
|
||||
<act_window name="Create invoices"
|
||||
res_model="purchase.order.line_invoice"
|
||||
src_model="purchase.order.line"
|
||||
view_mode="form"
|
||||
|
||||
@@ -60,7 +60,12 @@
|
||||
# 'process/sale_process.xml',
|
||||
],
|
||||
'demo_xml': ['sale_demo.xml'],
|
||||
'test': ['test/sale_procurement.yml'],
|
||||
'test': [
|
||||
'test/shipping_manual_sale_order.yml',
|
||||
# 'test/prepaid_sale_order.yml',
|
||||
'test/advance_invoice.yml',
|
||||
'test/sale_procurement.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0058103601429',
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
-
|
||||
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
|
||||
-
|
||||
I want to sell my mobile products to the customer with name Cleartrail
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_view0}:
|
||||
close_method: none
|
||||
code: View
|
||||
name: View
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_income0}:
|
||||
close_method: unreconciled
|
||||
code: Income
|
||||
name: Income
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_expense0}:
|
||||
close_method: unreconciled
|
||||
code: Expense
|
||||
name: Expense
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_cash0}:
|
||||
close_method: balance
|
||||
code: Cash
|
||||
name: Cash
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_minimalchart0}:
|
||||
code: '0'
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Minimal Chart
|
||||
parent_left: 1
|
||||
parent_right: 12
|
||||
type: view
|
||||
user_type: account_account_type_view0
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_payable1}:
|
||||
code: AP
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Payable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 2
|
||||
parent_right: 3
|
||||
reconcile: true
|
||||
type: payable
|
||||
user_type: account_account_type_expense0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_receivable0}:
|
||||
code: AR
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Receivable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 4
|
||||
parent_right: 5
|
||||
reconcile: true
|
||||
type: receivable
|
||||
user_type: account_account_type_income0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_cash0}:
|
||||
code: C
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Cash
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 6
|
||||
parent_right: 7
|
||||
type: other
|
||||
user_type: account_account_type_cash0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_purchases0}:
|
||||
code: P
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Purchases
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 8
|
||||
parent_right: 9
|
||||
type: other
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_sales0}:
|
||||
code: S
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Sales
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 10
|
||||
parent_right: 11
|
||||
type: other
|
||||
user_type: account_account_type_income0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_purchasejournal0}:
|
||||
code: PUJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_purchases0
|
||||
default_debit_account_id: account_account_purchases0
|
||||
name: Purchase Journal
|
||||
sequence_id: account.sequence_purchase_journal
|
||||
type: purchase
|
||||
view_id: account.account_journal_view
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_salejournal0}:
|
||||
code: SAJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_sales0
|
||||
default_debit_account_id: account_account_sales0
|
||||
name: Sale Journal
|
||||
sequence_id: account.sequence_sale_journal
|
||||
type: sale
|
||||
view_id: account.account_journal_view
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_bankjournal0}:
|
||||
code: BNK
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_cash0
|
||||
default_debit_account_id: account_account_cash0
|
||||
name: Bank Journal
|
||||
sequence_id: account.sequence_journal
|
||||
type: cash
|
||||
view_id: account.account_journal_bank_view
|
||||
|
||||
|
||||
-
|
||||
Creating a ir.property record
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_payable
|
||||
name: property_account_expense_categ
|
||||
value_reference: account.account,5
|
||||
|
||||
|
||||
-
|
||||
Creating a ir.property record
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_receivable
|
||||
name: property_account_income_categ
|
||||
value_reference: account.account,6
|
||||
-
|
||||
Creating a res.partner.category record
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_customers0}:
|
||||
name: Customers
|
||||
-
|
||||
Creating an res.partner record
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_cleartrail0}:
|
||||
category_id:
|
||||
- res_partner_category_customers0
|
||||
name: Cleartrail
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_1}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: onam plaza, 14 B palasia A B Road
|
||||
type: contact
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_2}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
type: invoice
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_3}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sangam house 15 B palasia, A B Road
|
||||
type: delivery
|
||||
-
|
||||
Customer Cleartrail has specific instrument requirements regarding the stockable products
|
||||
-
|
||||
Creating an product.category record
|
||||
-
|
||||
!record {model: product.category, id: product_category_allproductssellable0}:
|
||||
name: Mobile Products Sellable
|
||||
|
||||
|
||||
-
|
||||
Creating an product.category record
|
||||
-
|
||||
!record {model: product.category, id: product_category_services0}:
|
||||
name: Mobile Services
|
||||
-
|
||||
Creating an product.template record
|
||||
-
|
||||
!record {model: product.template, id: product_template_lgviewtysmart0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 170.0
|
||||
mes_type: fixed
|
||||
name: LG Viewty Smart
|
||||
procure_method: make_to_order
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
|
||||
-
|
||||
Creating an product.product record
|
||||
-
|
||||
!record {model: product.product, id: product_product_lgviewtysmart0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 170.0
|
||||
mes_type: fixed
|
||||
name: LG Viewty Smart
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
|
||||
procure_method: make_to_order
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
Creating a sale.order record
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so0}:
|
||||
date_order: '2010-05-03'
|
||||
invoice_quantity: order
|
||||
name: SO004
|
||||
order_line:
|
||||
- name: LG Viewty Smart
|
||||
price_unit: 170.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_lgviewtysmart0
|
||||
product_uos_qty: 500.0
|
||||
th_weight: 0.0
|
||||
type: make_to_order
|
||||
order_policy: prepaid
|
||||
partner_id: sale.res_partner_cleartrail0
|
||||
partner_invoice_id: sale.res_partner_address_2
|
||||
partner_order_id: sale.res_partner_address_1
|
||||
partner_shipping_id: sale.res_partner_address_3
|
||||
picking_policy: direct
|
||||
pricelist_id: product.list0
|
||||
shop_id: sale.shop
|
||||
|
||||
-
|
||||
Creating a sale.advance.payment.inv record
|
||||
-
|
||||
!record {model: sale.advance.payment.inv, id: sale_advance_payment_inv_0}:
|
||||
amount: 1000.0
|
||||
product_id: product.product_product_pc3
|
||||
qtty: 3.0
|
||||
|
||||
|
||||
-
|
||||
Performing an osv_memory action create_invoices on module sale.advance.payment.inv
|
||||
-
|
||||
!python {model: sale.advance.payment.inv}: |
|
||||
self.create_invoices(cr, uid, [ref("sale_advance_payment_inv_0")], {"lang": 'en_US',
|
||||
"active_model": 'sale.order', "active_ids": [ref("sale_order_so0")], "tz":
|
||||
False, "active_id": ref("sale_order_so0"), })
|
||||
-
|
||||
I will verify whether the invoice has been generated for SO since Shipping policy is 'Payment Before Delivery'
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
|
||||
|
||||
|
||||
@@ -0,0 +1,409 @@
|
||||
-
|
||||
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
|
||||
-
|
||||
I want to sell my mobile products to the customer with name Cleartrail
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_view0}:
|
||||
close_method: none
|
||||
code: View
|
||||
name: View
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_income0}:
|
||||
close_method: unreconciled
|
||||
code: Income
|
||||
name: Income
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_expense0}:
|
||||
close_method: unreconciled
|
||||
code: Expense
|
||||
name: Expense
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_cash0}:
|
||||
close_method: balance
|
||||
code: Cash
|
||||
name: Cash
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_minimalchart0}:
|
||||
code: '0'
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Minimal Chart
|
||||
parent_left: 1
|
||||
parent_right: 12
|
||||
type: view
|
||||
user_type: account_account_type_view0
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_payable1}:
|
||||
code: AP
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Payable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 2
|
||||
parent_right: 3
|
||||
reconcile: true
|
||||
type: payable
|
||||
user_type: account_account_type_expense0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_receivable0}:
|
||||
code: AR
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Receivable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 4
|
||||
parent_right: 5
|
||||
reconcile: true
|
||||
type: receivable
|
||||
user_type: account_account_type_income0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_cash0}:
|
||||
code: C
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Cash
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 6
|
||||
parent_right: 7
|
||||
type: other
|
||||
user_type: account_account_type_cash0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_purchases0}:
|
||||
code: P
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Purchases
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 8
|
||||
parent_right: 9
|
||||
type: other
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_sales0}:
|
||||
code: S
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Sales
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 10
|
||||
parent_right: 11
|
||||
type: other
|
||||
user_type: account_account_type_income0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_purchasejournal0}:
|
||||
code: PUJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_purchases0
|
||||
default_debit_account_id: account_account_purchases0
|
||||
name: Purchase Journal
|
||||
sequence_id: account.sequence_purchase_journal
|
||||
type: purchase
|
||||
view_id: account.account_journal_view
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_salejournal0}:
|
||||
code: SAJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_sales0
|
||||
default_debit_account_id: account_account_sales0
|
||||
name: Sale Journal
|
||||
sequence_id: account.sequence_sale_journal
|
||||
type: sale
|
||||
view_id: account.account_journal_view
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_bankjournal0}:
|
||||
code: BNK
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_cash0
|
||||
default_debit_account_id: account_account_cash0
|
||||
name: Bank Journal
|
||||
sequence_id: account.sequence_journal
|
||||
type: cash
|
||||
view_id: account.account_journal_bank_view
|
||||
|
||||
|
||||
-
|
||||
Creating a ir.property record
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_payable
|
||||
name: property_account_expense_categ
|
||||
value_reference: account.account,5
|
||||
|
||||
|
||||
-
|
||||
Creating a ir.property record
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_receivable
|
||||
name: property_account_income_categ
|
||||
value_reference: account.account,6
|
||||
-
|
||||
Creating a res.partner.category record
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_customers0}:
|
||||
name: Customers
|
||||
-
|
||||
Creating an res.partner record
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_cleartrail0}:
|
||||
category_id:
|
||||
- res_partner_category_customers0
|
||||
name: Cleartrail
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_1}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: onam plaza, 14 B palasia A B Road
|
||||
type: contact
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_2}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
type: invoice
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_3}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sangam house 15 B palasia, A B Road
|
||||
type: delivery
|
||||
-
|
||||
Customer Cleartrail has specific instrument requirements regarding the stockable products
|
||||
-
|
||||
Creating an product.category record
|
||||
-
|
||||
!record {model: product.category, id: product_category_allproductssellable0}:
|
||||
name: Mobile Products Sellable
|
||||
|
||||
|
||||
-
|
||||
Creating an product.category record
|
||||
-
|
||||
!record {model: product.category, id: product_category_services0}:
|
||||
name: Mobile Services
|
||||
-
|
||||
Creating an product.template record
|
||||
-
|
||||
!record {model: product.template, id: product_template_lgviewtysmart0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 170.0
|
||||
mes_type: fixed
|
||||
name: LG Viewty Smart
|
||||
procure_method: make_to_order
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
|
||||
-
|
||||
Creating an product.product record
|
||||
-
|
||||
!record {model: product.product, id: product_product_lgviewtysmart0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 170.0
|
||||
mes_type: fixed
|
||||
name: LG Viewty Smart
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
|
||||
procure_method: make_to_order
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
standard_price: 160.0
|
||||
supply_method: produce
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
-
|
||||
Creating a sale.order record
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so0}:
|
||||
date_order: '2010-05-03'
|
||||
invoice_quantity: order
|
||||
name: SO004
|
||||
order_line:
|
||||
- name: LG Viewty Smart
|
||||
price_unit: 170.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_lgviewtysmart0
|
||||
product_uos_qty: 500.0
|
||||
th_weight: 0.0
|
||||
type: make_to_order
|
||||
order_policy: prepaid
|
||||
partner_id: sale.res_partner_cleartrail0
|
||||
partner_invoice_id: sale.res_partner_address_2
|
||||
partner_order_id: sale.res_partner_address_1
|
||||
partner_shipping_id: sale.res_partner_address_3
|
||||
picking_policy: direct
|
||||
pricelist_id: product.list0
|
||||
shop_id: sale.shop
|
||||
|
||||
|
||||
-
|
||||
Performing a workflow action order_confirm on module sale.order
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
|
||||
-
|
||||
I will verify whether the invoice has been generated for SO since Shipping policy is 'Payment Before Delivery'
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
|
||||
-
|
||||
Performing a workflow action invoice_open on module account.invoice
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
invoice_ids = so.invoice_ids
|
||||
for invoice in invoice_ids:
|
||||
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
|
||||
-
|
||||
Creating a account.invoice.pay record
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
|
||||
amount: 85000.0
|
||||
date: '2010-05-10'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: tst
|
||||
period_id: account.period_5
|
||||
-
|
||||
Performing an osv_memory action wo_check on module account.invoice.pay
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
|
||||
|
||||
-
|
||||
Creating a account.invoice.pay.writeoff record
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
|
||||
|
||||
-
|
||||
Performing an osv_memory action pay_and_reconcile_writeoff on module account.invoice.pay.writeoff
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
|
||||
|
||||
|
||||
-
|
||||
I will verify the picking associated with the sale order sale_order_so0
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so0"
|
||||
-
|
||||
Creating a stock.partial.picking record
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
print "=====>>>>>>",partial_datas
|
||||
self.do_partial(cr, uid, picking_id,partial_datas)
|
||||
-
|
||||
I verify that picking order is in done state
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
@@ -0,0 +1,416 @@
|
||||
-
|
||||
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
|
||||
-
|
||||
I want to sell my mobile products to the customer with name Cleartrail
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_view0}:
|
||||
close_method: none
|
||||
code: View
|
||||
name: View
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_income0}:
|
||||
close_method: unreconciled
|
||||
code: Income
|
||||
name: Income
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_expense0}:
|
||||
close_method: unreconciled
|
||||
code: Expense
|
||||
name: Expense
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account.type record
|
||||
-
|
||||
!record {model: account.account.type, id: account_account_type_cash0}:
|
||||
close_method: balance
|
||||
code: Cash
|
||||
name: Cash
|
||||
sign: 1
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_minimalchart0}:
|
||||
code: '0'
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Minimal Chart
|
||||
parent_left: 1
|
||||
parent_right: 12
|
||||
type: view
|
||||
user_type: account_account_type_view0
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_payable1}:
|
||||
code: AP
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Payable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 2
|
||||
parent_right: 3
|
||||
reconcile: true
|
||||
type: payable
|
||||
user_type: account_account_type_expense0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_receivable0}:
|
||||
code: AR
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Receivable
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 4
|
||||
parent_right: 5
|
||||
reconcile: true
|
||||
type: receivable
|
||||
user_type: account_account_type_income0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_cash0}:
|
||||
code: C
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Cash
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 6
|
||||
parent_right: 7
|
||||
type: other
|
||||
user_type: account_account_type_cash0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_purchases0}:
|
||||
code: P
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Purchases
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 8
|
||||
parent_right: 9
|
||||
type: other
|
||||
user_type: account_account_type_expense0
|
||||
-
|
||||
Creating an account.account record
|
||||
-
|
||||
!record {model: account.account, id: account_account_sales0}:
|
||||
code: S
|
||||
company_id: base.main_company
|
||||
currency_mode: current
|
||||
name: Sales
|
||||
parent_id: account_account_minimalchart0
|
||||
parent_left: 10
|
||||
parent_right: 11
|
||||
type: other
|
||||
user_type: account_account_type_income0
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_purchasejournal0}:
|
||||
code: PUJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_purchases0
|
||||
default_debit_account_id: account_account_purchases0
|
||||
name: Purchase Journal
|
||||
sequence_id: account.sequence_purchase_journal
|
||||
type: purchase
|
||||
view_id: account.account_journal_view
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_salejournal0}:
|
||||
code: SAJ
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_sales0
|
||||
default_debit_account_id: account_account_sales0
|
||||
name: Sale Journal
|
||||
sequence_id: account.sequence_sale_journal
|
||||
type: sale
|
||||
view_id: account.account_journal_view
|
||||
|
||||
|
||||
-
|
||||
Creating an account.journal record
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_bankjournal0}:
|
||||
code: BNK
|
||||
company_id: base.main_company
|
||||
default_credit_account_id: account_account_cash0
|
||||
default_debit_account_id: account_account_cash0
|
||||
name: Bank Journal
|
||||
sequence_id: account.sequence_journal
|
||||
type: cash
|
||||
view_id: account.account_journal_bank_view
|
||||
|
||||
|
||||
-
|
||||
Creating a ir.property record
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_payable
|
||||
name: property_account_expense_categ
|
||||
value_reference: account.account,5
|
||||
|
||||
|
||||
-
|
||||
Creating a ir.property record
|
||||
-
|
||||
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
|
||||
company_id: base.main_company
|
||||
fields_id: account.field_res_partner_property_account_receivable
|
||||
name: property_account_income_categ
|
||||
value_reference: account.account,6
|
||||
-
|
||||
Creating a res.partner.category record
|
||||
-
|
||||
!record {model: res.partner.category, id: res_partner_category_customers0}:
|
||||
name: Customers
|
||||
-
|
||||
Creating an res.partner record
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_cleartrail0}:
|
||||
category_id:
|
||||
- res_partner_category_customers0
|
||||
name: Cleartrail
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_1}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: onam plaza, 14 B palasia A B Road
|
||||
type: contact
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_2}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
type: invoice
|
||||
|
||||
|
||||
-
|
||||
Creating an res.partner.address record
|
||||
-
|
||||
!record {model: res.partner.address, id: res_partner_address_3}:
|
||||
partner_id: res_partner_cleartrail0
|
||||
street: sangam house 15 B palasia, A B Road
|
||||
type: delivery
|
||||
-
|
||||
Customer Cleartrail has specific instrument requirements regarding the stockable products
|
||||
-
|
||||
Creating an product.category record
|
||||
-
|
||||
!record {model: product.category, id: product_category_allproductssellable0}:
|
||||
name: Mobile Products Sellable
|
||||
|
||||
|
||||
-
|
||||
Creating an product.category record
|
||||
-
|
||||
!record {model: product.category, id: product_category_services0}:
|
||||
name: Mobile Services
|
||||
-
|
||||
Creating an product.template record
|
||||
-
|
||||
!record {model: product.template, id: product_template_newchocolateslidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: New Chocolate Slider Mobile
|
||||
procure_method: make_to_order
|
||||
standard_price: 189.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
|
||||
-
|
||||
Creating an product.product record
|
||||
-
|
||||
!record {model: product.product, id: product_product_newchocolateslidermobile0}:
|
||||
categ_id: product_category_allproductssellable0
|
||||
cost_method: standard
|
||||
list_price: 200.0
|
||||
mes_type: fixed
|
||||
name: New Chocolate Slider Mobile
|
||||
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 189.00\n'
|
||||
pricelist_sale: 'Public Pricelist (0.00) : 200.00\n'
|
||||
procure_method: make_to_order
|
||||
property_account_expense: sale.account_account_payable1
|
||||
property_account_income: sale.account_account_receivable0
|
||||
seller_delay: '1'
|
||||
standard_price: 189.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
|
||||
|
||||
-
|
||||
Creating a sale.order record
|
||||
-
|
||||
!record {model: sale.order, id: sale_order_so0}:
|
||||
date_order: '2010-05-12'
|
||||
invoice_quantity: order
|
||||
name: SO001
|
||||
order_line:
|
||||
- name: New Chocolate Slider Mobile
|
||||
price_unit: 200.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 500.0
|
||||
state: draft
|
||||
delay: 7.0
|
||||
product_id: sale.product_product_newchocolateslidermobile0
|
||||
product_uos_qty: 500.0
|
||||
type: make_to_order
|
||||
order_policy: manual
|
||||
partner_id: sale.res_partner_cleartrail0
|
||||
partner_invoice_id: sale.res_partner_address_2
|
||||
partner_order_id: sale.res_partner_address_1
|
||||
partner_shipping_id: sale.res_partner_address_3
|
||||
picking_policy: direct
|
||||
pricelist_id: product.list0
|
||||
shop_id: sale.shop
|
||||
-
|
||||
Performing a workflow action order_confirm on module sale.order
|
||||
-
|
||||
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
|
||||
-
|
||||
I click on Create Invoice button to create the invoice.
|
||||
-
|
||||
Performing a workflow action manual_invoice on module sale.order
|
||||
-
|
||||
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so0}
|
||||
-
|
||||
I verify whether the invoice has been generated for SO
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
|
||||
-
|
||||
Performing a workflow action invoice_open on module account.invoice
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
import netsvc
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
invoice_ids = so.invoice_ids
|
||||
for invoice in invoice_ids:
|
||||
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
|
||||
-
|
||||
Creating a account.invoice.pay record
|
||||
-
|
||||
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
|
||||
amount: 100000.0
|
||||
date: '2010-05-10'
|
||||
journal_id: sale.account_journal_bankjournal0
|
||||
name: test
|
||||
period_id: account.period_5
|
||||
-
|
||||
Performing an osv_memory action wo_check on module account.invoice.pay
|
||||
-
|
||||
!python {model: account.invoice.pay}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "tz":
|
||||
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
|
||||
"out_invoice", "active_id": so.invoice_ids[0].id})
|
||||
|
||||
|
||||
-
|
||||
Creating a account.invoice.pay.writeoff record
|
||||
-
|
||||
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
|
||||
analytic_id: account.analytic_customers
|
||||
comment: Write-Off
|
||||
writeoff_acc_id: account.a_sale
|
||||
writeoff_journal_id: sale.account_journal_bankjournal0
|
||||
|
||||
|
||||
-
|
||||
Performing an osv_memory action pay_and_reconcile_writeoff on module account.invoice.pay.writeoff
|
||||
-
|
||||
!python {model: account.invoice.pay.writeoff}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
|
||||
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
|
||||
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
|
||||
-
|
||||
I verify the invoice are in paid state or not.
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
|
||||
invoice_ids = so.invoice_ids
|
||||
for invoice in invoice_ids:
|
||||
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
|
||||
-
|
||||
I will verify the picking associated with the sale order sale_order_so0
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
so = self.browse(cr, uid, ref("sale_order_so0"))
|
||||
assert so.picking_ids,"Picking has not been generated for sale_order_so0"
|
||||
-
|
||||
Creating a stock.partial.picking record
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
import time
|
||||
picking_id = self.search(cr, uid, [('origin','=','SO001'),('type','=','out')])
|
||||
if picking_id:
|
||||
pick=self.browse(cr,uid,picking_id[0])
|
||||
pick.force_assign(cr, uid)
|
||||
partial_datas = {
|
||||
'partner_id':pick.address_id.partner_id.id,
|
||||
'address_id': pick.address_id.id,
|
||||
'delivery_date' : time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
move = pick.move_lines[0]
|
||||
partial_datas['move%s'%(move.id)]= {
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_qty,
|
||||
'product_uom': move.product_uom.id,
|
||||
}
|
||||
self.do_partial(cr, uid, picking_id,partial_datas)
|
||||
-
|
||||
I verify that picking order is in done state
|
||||
-
|
||||
!python {model: stock.picking }: |
|
||||
picking_id = self.search(cr, uid, [('origin','=','SO001'),('type','=','out')])
|
||||
if picking_id:
|
||||
pick = self.browse(cr,uid,picking_id[0])
|
||||
assert (pick.state) =='done', "Picking for SO is not in done state."
|
||||
@@ -28,15 +28,19 @@ class report_stock_move(osv.osv):
|
||||
_description = "Stock Statistics"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'date_planned': fields.date('Date', readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'location_id':fields.many2one('stock.location', 'Location', readonly=True),
|
||||
'location_id': fields.many2one('stock.location', 'Source Location', readonly=True, select=True, help="Sets a location if you produce at a fixed location. This can be a partner location if you subcontract the manufacturing operations."),
|
||||
'location_dest_id': fields.many2one('stock.location', 'Dest. Location', readonly=True, select=True, help="Location where the system will stock the finished products."),
|
||||
'product_qty':fields.integer('Qty',readonly=True),
|
||||
'value' : fields.float('Total Value', required=True),
|
||||
'product_uom': fields.many2one('product.uom', 'Product UOM', readonly=True),
|
||||
'state': fields.selection([('draft', 'Draft'), ('waiting', 'Waiting'), ('confirmed', 'Confirmed'), ('assigned', 'Available'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, select=True,
|
||||
help='When the stock move is created it is in the \'Draft\' state.\n After that it is set to \'Confirmed\' state.\n If stock is available state is set to \'Avaiable\'.\n When the picking it done the state is \'Done\'.\
|
||||
\nThe state is \'Waiting\' if the move is waiting for another one.'),
|
||||
@@ -47,16 +51,24 @@ class report_stock_move(osv.osv):
|
||||
tools.drop_view_if_exists(cr, 'report_stock_move')
|
||||
cr.execute("""
|
||||
create or replace view report_stock_move as (
|
||||
select min(m.id) as id,
|
||||
m.date as date,
|
||||
to_char(date_trunc('day',m.date), 'YYYY') as year,
|
||||
to_char(date_trunc('day',m.date), 'MM') as month,
|
||||
to_char(date_trunc('day',m.date), 'YYYY-MM-DD') as day,
|
||||
m.location_id as location_id,
|
||||
m.product_id as product_id,
|
||||
m.state as state,
|
||||
sum(m.product_qty) as product_qty
|
||||
from stock_move as m group by m.product_id, m.location_id, m.id, m.date, m.state
|
||||
)
|
||||
select min(m.id) as id,
|
||||
m.date_planned as date_planned,
|
||||
to_char(date_trunc('day',m.date_planned), 'YYYY') as year,
|
||||
to_char(date_trunc('day',m.date_planned), 'MM') as month,
|
||||
to_char(date_trunc('day',m.date_planned), 'YYYY-MM-DD') as day,
|
||||
m.address_id as partner_id,
|
||||
m.location_id as location_id,
|
||||
m.location_dest_id as location_dest_id,
|
||||
m.product_id as product_id,
|
||||
m.state as state,
|
||||
m.product_uom as product_uom,
|
||||
sum(m.product_qty) as product_qty,
|
||||
pt.standard_price * sum(m.product_qty) as value
|
||||
from stock_move m ,product_product pp,product_template pt
|
||||
where
|
||||
m.product_id=pp.id and pp.product_tmpl_id=pt.id
|
||||
group by
|
||||
m.id, m.product_id,m.address_id, m.location_id, m.location_dest_id,
|
||||
m.date_planned, m.state, m.product_uom,pt.standard_price )
|
||||
""")
|
||||
report_stock_move()
|
||||
|
||||
@@ -7,14 +7,19 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Stock Orders Statistics">
|
||||
<field name="date"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="year" invisible="1" />
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="location_id" invisible="1"/>
|
||||
<field name="location_dest_id" invisible="1"/>
|
||||
<field name="product_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="location_id"/>
|
||||
<field name="product_uom"/>
|
||||
<field name="state"/>
|
||||
<field name="value"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -43,13 +48,14 @@
|
||||
domain="[('year','=',time.strftime('%%Y'))]"
|
||||
help="Stock Moves of the year"/>
|
||||
<filter icon="terp-stock"
|
||||
name="month"
|
||||
string="This Month"
|
||||
domain="[('month','=',time.strftime('%%m'))]"
|
||||
help="Stock Moves of this month"/>
|
||||
<filter icon="terp-stock"
|
||||
string="Current Stock"
|
||||
string="Today"
|
||||
separator="1"
|
||||
domain="[('date', '=', time.strftime('%%Y-%%m-%%d')]"
|
||||
domain="[('date_planned','>=', time.strftime('%%Y-%%m-%%d')), ('date_planned','<',(datetime.date.today()-datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Stock Moves of today"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
||||
@@ -64,22 +70,35 @@
|
||||
help = "Available Stock-Moves"/>
|
||||
|
||||
<filter string="Done"
|
||||
name="done"
|
||||
icon="terp-stock"
|
||||
domain="[('state','=','done')]"
|
||||
help = "Completed Stock-Moves"/>
|
||||
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock" string="Internal Locations" domain="[('location_id.usage','=','internal')]"/>
|
||||
<filter icon="terp-stock" string="Scrap Locations" domain="[('location_id.scrap_location','=',1)]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="product_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
|
||||
<separator orientation="vertical"/>
|
||||
<field name="product_id" widget="selection"/>
|
||||
<field name="location_id" widget="selection"/>
|
||||
<group expand="0" string="Extended options..." colspan="10" col="12">
|
||||
<field name="location_id" widget = "selection"/>
|
||||
<field name="location_dest_id" widget = "selection"/>
|
||||
<field name="date_planned"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." >
|
||||
<filter string="Product" icon="terp-stock" context="{'group_by':'product_id'}"/>
|
||||
<filter string="Location" icon="terp-stock" context="{'group_by':'location_id'}"/>
|
||||
<filter string="Partner" name="Partner" icon="terp-stock" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter name="product" string="Product" icon="terp-stock" context="{'group_by':'product_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter name="src_location" string="Source Location" icon="terp-stock" context="{'group_by':'location_id'}"/>
|
||||
<filter string="Dest. Location" icon="terp-stock" context="{'group_by':'location_dest_id'}"/>
|
||||
<filter string="State" icon="terp-stock" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-stock" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-stock" context="{'group_by':'date'}"/>
|
||||
<filter string="Month" icon="terp-stock" context="{'group_by':'date_planned'}"/>
|
||||
<filter string="Year" icon="terp-stock" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
</search>
|
||||
@@ -92,7 +111,7 @@
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_stock_search"/>
|
||||
|
||||
<field name="context">{'search_default_product':1, 'search_default_src_location':1,'search_default_done':1,'group_by':[]}</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
|
||||
+48
-16
@@ -350,7 +350,21 @@ stock_location()
|
||||
class stock_tracking(osv.osv):
|
||||
_name = "stock.tracking"
|
||||
_description = "Stock Tracking Lots"
|
||||
|
||||
|
||||
def get_create_tracking_lot(self, cr, uid, ids, context):
|
||||
tracking_id = context.get('tracking_id', False)
|
||||
tracking_id_list = self.search(cr, uid, [('name', '=', tracking_id)],
|
||||
limit=1)
|
||||
if tracking_id_list:
|
||||
tracking_id = tracking_id_list[0]
|
||||
tracking_obj = self.browse(cr, uid, tracking_id)
|
||||
if not tracking_obj:
|
||||
tracking_lot_vals = {
|
||||
'name': tracking_id
|
||||
}
|
||||
tracking_id = self.create(cr, uid, tracking_lot_vals,
|
||||
context=context)
|
||||
return tracking_id
|
||||
def checksum(sscc):
|
||||
salt = '31' * 8 + '3'
|
||||
sum = 0
|
||||
@@ -1494,9 +1508,12 @@ class stock_move(osv.osv):
|
||||
#self.action_cancel(cr,uid, ids2, context)
|
||||
return True
|
||||
|
||||
def action_done(self, cr, uid, ids, context=None):
|
||||
def action_done(self, cr, uid, ids, context={}):
|
||||
track_flag = False
|
||||
picking_ids = []
|
||||
product_uom_obj = self.pool.get('product.uom')
|
||||
price_type_obj = self.pool.get('product.price.type')
|
||||
move_obj = self.pool.get('account.move')
|
||||
for move in self.browse(cr, uid, ids):
|
||||
if move.picking_id: picking_ids.append(move.picking_id.id)
|
||||
if move.move_dest_id.id and (move.state != 'done'):
|
||||
@@ -1558,7 +1575,6 @@ class stock_move(osv.osv):
|
||||
journal_id = move.product_id.categ_id.property_stock_journal.id
|
||||
if acc_src != acc_dest:
|
||||
ref = move.picking_id and move.picking_id.name or False
|
||||
product_uom_obj = self.pool.get('product.uom')
|
||||
default_uom = move.product_id.uom_id.id
|
||||
date = time.strftime('%Y-%m-%d')
|
||||
q = product_uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, default_uom)
|
||||
@@ -1566,11 +1582,11 @@ class stock_move(osv.osv):
|
||||
amount = q * move.price_unit
|
||||
# Base computation on valuation price type
|
||||
else:
|
||||
company_id=move.company_id.id
|
||||
context['currency_id']=move.company_id.currency_id.id
|
||||
pricetype=self.pool.get('product.price.type').browse(cr,uid,move.company_id.property_valuation_price_type.id)
|
||||
amount_unit=move.product_id.price_get(pricetype.field, context)[move.product_id.id]
|
||||
amount=amount_unit * q or 1.0
|
||||
company_id = move.company_id.id
|
||||
context['currency_id'] = move.company_id.currency_id.id
|
||||
pricetype = price_type_obj.browse(cr,uid,move.company_id.property_valuation_price_type.id)
|
||||
amount_unit = move.product_id.price_get(pricetype.field, context)[move.product_id.id]
|
||||
amount = amount_unit * q or 1.0
|
||||
# amount = q * move.product_id.standard_price
|
||||
|
||||
partner_id = False
|
||||
@@ -1596,16 +1612,25 @@ class stock_move(osv.osv):
|
||||
'date': date,
|
||||
'partner_id': partner_id})
|
||||
]
|
||||
self.pool.get('account.move').create(cr, uid, {
|
||||
move_obj.create(cr, uid, {
|
||||
'name': move.name,
|
||||
'journal_id': journal_id,
|
||||
'line_id': lines,
|
||||
'ref': ref,
|
||||
})
|
||||
self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
for pick in self.pool.get('stock.picking').browse(cr, uid, picking_ids):
|
||||
tracking_id = False
|
||||
if context:
|
||||
tracking_id = context.get('tracking_id', False)
|
||||
if tracking_id:
|
||||
rec_id = context and context.get('active_id', False)
|
||||
tracking = self.pool.get('stock.tracking')
|
||||
tracking_id = tracking.get_create_tracking_lot(cr, uid,[rec_id], context=context )
|
||||
|
||||
self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S'), 'tracking_id': tracking_id or False})
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
for pick in picking_obj.browse(cr, uid, picking_ids):
|
||||
if all(move.state == 'done' for move in pick.move_lines):
|
||||
self.pool.get('stock.picking').action_done(cr, uid, [pick.id])
|
||||
picking_obj.action_done(cr, uid, [pick.id])
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
@@ -1819,7 +1844,8 @@ class stock_move(osv.osv):
|
||||
partner_id = partial_datas.get('partner_id', False)
|
||||
address_id = partial_datas.get('address_id', False)
|
||||
delivery_date = partial_datas.get('delivery_date', False)
|
||||
|
||||
tracking_id = context.get('tracking_id', False)
|
||||
|
||||
new_moves = []
|
||||
|
||||
complete, too_many, too_few = [], [], []
|
||||
@@ -1835,6 +1861,10 @@ class stock_move(osv.osv):
|
||||
product_price = partial_data.get('product_price',0.0)
|
||||
product_currency = partial_data.get('product_currency',False)
|
||||
if move.product_qty == product_qty:
|
||||
self.write(cr, uid, move.id,
|
||||
{
|
||||
'tracking_id': tracking_id
|
||||
})
|
||||
complete.append(move)
|
||||
elif move.product_qty > product_qty:
|
||||
too_few.append(move)
|
||||
@@ -1879,6 +1909,7 @@ class stock_move(osv.osv):
|
||||
'state': 'assigned',
|
||||
'move_dest_id': False,
|
||||
'price_unit': move.price_unit,
|
||||
'tracking_id': tracking_id,
|
||||
})
|
||||
complete.append(self.browse(cr, uid, new_move))
|
||||
self.write(cr, uid, move.id,
|
||||
@@ -1891,13 +1922,14 @@ class stock_move(osv.osv):
|
||||
for move in too_many:
|
||||
self.write(cr, uid, move.id,
|
||||
{
|
||||
'product_qty': product_qty,
|
||||
'product_uos_qty': product_qty
|
||||
'product_qty': move.product_qty,
|
||||
'product_uos_qty': move.product_qty,
|
||||
'tracking_id': tracking_id
|
||||
})
|
||||
complete.append(move)
|
||||
|
||||
for move in complete:
|
||||
self.action_done(cr, uid, [move.id])
|
||||
self.action_done(cr, uid, [move.id], context)
|
||||
|
||||
# TOCHECK : Done picking if all moves are done
|
||||
cr.execute("""
|
||||
|
||||
@@ -1440,6 +1440,7 @@
|
||||
<field name="backorder_id" groups="base.group_extended"/>
|
||||
<field name="state"/>
|
||||
<button name="%(action_partial_move)d" string="Partial" type="action" states="assigned" icon="gtk-justify-fill"/>
|
||||
<button name="action_done" states="assigned" string="Done" type="object" icon="gtk-jump-to"/>
|
||||
<button name="action_cancel" states="assigned,confirmed" string="Cancel" type="object" icon="gtk-cancel"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -1513,6 +1514,10 @@
|
||||
<field name="product_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col='8' colspan='14' expand="1" string="Tracking Lots">
|
||||
<field name="tracking_id" context="{'tracking_id': self}" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="4" col="8">
|
||||
<filter string="Product" icon="terp-stock" domain="[]" context="{'group_by':'product_id'}"/>
|
||||
<filter string="State" icon="terp-stock" domain="[]" context="{'group_by':'state'}"/>
|
||||
|
||||
@@ -30,3 +30,4 @@
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
|
||||
@@ -186,6 +186,12 @@ class stock_partial_move(osv.osv_memory):
|
||||
return res
|
||||
|
||||
def do_partial(self, cr, uid, ids, context):
|
||||
rec_id = context and context.get('active_id', False)
|
||||
tracking_id = context.get('tracking_id', False)
|
||||
if tracking_id:
|
||||
tracking = self.pool.get('stock.tracking')
|
||||
tracking_id = tracking.get_create_tracking_lot(cr, uid,[rec_id], context=context )
|
||||
context ['tracking_id'] = tracking_id
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_ids = context.get('active_ids', False)
|
||||
partial = self.browse(cr, uid, ids[0], context)
|
||||
@@ -208,7 +214,6 @@ class stock_partial_move(osv.osv_memory):
|
||||
'product_price' : getattr(partial, 'move%s_product_price'%(m.id)),
|
||||
'product_currency': getattr(partial, 'move%s_product_currency'%(m.id)).id
|
||||
})
|
||||
|
||||
res = move_obj.do_partial(cr, uid, move_ids, partial_datas, context=context)
|
||||
return {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user