[REM] account_voucher, purchase, mrp_byproduct: remove dead code
purchase, mrp_byproduct: remove unused tests account_voucher: removed unused method in account_voucher that was still refering a removed workflow.
This commit is contained in:
committed by
Thibault Delavallée
parent
7d09971a35
commit
8dd5af673a
@@ -137,11 +137,6 @@ class AccountVoucher(models.Model):
|
||||
self.account_id = self.journal_id.default_debit_account_id \
|
||||
if self.voucher_type == 'sale' else self.journal_id.default_credit_account_id
|
||||
|
||||
@api.multi
|
||||
def button_proforma_voucher(self):
|
||||
self.signal_workflow('proforma_voucher')
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
@api.multi
|
||||
def proforma_voucher(self):
|
||||
self.action_move_line_create()
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
-
|
||||
In order to test mrp_byproduct with OpenERP, I add byproduct in bill of material.
|
||||
I make a production order, confirm it so stock moves for byproducts are generated.
|
||||
-
|
||||
I add a sub product in Bill of material for product Datacard with Switch, 24
|
||||
ports as byproduct
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp.mrp_bom_kit}:
|
||||
product_id: product.product_delivery_02
|
||||
product_uom: product.product_uom_unit
|
||||
sub_products:
|
||||
- product_id: product.product_delivery_01
|
||||
product_uom: product.product_uom_unit
|
||||
product_qty: 3.0
|
||||
subproduct_type: fixed
|
||||
-
|
||||
I create a production order for 2 Datacard.
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_mo0}:
|
||||
product_id: product.product_delivery_02
|
||||
product_qty: 2.0
|
||||
product_uom: product.product_uom_unit
|
||||
bom_id: mrp.mrp_bom_kit
|
||||
location_src_id: stock.stock_location_stock
|
||||
-
|
||||
I compute the data of production order.
|
||||
-
|
||||
!python {model: mrp.production, id: mrp_production_mo0}: |
|
||||
self.with_context({"active_ids": [ref("mrp_production_mo0")],"active_id": ref("mrp_production_mo0")}).action_compute()
|
||||
-
|
||||
I confirm the production order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
|
||||
-
|
||||
I check production order state.
|
||||
-
|
||||
!assert {model: mrp.production, id: mrp_production_mo0, severity: error, string: Production order should be in state confirmed}:
|
||||
- state == 'confirmed'
|
||||
-
|
||||
Now I check the stock moves for the byproduct I created in the bill of material.
|
||||
This move is created automatically when I confirmed the production order.
|
||||
-
|
||||
!python {model: stock.move, id: False}: |
|
||||
production_order = self.env['mrp.production'].browse(ref("mrp_production_mo0"))
|
||||
move = self.search([('origin','=',production_order.name), ('product_id','=',ref('product.product_delivery_01'))], limit=1)
|
||||
assert move, 'No move are created !'
|
||||
assert move.product_uom_qty == 3, "Incorrect quantity for byproduct move"
|
||||
-
|
||||
I want to start the production so I force the reservation of products.
|
||||
-
|
||||
!python {model: mrp.production, id: mrp_production_mo0}: |
|
||||
self.with_context({"active_ids":[ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"),}).force_production()
|
||||
-
|
||||
I start the production.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
|
||||
-
|
||||
I consume and produce the production of products.
|
||||
-
|
||||
I create record for selecting mode and quantity of products to produce.
|
||||
-
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce0}:
|
||||
product_qty: 2.00
|
||||
mode: 'consume_produce'
|
||||
-
|
||||
I finish the production order.
|
||||
-
|
||||
!python {model: mrp.product.produce, id: mrp_product_produce0}: |
|
||||
ctx = context.copy()
|
||||
ctx['active_id'] = self.id
|
||||
self.with_context(ctx).on_change_qty()
|
||||
self.with_context({"active_model": "mrp.production", "active_ids":[ref("mrp_production_mo0")], "active_id": ref("mrp_production_mo0")}).do_produce()
|
||||
-
|
||||
I see that stock moves of External Hard Disk including Headset USB are done now.
|
||||
-
|
||||
!python {model: stock.move, id: False}: |
|
||||
production_order = self.env['mrp.production'].browse(ref("mrp_production_mo0"))
|
||||
moves = self.search([('origin','=',production_order.name), ('product_id','in',[ref("product.product_delivery_02"),ref("product.product_delivery_01")])])
|
||||
assert all(moves.state == 'done' for moves in moves), 'Moves are not done
|
||||
@@ -1,138 +0,0 @@
|
||||
-
|
||||
Set a product as using average price.
|
||||
-
|
||||
!record {model: product.product, id: product_variable_icecream}:
|
||||
default_code: VARAVG
|
||||
name: Variable Ice Cream
|
||||
type: product
|
||||
categ_id: product.product_category_1
|
||||
uom_id: product.product_uom_kgm
|
||||
uom_po_id: product.product_uom_kgm
|
||||
procure_method: make_to_stock
|
||||
valuation: real_time
|
||||
cost_method: average
|
||||
property_stock_account_input: account.o_expense
|
||||
property_stock_account_output: account.o_income
|
||||
description: Average Ice Cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events.
|
||||
-
|
||||
I create a draft Purchase Order for first incoming shipment for 10 pieces at 60€
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_variable1}:
|
||||
partner_id: base.res_partner_3
|
||||
order_line:
|
||||
- product_id: product_variable_icecream
|
||||
product_qty: 10.0
|
||||
product_uom: product.product_uom_categ_kgm
|
||||
price_unit: 60.0
|
||||
name: 'Average Ice Cream'
|
||||
-
|
||||
I create a draft Purchase Order for second incoming shipment for 30 pieces at 80€
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_variable2}:
|
||||
partner_id: base.res_partner_3
|
||||
order_line:
|
||||
- product_id: product_variable_icecream
|
||||
product_qty: 30.0
|
||||
product_uom: product.product_uom_categ_kgm
|
||||
price_unit: 80.0
|
||||
name: 'Average Ice Cream'
|
||||
-
|
||||
I confirm the first purchase order
|
||||
-
|
||||
!python {model: purchase.order, id: purchase_order_variable1}: |
|
||||
self.button_confirm()
|
||||
-
|
||||
I confirm the second purchase order
|
||||
-
|
||||
!python {model: purchase.order, id: purchase_order_variable2}: |
|
||||
self.button_confirm()
|
||||
-
|
||||
I check the "Approved" status of purchase order 1
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_variable1}:
|
||||
- state == 'purchase'
|
||||
-
|
||||
Process the reception of purchase order 1
|
||||
-
|
||||
!python {model: stock.partial.picking, id: False}: |
|
||||
pickings = self.env['purchase.order'].browse(ref("purchase_order_variable1")).picking_ids
|
||||
partial = self.with_context({'active_model': 'stock.picking','active_ids': [pickings[0].id]}).create({})
|
||||
partial.do_transfer()
|
||||
-
|
||||
Check the standard price of the product (variable icecream).
|
||||
-
|
||||
!python {model: product.product, id: product_variable_icecream}: |
|
||||
assert self.qty_available == 10.0, 'Wrong quantity in stock after first reception'
|
||||
assert self.standard_price == 60.0, 'Standard price should be the price of the first reception!'
|
||||
-
|
||||
Process the reception of purchase order 2
|
||||
-
|
||||
!python {model: stock.partial.picking, id: False}: |
|
||||
pickings = self.env['purchase.order'].browse(ref("purchase_order_variable2")).picking_ids
|
||||
partial = self.with_context({'active_model': 'stock.picking','active_ids': [pickings[0].id]}).create({})
|
||||
partial.do_transfer()
|
||||
-
|
||||
Check the standard price and change the product's cost method towards fifo
|
||||
-
|
||||
!python {model: product.product, id: product_variable_icecream}: |
|
||||
assert self.standard_price == 75.0, 'After second reception, we should have an average price of 75.0 on the product'
|
||||
self.write({'cost_method': 'real'})
|
||||
-
|
||||
Create picking to send some goods
|
||||
-
|
||||
!record {model: stock.picking, id: outgoing_variable_shipment}:
|
||||
type: out
|
||||
-
|
||||
Create move for picking
|
||||
-
|
||||
!record {model: stock.move, id: outgoing_shipment_variable_icecream}:
|
||||
picking_id: outgoing_variable_shipment
|
||||
product_id: product_variable_icecream
|
||||
product_uom: product.product_uom_kgm
|
||||
product_qty: 20.0
|
||||
type: out
|
||||
-
|
||||
I confirm outgoing shipment of 20 kg of Variable Ice Cream.
|
||||
-
|
||||
!workflow {model: stock.picking, action: button_confirm, ref: outgoing_variable_shipment}
|
||||
-
|
||||
Process the delivery of the outgoing shipment
|
||||
-
|
||||
!python {model: stock.partial.picking, id: False}: |
|
||||
partial = self.with_context({'active_model': 'stock.picking','active_ids': [ref("outgoing_variable_shipment")], 'default_type':'out'}).create({})
|
||||
partial.do_transfer()
|
||||
-
|
||||
Check the standard price (60 * 10 + 30 * 80) / 40 = 75.0 did not change
|
||||
-
|
||||
!python {model: product.product, id: product_variable_icecream}: |
|
||||
assert self.standard_price == 75.0, 'Standard price should not have changed with outgoing picking!'
|
||||
assert self.qty_available == 20.0, 'Pieces were not picked correctly as the quantity on hand is wrong'
|
||||
-
|
||||
I create a draft Purchase Order for third incoming shipment for 20 pieces at 60 euro
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_variable3}:
|
||||
partner_id: base.res_partner_3
|
||||
order_line:
|
||||
- product_id: product_variable_icecream
|
||||
product_qty: 20.0
|
||||
product_uom: product.product_uom_categ_kgm
|
||||
price_unit: 60.0
|
||||
name: 'Variable Ice Cream'
|
||||
-
|
||||
I confirm this third purchase order
|
||||
-
|
||||
!python {model: purchase.order, id: purchase_order_variable3}: |
|
||||
self.button_confirm()
|
||||
-
|
||||
Process the reception of purchase order 3
|
||||
-
|
||||
!python {model: stock.partial.picking, id: False}: |
|
||||
pickings = self.env['purchase.order'].browse(ref("purchase_order_variable3")).picking_ids
|
||||
partial = self.with_context({'active_model': 'stock.picking','active_ids': [pickings[0].id]}).create({})
|
||||
partial.do_transfer()
|
||||
-
|
||||
Change the cost method back to average and check price on product changed back to 70.0 = (20*60 + 10*60 + 30*80) / 60
|
||||
-
|
||||
!python {model: product.product, id: product_variable_icecream}: |
|
||||
self.write({'cost_method': 'average'})
|
||||
assert self.standard_price == 70.0, 'After third reception and changing to average again, we should have an average price of 70.0 on the product'
|
||||
Reference in New Issue
Block a user