[MERGE] team1's work of sprint 21-22

bzr revid: qdp@cyan-20100610141130-h3dn7r9t40i9qod3
This commit is contained in:
Quentin De Paoli
2010-06-10 16:11:30 +02:00
129 changed files with 3029 additions and 1079 deletions
+1
View File
@@ -60,6 +60,7 @@
'auction_wizard.xml'
],
'demo_xml': ['auction_demo.xml'],
# 'test' : ['test/auction.yml','test/auction_wizard.yml'],
'installable': True,
'active': False,
'certificate': '0039333102717',
+204
View File
@@ -0,0 +1,204 @@
-
In order to test the auction module in the Open-ERP I start the process by creating a product.
-
I create a new product furniture.
-
!record {model: product.product, id: product_product_furniture0}:
categ_id: product.cat1
cost_method: standard
mes_type: fixed
name: Furniture
procure_method: make_to_stock
standard_price: 1.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
-
I create a new artist for an object.
-
!record {model: auction.artists, id: auction_artists_vincentvangogh0}:
birth_death_dates: 1853-1900
name: Vincent van Gogh
-
Now I want to associate an object with the auction so for that I create an auction "Antique furniture exhibition"
-
!record {model: auction.dates, id: auction_dates_antiquefurnitureexhibition0}:
acc_expense: account.a_pay
acc_income: account.a_recv
account_analytic_id: account.analytic_root
auction1: '2010-05-20'
auction2: '2010-05-21'
expo1: '2010-05-18'
expo2: '2010-05-19'
journal_id: account.expenses_journal
journal_seller_id: account.sales_journal
name: Antique furniture exhibition
-
An object is being deposited for an auction,I create a seller's deposit record.
-
!record {model: auction.deposit, id: auction_deposit_ad0}:
date_dep: '2010-05-18'
method: keep
name: AD/006
partner_id: base.res_partner_4
-
I create a new object wooden-chair which is to be auctioned.
-
!record {model: auction.lots, id: auction_lots_woodenchair0}:
ach_uid: base.res_partner_2
artist_id: auction_artists_vincentvangogh0
auction_id: auction_dates_antiquefurnitureexhibition0
bord_vnd_id: auction_deposit_ad0
lot_est1: 3000.0
lot_est2: 5000.0
lot_num: 1
name: wooden-chair
name2: antique wooden chair
obj_num: 1
obj_price: 4000.0
obj_ret: 5000.0
product_id: 'product_product_furniture0'
state: draft
vnd_lim: 5000.0
-
I create a bid for an object "wooden-chair" which is to be auctioned in Antique furniture exhibition.
-
!record {model: auction.bid, id: auction_bid_bid0}:
auction_id: auction_dates_antiquefurnitureexhibition0
contact_tel: (+32)2 211 34 83
name: bid/001
partner_id: auction.partner_record1
-
I create a bid line.
-
!record {model: auction.bid_line, id: auction_bid_line_0}:
auction: Antique furniture exhibition
bid_id: auction_bid_bid0
lot_id: auction.auction_lots_woodenchair0
price: 3500.0
-
I create another bid for an object "wooden-chair" bided by a different partner
-
!record {model: auction.bid, id: auction_bid_bid1}:
auction_id: auction_dates_antiquefurnitureexhibition0
name: bid/002
partner_id: base.res_partner_2
-
I create a bid line.
-
!record {model: auction.bid_line, id: auction_bid_line_1}:
auction: Antique furniture exhibition
bid_id: 'auction_bid_bid1'
call: 1
lot_id: auction.auction_lots_woodenchair0
price: 4000.0
-
I check that buyer price and seller price gets bind with the value
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
assert(auc_id.buyer_price,auc_id.seller_price), _('Buyer price and seller price are not available!')
-
I check that a record gets created in the Seller's Summary.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
auc_deposit_obj=self.pool.get('auction.deposit')
rep_sell_obj = self.pool.get('report.seller.auction')
ids =rep_sell_obj.search(cr, uid, [('auction', '=', auc_id.auction_id.id),('seller', '=',auc_id.bord_vnd_id.partner_id.id)])
assert ids, _('No record found!')
-
I check that a record gets created in the Seller's Revenues.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
auc_deposit_obj=self.pool.get('auction.deposit')
rep_sell_obj = self.pool.get('report.seller.auction2')
ids =rep_sell_obj.search(cr, uid, [('auction', '=', auc_id.auction_id.id),('seller', '=',auc_id.bord_vnd_id.partner_id.id)])
assert ids, _('No record found!')
-
I check that a record gets created in the Buyer's Summary.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id1=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
rep_buy_obj1 = self.pool.get('report.buyer.auction')
ids1=rep_buy_obj1.search(cr, uid, [('auction', '=', auc_id1.auction_id.id),('buyer', '=',auc_id1.ach_uid.id)])
assert ids1, _('No record found!')
-
I check that a record gets created in the Buyer's Revenue.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id1=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
rep_buy_obj1 = self.pool.get('report.buyer.auction2')
ids1=rep_buy_obj1.search(cr, uid, [('auction', '=', auc_id1.auction_id.id),('buyer', '=',auc_id1.ach_uid.id)])
assert ids1, _('No record found!')
-
I check that a record gets created in the Auction's Summary.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id2=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
rep_auc_obj1 = self.pool.get('report.auction.view')
ids2=rep_auc_obj1.search(cr, uid, [('auction_id', '=', auc_id2.auction_id.id)])
assert ids2, _('No record found!')
-
I check that a record gets created in the Auction's Revenues.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id3=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
rep_auc_obj1 = self.pool.get('report.auction.view2')
ids3=rep_auc_obj1.search(cr, uid, [('auction', '=', auc_id3.auction_id.id)])
assert ids3, _('No record found!')
-
An object has been sold,so I click on the "Sold" button.
-
!python {model: auction.lots}: |
self.button_bought(cr, uid, [ref("auction_lots_woodenchair0")], {"lang": "en_US", "tz":
False, "active_model": "ir.ui.menu", "active_ids": [ref("auction.auction_lots_woodenchair0")],
"active_id": ref("auction.auction_lots_woodenchair0")})
-
I check that the order which was initially in the draft state has transit to sold state.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
assert(auc_id.state == 'sold'), _('State not changed!')
-
Then I click on the Taken Away button.
-
!python {model: auction.lots}: |
self.button_taken_away(cr, uid, [ref("auction_lots_woodenchair0")], {"lang":
"en_US", "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("auction.auction_all_objects_menu")],
"active_id": ref("auction.auction_all_objects_menu")})
-
I check that the order which was initially in the sold state has transit to taken away state.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
assert(auc_id.state == 'taken_away'), _('State not changed!')
-
I click on the "Close + Create all invoices" button
-
!python {model: auction.dates}: |
self.close(cr, uid, [ref("auction.auction_dates_antiquefurnitureexhibition0")],
{"lang": "en_US", "tz": False, "active_model": "ir.ui.menu", "active_ids":
[ref("auction.menu_auction_dates_next1")], "active_id": ref("auction.menu_auction_dates_next1")})
-
I check that a record gets created in the "Supplier Invoices".
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
assert(auc_id.sel_inv_id), _('Seller Invoice has not been created!')
+248
View File
@@ -0,0 +1,248 @@
-
In order to test the wizards of auction module I create a new record.
-
I start the process by creating a new product Paintings.
-
!record {model: product.product, id: product_product_paintings0}:
categ_id: product.cat1
cost_method: standard
mes_type: fixed
name: Paintings
procure_method: make_to_stock
standard_price: 1.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
-
I create a new artist-Picasso's record.
-
!record {model: auction.artists, id: auction_artists_picasso0}:
birth_death_dates: 1881-1973
name: Picasso
-
Now I want to associate an object with the auction so for that I create an auction "Picasso's painting exhibition"
-
!record {model: auction.dates, id: auction_dates_picassospaintingexhibition0}:
acc_expense: account.a_pay
acc_income: account.a_recv
account_analytic_id: account.analytic_root
auction1: '2010-05-24'
auction2: '2010-05-25'
expo1: '2010-05-21'
expo2: '2010-05-22'
journal_id: account.expenses_journal
journal_seller_id: account.sales_journal
name: Picasso's painting exhibition
-
An object is being deposited for an auction,I create a seller's deposit record.
-
!record {model: auction.deposit, id: auction_deposit_ad1}:
date_dep: '2010-05-18'
method: keep
name: AD/007
partner_id: base.res_partner_9
-
I create a new object painting which is to be auctioned.
-
!record {model: auction.lots, id: auction_lots_painting0}:
ach_login: 'Mr.Chang'
artist_id: auction.auction_artists_picasso0
auction_id: auction_dates_picassospaintingexhibition0
bord_vnd_id: auction_deposit_ad1
lot_est1: 2000.0
lot_est2: 4000.0
lot_num: 2
name: painting
name2: picasso_painting
obj_num: 2
obj_price: 3500.0
obj_ret: 4000.0
product_id: auction.product_product_paintings0
state: draft
vnd_lim: 4000.0
-
I assign the buyer through "Map buyer user name to Partners" wizard.
-
!record {model: auction.lots.buyer_map, id: auction_lots_buyer_map_0}:
ach_login: 'Mr.Chang'
ach_uid: base.res_partner_3
-
I click on the "Update" button.
-
!python {model: auction.lots.buyer_map}: |
auc_obj=self.pool.get('auction.lots')
ids=self.browse(cr, uid, ref("auction_lots_painting0"))
self.buyer_map_set(cr, uid, [ref("auction_lots_buyer_map_0")], {"lang": "en_US",
"tz": False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")],
"active_id": ref("auction_lots_painting0")})
-
I check that the buyer field gets bind with the value.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_painting0"))
assert(auc_id.ach_uid), _('Buyer not assigned!')
-
I mark that a seller has been paid by using the "Mark as paid for seller" wizard.
-
!record {model: auction.payer.sel, id: auction_payer_sel_0}:
{}
-
I click on the "Pay" button.
-
!python {model: auction.payer.sel}: |
self.payer_sel(cr, uid, [ref("auction_payer_sel_0")], {"lang": "en_US", "tz":
False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")], "active_id": ref("auction_lots_painting0")})
-
I check that the Seller paid field is set to True.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_painting0"))
assert(auc_id.paid_vnd == True), _('Seller paid is not marked!')
-
I use the "Mark as taken away" wizard to indicate that an object is taken away.
-
!record {model: auction.lots.able, id: auction_lots_able_0}:
{}
-
Then I click on the "Able Taken away" wizard.
-
!python {model: auction.lots.able}: |
self.confirm_able(cr, uid, [ref("auction_lots_able_0")], {"lang":"en_US", "tz":
False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")],
"active_id": ref("auction_lots_painting0")})
-
I check that Taken away field is set to True.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_painting0"))
assert(auc_id.ach_emp == True), _('Taken away is not marked!')
-
I use the "Unmark as taken away" wizard to unmark the Taken Away field.
-
!record {model: auction.lots.enable, id: auction_lots_enable_0}:
confirm_en: 0.0
-
Then I click on the "Enable Taken away" button.
-
!python {model: auction.lots.enable}: |
self.confirm_enable(cr, uid, [ref("auction_lots_enable_0")], {"lang": "en_US",
"tz": False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")],
"active_id": ref("auction_lots_painting0"),})
-
I check that Taken away field is set to False.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_painting0"))
assert(auc_id.ach_emp == False), _('Taken away is marked!')
-
I create statement lines for an object's payment by using the "Pay objects of the buyer" wizard
-
I create a bank statement.
-
!record {model: account.bank.statement, id: account_bank_statement_st0}:
balance_end_real: 0.0
date: '2010-05-19'
journal_id: account.bank_journal
name: St. 05/19
period_id: account.period_5
state: draft
-
I create auction payment record.
-
!record {model: auction.pay.buy, id: auction_pay_buy_0}:
amount: 2000.0
amount2: 1000.0
amount3: 1000.0
buyer_id: base.res_partner_2
statement_id1: account_bank_statement_st0
statement_id2: account_bank_statement_st0
statement_id3: account_bank_statement_st0
total: 4000.0
-
Then I click "Pay" button.
-
!python {model: auction.pay.buy}: |
self.pay_and_reconcile(cr, uid, [ref("auction_pay_buy_0")], {"lang": "en_US", "tz":
False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")],
"active_id": ref("auction_lots_painting0"),})
-
I check that a record gets created in the 'auction_statement_line_rel' table
-
!python {model: auction.lots}: |
from tools.translate import _
cr.execute("select statement from auction_statement_line_rel,auction_lots where auction_lots.id=auction_statement_line_rel.auction_id AND auction_lots.name='painting'")
ans=cr.fetchall()
assert ans, _('statement_id not found!')
-
I create the seller's invoice by using the "Invoice Seller objects" wizard.
-
!record {model: auction.lots.make.invoice, id: auction_lots_make_invoice_0}:
amount: 3500.0
number: 2010/002
objects: 1
-
Then I click on the "Create Invoices" button.
-
!python {model: auction.lots.make.invoice}: |
self.makeInvoices(cr, uid, [ref("auction_lots_make_invoice_0")], {"lang": "en_US",
"active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")],
"tz": False, "active_id": ref("auction_lots_painting0"),})
-
I check that a "Seller Invoice" field gets bind with the value.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_painting0"))
assert(auc_id.sel_inv_id), _('Seller Invoice has not been created!')
-
I create a buyer's invoice by using the "Invoice Buyer objects" wizard.
-
!record {model: auction.lots.make.invoice.buyer, id: auction_lots_make_invoice_buyer_0}:
amount: 3500.0
buyer_id: base.res_partner_3
number: 2010/003
objects: 1
-
Then I click on the "Create Invoices" button.
-
!python {model: auction.lots.make.invoice.buyer}: |
self.makeInvoices(cr, uid, [ref("auction_lots_make_invoice_buyer_0")], {"lang":
"en_US", "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")],
"tz": False, "active_id": ref("auction_lots_painting0"), })
-
I check that a "Buyer Invoice" field gets bind with the value.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_painting0"))
assert(auc_id.ach_inv_id), _('Seller Invoice has not been created!')
-
In order to change the auction for an object I use the "Change auction date" wizard.
-
!record {model: auction.lots.auction.move, id: auction_lots_auction_move_0}:
auction_id: auction.auction_date_2
-
Then I click on the "Move to Auction date" button.
-
!python {model: auction.lots.auction.move}: |
self.auction_move_set(cr, uid, [ref("auction_lots_auction_move_0")], {"lang":
"en_US", "tz": False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_painting0")],
"active_id": ref("auction_lots_painting0"), })
-
I check that a record gets created in the lot history.
-
!python {model: auction.lots}: |
from tools.translate import _
auc_id=self.browse(cr, uid, ref("auction_lots_painting0"))
auc_lot_his=self.pool.get('auction.lot.history')
ids=auc_lot_his.search(cr, uid, [('lot_id', '=', auc_id.id)])
assert ids, _('Auction history does not exists!')
@@ -14,8 +14,8 @@
<hpaned position="100">
<child1>
<action colspan="4" height="200" name="%(mrp.mrp_production_action2)d" string="Next production orders" width="510"/>
<action colspan="4" name="%(stock.action_picking_all)d" string="Deliveries (Out picking)" domain="[('state','=','assigned'),('type','=','out')]"/>
<action colspan="4" name="%(mrp_procurement.mrp_procurement_action4)d" string="Procurements in Exception"/>
<action colspan="4" name="%(stock.action_picking_tree)d" string="Deliveries (Out picking)" domain="[('state','=','assigned'),('type','=','out')]"/>
<action colspan="4" name="%(procurement.procurement_action4)d" string="Procurements in Exception"/>
</child1>
@@ -23,7 +23,7 @@
<form string="Warehouse board">
<hpaned position="100">
<child1>
<action colspan="4" name="%(mrp_procurement.mrp_procurement_action5)d" string="Procurement Exceptions" width="510" />
<action colspan="4" name="%(procurement.procurement_action5)d" string="Procurement Exceptions" width="510" />
<action colspan="4" name="%(action_reception_picking_move_board)d" string="Products To Receive" />
</child1>
+1 -1
View File
@@ -26,6 +26,6 @@ import installer
import wizard
import report
import company
import mrp_procurement
import procurement
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2 -2
View File
@@ -26,7 +26,7 @@
"author" : "Tiny",
"website" : "http://www.openerp.com",
"category" : "Generic Modules/Production",
"depends" : ["mrp_procurement", "stock", "resource", "purchase", "product","process"],
"depends" : ["procurement", "stock", "resource", "purchase", "product","process"],
"description": """
This is the base module to manage the manufacturing process in Open ERP.
@@ -76,7 +76,7 @@
'report/mrp_report_view.xml',
'report/mrp_production_order_view.xml',
],
'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml'],
'demo_xml': ['mrp_demo.xml'],
'test': [
'test/mrp_phantom_bom.yml',
'test/mrp_production_order.yml',
+3 -17
View File
@@ -247,7 +247,7 @@ class mrp_bom(osv.osv):
v['name'] = prod.name
return {'value': v}
return {}
def _bom_find(self, cr, uid, product_id, product_uom, properties=[]):
""" Finds BoM for particular product and product uom.
@param product_id: Selected product.
@@ -460,18 +460,6 @@ class mrp_production(osv.osv):
result[prod.id] = prod.date_planned[:10]
return result
def _ref_calc(self, cr, uid, ids, field_names=None, arg=False, context={}):
""" Finds reference sale order for production order.
@param field_names: Names of fields.
@param arg: User defined arguments
@return: Dictionary of values.
"""
res = {}
for f in field_names:
for order_id in ids:
res[order_id] = {f:False}
return res
_columns = {
'name': fields.char('Reference', size=64, required=True),
'origin': fields.char('Source Document', size=64, help="Reference of the document that generated this production order request."),
@@ -512,8 +500,6 @@ class mrp_production(osv.osv):
'hour_total': fields.function(_production_calc, method=True, type='float', string='Total Hours', multi='workorder'),
'cycle_total': fields.function(_production_calc, method=True, type='float', string='Total Cycles', multi='workorder'),
'sale_name': fields.function(_ref_calc, method=True, multi='sale_name', type='char', string='Sale Name', help='Indicate the name of sale order.'),
'sale_ref': fields.function(_ref_calc, method=True, multi='sale_ref', type='char', string='Sale Reference', help='Indicate the Customer Reference from sale order.'),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
@@ -823,7 +809,7 @@ class mrp_production(osv.osv):
seq_obj = self.pool.get('ir.sequence')
pick_obj = self.pool.get('stock.picking')
move_obj = self.pool.get('stock.move')
proc_obj = self.pool.get('mrp.procurement')
proc_obj = self.pool.get('procurement.order')
wf_service = netsvc.LocalService("workflow")
for production in self.browse(cr, uid, ids):
if not production.product_lines:
@@ -917,7 +903,7 @@ class mrp_production(osv.osv):
'move_id': move_id,
'company_id': production.company_id.id,
})
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
proc_ids.append(proc_id)
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
-15
View File
@@ -16,20 +16,5 @@
<field name="number_increment">1</field>
</record>
<record id="sequence_mrp_op_type" model="ir.sequence.type">
<field name="name">Stock orderpoint</field>
<field name="code">mrp.warehouse.orderpoint</field>
</record>
<record id="sequence_mrp_op" model="ir.sequence">
<field name="name">Stock orderpoint</field>
<field name="code">mrp.warehouse.orderpoint</field>
<field name="prefix">OP/</field>
<field name="padding">5</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>
</data>
</openerp>
+9 -11
View File
@@ -255,12 +255,12 @@
<field name="product_uos" groups="product.group_uos,base.group_extended" widget="selection"/>
<field name="product_uos_qty" groups="product.group_uos,base.group_extended" />
<newline/>
<field name="multi_level_bom" />
<field name="multi_level_bom"/>
<field name="type" groups="base.group_extended"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4" >
<page string="Components" attrs="{'invisible': [('bom_id','!=',False),('multi_level_bom','=',False)]}">
<page string="Components" attrs="{'invisible': [('multi_level_bom','=',False)]}">
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list" />
</page>
<page string="Revisions" groups="base.group_extended" attrs="{'invisible': [('bom_id','!=',False),('multi_level_bom','=',False)]}">
@@ -406,18 +406,18 @@
Procurement
-->
<menuitem action="mrp_procurement.mrp_procurement_action" id="menu_mrp_procurement_action"
<menuitem action="procurement.procurement_action" id="menu_mrp_procurement_action"
parent="mrp.menu_mrp_manufacturing" sequence="2" />
<!-- <menuitem action="mrp_procurement.mrp_procurement_action5" id="menu_mrp_procurement_exception_action"-->
<!-- <menuitem action="procurement.procurement_action5" id="menu_mrp_procurement_exception_action"-->
<!-- parent="mrp.menu_mrp_control" sequence="1" />-->
<menuitem id="menu_mrp_scheduler" name="Schedulers" parent="base.menu_mrp_root" sequence="4"/>
<menuitem action="mrp_procurement.action_compute_schedulers" id="mrp_Sched_all" parent="mrp.menu_mrp_scheduler" sequence="90"/>
<menuitem action="procurement.action_compute_schedulers" id="mrp_Sched_all" parent="mrp.menu_mrp_scheduler" sequence="90"/>
<!--
Order Point
-->
<menuitem action="mrp_procurement.action_orderpoint_form" id="menu_action_orderpoint_form" parent="mrp.menu_mrp_reordering"/>
<menuitem action="procurement.action_orderpoint_form" id="menu_action_orderpoint_form" parent="mrp.menu_mrp_reordering"/>
<!--
Production Management
@@ -640,8 +640,6 @@
<field name="date_finnished"/>
<field name="picking_id" groups="base.group_extended"/>
<field name="move_prod_id" groups="base.group_extended"/>
<field name="sale_name" groups="base.group_extended"/>
<field name="sale_ref" groups="base.group_extended"/>
</page>
</notebook>
</form>
@@ -813,9 +811,9 @@
-->
<record id="view_procurement_form_inherit" model="ir.ui.view">
<field name="name">mrp.procurement.form.inherit</field>
<field name="model">mrp.procurement</field>
<field name="inherit_id" ref="mrp_procurement.mrp_procurement_form_view"/>
<field name="name">procurement.order.form.inherit</field>
<field name="model">procurement.order</field>
<field name="inherit_id" ref="procurement.procurement_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='move_id']" position="before">
+4 -4
View File
@@ -117,7 +117,7 @@
<!-- Procurement -->
<record id="act_produce" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="wkf_id" ref="procurement.wkf_procurement"/>
<field name="name">produce</field>
<field name="kind">subflow</field>
<field name="subflow_id" search="[('osv','=','mrp.production')]"/>
@@ -125,20 +125,20 @@
</record>
<record id="trans_product_check_produce" model="workflow.transition">
<field name="act_from" ref="mrp_procurement.act_produce_check"/>
<field name="act_from" ref="procurement.act_produce_check"/>
<field name="act_to" ref="act_produce"/>
<field name="condition">check_product()</field>
</record>
<record id="trans_produce_cancel" model="workflow.transition">
<field name="act_from" ref="act_produce"/>
<field name="act_to" ref="mrp_procurement.act_cancel"/>
<field name="act_to" ref="procurement.act_cancel"/>
<field name="signal">subflow.cancel</field>
</record>
<record id="trans_produce_make_done" model="workflow.transition">
<field name="act_from" ref="act_produce"/>
<field name="act_to" ref="mrp_procurement.act_make_done"/>
<field name="act_to" ref="procurement.act_make_done"/>
<field name="signal">subflow.done</field>
</record>
+18 -18
View File
@@ -4,11 +4,11 @@
<record id="process_node_procureproducts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;The way to procurement depends on the product type.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Procure Products&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
@@ -19,94 +19,94 @@
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Drives the procurement orders for raw material.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Production Order&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'picking_except', 'confirmed', 'ready', 'in_production', 'cancel', 'done')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_procureproducts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;The way to procurement depends on the product type.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Procure Products&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_minimumstockrule0" model="process.node">
<field name="menu_id" ref="mrp.menu_action_orderpoint_form"/>
<field name="model_id" ref="mrp_procurement.model_stock_warehouse_orderpoint"/>
<field name="model_id" ref="procurement.model_stock_warehouse_orderpoint"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Linked to the 'Minimum stock rule' supplying method.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Minimum Stock&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_stockproduct0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Product type is Stockable or Consumable.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Stockable Product&quot;&quot;&quot;" name="name"/>
<field name="subflow_id" ref="process_process_stockableproductprocess0"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_stockproduct1" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;For stockable products and consumables&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Stockable Product&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp.process_process_stockableproductprocess0"/>
<field name="subflow_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_serviceproduct0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Product type is service&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Service&quot;&quot;&quot;" name="name"/>
<field name="subflow_id" ref="process_process_serviceproductprocess0"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_serviceproduct1" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;For Services.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Service&quot;&quot;&quot;" name="name"/>
<field name="process_id" ref="mrp.process_process_serviceproductprocess0"/>
<field name="subflow_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'confirmed', 'cancel', 'exception', 'running', 'done', 'waiting')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_purchaseprocure0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Procurement Orders&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;For purchased material&quot;&quot;&quot;" name="note"/>
<field name="subflow_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="purchase.process_process_purchaseprocess0"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_productminimumstockrule0" model="process.node">
<field name="menu_id" ref="mrp.menu_action_orderpoint_form"/>
<field name="model_id" ref="mrp_procurement.model_stock_warehouse_orderpoint"/>
<field name="model_id" ref="procurement.model_stock_warehouse_orderpoint"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Minimum Stock&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Automatic procurement rule&quot;&quot;&quot;" name="note"/>
@@ -8,7 +8,7 @@
<record id="process_process_serviceproductprocess0" model="process.process">
<field eval="&quot;&quot;&quot;Service&quot;&quot;&quot;" name="name"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="1" name="active"/>
</record>
@@ -18,7 +18,7 @@
<record id="process_node_serviceonorder0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from Production or Purchase Order.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Make to Order&quot;&quot;&quot;" name="name"/>
@@ -29,7 +29,7 @@
<record id="process_node_servicemts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from stock.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Make to stock&quot;&quot;&quot;" name="name"/>
@@ -8,7 +8,7 @@
<record id="process_process_stockableproductprocess0" model="process.process">
<field eval="&quot;&quot;&quot;Stockable Product&quot;&quot;&quot;" name="name"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="1" name="active"/>
</record>
@@ -18,7 +18,7 @@
<record id="process_node_mts0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from stock.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Make to Stock&quot;&quot;&quot;" name="name"/>
@@ -29,7 +29,7 @@
<record id="process_node_stock0" model="process.node">
<field name="menu_id" ref="mrp.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp.model_mrp_procurement"/>
<field name="model_id" ref="mrp.model_procurement_order"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Assignment from Production or Purchase Order.&quot;&quot;&quot;" name="note"/>
<field eval="&quot;&quot;&quot;Make to Order&quot;&quot;&quot;" name="name"/>
@@ -27,17 +27,20 @@ import ir
import netsvc
import time
class mrp_procurement(osv.osv):
_inherit = 'mrp.procurement'
class procurement_order(osv.osv):
_inherit = 'procurement.order'
_columns = {
'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True),
}
def check_produce_product(self, cr, uid, procurement, context=[]):
""" Finds the bill of material for the product from procurement order.
@return: True or False
"""
properties = [x.id for x in procurement.property_ids]
bom_id = self.pool.get('mrp.bom')._bom_find(cr, uid, procurement.product_id.id, procurement.product_uom.id, properties)
if not bom_id:
cr.execute('update mrp_procurement set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
cr.execute('update procurement_order set message=%s where id=%s', (_('No BoM defined for this product !'), procurement.id))
return False
return True
@@ -45,7 +48,7 @@ class mrp_procurement(osv.osv):
""" This is action which call from workflow to assign production order to procurements
@return: True
"""
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
res = procurement_obj.make_mo(cr, uid, ids, context=context)
res = res.values()
return len(res) and res[0] or 0 #TO CHECK: why workflow is generated error if return not integer value
@@ -59,7 +62,7 @@ class mrp_procurement(osv.osv):
production_obj = self.pool.get('mrp.production')
move_obj = self.pool.get('stock.move')
wf_service = netsvc.LocalService("workflow")
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
for procurement in procurement_obj.browse(cr, uid, ids):
res_id = procurement.move_id.id
loc_id = procurement.location_id.id
@@ -88,6 +91,6 @@ class mrp_procurement(osv.osv):
{'location_id': procurement.location_id.id})
return res
mrp_procurement()
procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-24
View File
@@ -26,30 +26,6 @@ from tools.translate import _
class product_product(osv.osv):
_inherit = "product.product"
def get_product_accounts(self, cr, uid, product_id, context={}):
""" To get the stock input account, stock output account and stock journal related to product.
@param product_id: product id
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
"""
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, False)
stock_input_acc = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id or False
if not stock_input_acc:
stock_input_acc = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id or False
stock_output_acc = product_obj.property_stock_account_output and product_obj.property_stock_account_output.id or False
if not stock_output_acc:
stock_output_acc = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id or False
journal_id = product_obj.categ_id.property_stock_journal and product_obj.categ_id.property_stock_journal.id or False
res = {}
res.update({'stock_account_input': stock_input_acc})
res.update({'stock_account_output': stock_output_acc})
res.update({'stock_journal': journal_id})
return res
def do_change_standard_price(self, cr, uid, ids, datas, context={}):
""" Changes the Standard Price of Product and parent products and creates an account move accordingly.
@param datas: dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
+2 -2
View File
@@ -265,10 +265,10 @@
<para style="terp_default_Centre_8">[[ formatLang(o.date_planned, date_time = True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ o.sale_ref or ' ' ]]</para>
<para style="terp_default_Centre_8">[[ o.sale_ref or removeParentNode('para')]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ o.sale_name or '' ]]</para>
<para style="terp_default_Centre_8">[[ o.sale_name or removeParentNode('para') ]]</para>
</td>
</tr>
</blockTable>
+2 -2
View File
@@ -7,7 +7,7 @@
"access_mrp_production","mrp.production","model_mrp_production","mrp.group_mrp_user",1,1,1,1
"access_mrp_production_workcenter_line","mrp.production.workcenter.line","model_mrp_production_workcenter_line","mrp.group_mrp_user",1,1,1,1
"access_mrp_production_product_line","mrp.production.product.line","model_mrp_production_product_line","mrp.group_mrp_user",1,1,1,1
"access_mrp_procurement","mrp.procurement","model_mrp_procurement","mrp.group_mrp_user",1,1,1,1
"access_procurement","procurement.order","model_procurement_order","mrp.group_mrp_user",1,1,1,1
"access_mrp_workcenter_manager","mrp.workcenter.manager","model_mrp_workcenter","mrp.group_mrp_user",1,1,1,1
"access_mrp_routing_manager","mrp.routing.manager","model_mrp_routing","mrp.group_mrp_manager",1,1,1,1
"access_mrp_routing_workcenter_manager","mrp.routing.workcenter.manager","model_mrp_routing_workcenter","mrp.group_mrp_manager",1,1,1,1
@@ -22,7 +22,7 @@
"access_purchase_order_mrp_worker","purchase.order mrp_worker","purchase.model_purchase_order","mrp.group_mrp_user",1,0,0,0
"access_purchase_order_line_mrp_worker","purchase.order.line mrp_worker","purchase.model_purchase_order_line","mrp.group_mrp_user",1,0,0,0
"access_hr_timesheet_group_mrp_worker","resource.calendar mrp_worker","resource.model_resource_calendar","mrp.group_mrp_user",1,0,0,0
"access_mrp_procurement_stock_worker","mrp.procurement stock_worker","model_mrp_procurement","stock.group_stock_user",1,1,1,1
"access_procurement_stock_worker","procurement.order stock_worker","model_procurement_order","stock.group_stock_user",1,1,1,1
"access_mrp_production_stock_worker","mrp.production stock_worker","model_mrp_production","stock.group_stock_user",1,0,0,0
"access_mrp_installer","mrp.installer","model_mrp_installer","mrp.group_mrp_user",1,0,0,0
"access_mrp_product_produce","mrp.product.produce","model_mrp_product_produce","mrp.group_mrp_user",1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
7 access_mrp_production mrp.production model_mrp_production mrp.group_mrp_user 1 1 1 1
8 access_mrp_production_workcenter_line mrp.production.workcenter.line model_mrp_production_workcenter_line mrp.group_mrp_user 1 1 1 1
9 access_mrp_production_product_line mrp.production.product.line model_mrp_production_product_line mrp.group_mrp_user 1 1 1 1
10 access_mrp_procurement access_procurement mrp.procurement procurement.order model_mrp_procurement model_procurement_order mrp.group_mrp_user 1 1 1 1
11 access_mrp_workcenter_manager mrp.workcenter.manager model_mrp_workcenter mrp.group_mrp_user 1 1 1 1
12 access_mrp_routing_manager mrp.routing.manager model_mrp_routing mrp.group_mrp_manager 1 1 1 1
13 access_mrp_routing_workcenter_manager mrp.routing.workcenter.manager model_mrp_routing_workcenter mrp.group_mrp_manager 1 1 1 1
22 access_purchase_order_mrp_worker purchase.order mrp_worker purchase.model_purchase_order mrp.group_mrp_user 1 0 0 0
23 access_purchase_order_line_mrp_worker purchase.order.line mrp_worker purchase.model_purchase_order_line mrp.group_mrp_user 1 0 0 0
24 access_hr_timesheet_group_mrp_worker resource.calendar mrp_worker resource.model_resource_calendar mrp.group_mrp_user 1 0 0 0
25 access_mrp_procurement_stock_worker access_procurement_stock_worker mrp.procurement stock_worker procurement.order stock_worker model_mrp_procurement model_procurement_order stock.group_stock_user 1 1 1 1
26 access_mrp_production_stock_worker mrp.production stock_worker model_mrp_production stock.group_stock_user 1 0 0 0
27 access_mrp_installer mrp.installer model_mrp_installer mrp.group_mrp_user 1 0 0 0
28 access_mrp_product_produce mrp.product.produce model_mrp_product_produce mrp.group_mrp_user 1 0 0 0
+5 -75
View File
@@ -28,82 +28,12 @@ import netsvc
import time
class stock_warehouse_orderpoint(osv.osv):
"""
Defines Minimum stock rules.
"""
_name = "stock.warehouse.orderpoint"
_description = "Minimum Inventory Rule"
_columns = {
'name': fields.char('Name', size=32, required=True),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the orderpoint without removing it."),
'logic': fields.selection([('max','Order to Max'),('price','Best price (not yet active!)')], 'Reordering Mode', required=True),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True, ondelete="cascade"),
'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete="cascade"),
'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','=','product')]),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'product_min_qty': fields.float('Min Quantity', required=True,
help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
"a procurement to bring the virtual stock to the Max Quantity."),
'product_max_qty': fields.float('Max Quantity', required=True,
help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
"a procurement to bring the virtual stock to the Max Quantity."),
'qty_multiple': fields.integer('Qty Multiple', required=True,
help="The procurement quantity will by rounded up to this multiple."),
'procurement_id': fields.many2one('mrp.procurement', 'Latest procurement', ondelete="set null"),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
'active': lambda *a: 1,
'logic': lambda *a: 'max',
'qty_multiple': lambda *a: 1,
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
}
_sql_constraints = [
('qty_multiple_check', 'CHECK( qty_multiple > 0 )', _('Qty Multiple must be greater than zero.')),
]
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
""" Finds location id for changed warehouse.
@param warehouse_id: Changed id of warehouse.
@return: Dictionary of values.
"""
if warehouse_id:
w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context)
v = {'location_id': w.lot_stock_id.id}
return {'value': v}
return {}
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
""" Finds UoM for changed product.
@param product_id: Changed id of product.
@return: Dictionary of values.
"""
if product_id:
prod = self.pool.get('product.product').browse(cr,uid,product_id)
v = {'product_uom': prod.uom_id.id}
return {'value': v}
return {}
def copy(self, cr, uid, id, default=None,context={}):
if not default:
default = {}
default.update({
'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.warehouse.orderpoint') or '',
})
return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
stock_warehouse_orderpoint()
class StockMove(osv.osv):
_inherit = 'stock.move'
_columns = {
'production_id': fields.many2one('mrp.production', 'Production', select=True),
'procurements': fields.one2many('mrp.procurement', 'move_id', 'Procurements'),
'procurements': fields.one2many('procurement.order', 'move_id', 'Procurements'),
}
def copy(self, cr, uid, id, default=None, context=None):
@@ -118,7 +48,7 @@ class StockMove(osv.osv):
"""
bom_obj = self.pool.get('mrp.bom')
move_obj = self.pool.get('stock.move')
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
product_obj = self.pool.get('product.product')
wf_service = netsvc.LocalService("workflow")
if move.product_id.supply_method == 'produce' and move.product_id.procure_method == 'make_to_order':
@@ -166,7 +96,7 @@ class StockMove(osv.osv):
'move_id': mid,
'company_id': line['company_id'],
})
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
move_obj.write(cr, uid, [move.id], {
'location_id': move.location_dest_id.id,
'auto_validate': True,
@@ -175,7 +105,7 @@ class StockMove(osv.osv):
'state': 'waiting'
})
for m in procurement_obj.search(cr, uid, [('move_id','=',move.id)], context):
wf_service.trg_validate(uid, 'mrp.procurement', m, 'button_wait_done', cr)
wf_service.trg_validate(uid, 'procurement.order', m, 'button_wait_done', cr)
return True
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
@@ -231,7 +161,7 @@ class StockPicking(osv.osv):
for move in picking.move_lines:
if move.state == 'done' and move.procurements:
for procurement in move.procurements:
wf_service.trg_validate(user, 'mrp.procurement',
wf_service.trg_validate(user, 'procurement.order',
procurement.id, 'button_check', cursor)
return res
+23 -7
View File
@@ -9,6 +9,8 @@
factor: 1.0
name: Litre
rounding: 0.01
-
I create record for product Orange Juice.
-
!record {model: product.product, id: product_product_orangejuice0}:
categ_id: product.cat1
@@ -18,6 +20,8 @@
type: product
uom_id: product_uom_litre0
uom_po_id: product_uom_litre0
-
I create record for product Orange.
-
!record {model: product.product, id: product_product_orange0}:
categ_id: product.cat1
@@ -31,6 +35,8 @@
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
-
I create record for product Sugar.
-
!record {model: product.product, id: product_product_sugar0}:
categ_id: product.cat1
@@ -44,6 +50,8 @@
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
-
I create record for product Water.
-
!record {model: product.product, id: product_product_water0}:
categ_id: product.cat1
@@ -54,7 +62,7 @@
uom_id: product_uom_litre0
uom_po_id: product_uom_litre0
-
I define the BoM to produce an orange juice
I define the BoM to produce an orange juice.
-
!record {model: mrp.bom, id: mrp_bom_orangejuice0}:
company_id: base.main_company
@@ -64,6 +72,8 @@
product_qty: 1.0
product_uom: product_uom_litre0
type: phantom
-
I create bom lines for BoM for Orange Juice.
-
!record {model: mrp.bom, id: mrp_bom_orangejuice0}:
bom_lines:
@@ -92,7 +102,7 @@
product_uom: product_uom_litre0
type: normal
-
I define Minimum stock rules for my stockable products orange and sugar
I define Minimum stock rules for my stockable product "Orange".
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
@@ -105,6 +115,8 @@
product_uom: product.product_uom_kgm
qty_multiple: 1
warehouse_id: stock.warehouse0
-
I define Minimum stock rules for my stockable product "Sugar".
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op1}:
company_id: base.main_company
@@ -168,23 +180,23 @@
-
I am checking Procurement orders. There are 3 orders generated for Oranges, Sugar and Water.
-
!python {model: mrp.procurement}: |
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','!=','cofirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[('origin','=',':MO/00002')]"
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','!=','cofirmed')]"
-
I am checking Internal picking. I see one picking for Orange juice and its
stock moves for Oranges, Sugar and Water made correctly.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('origin','=',':MO/00002'),('type','=','internal')])
pick_ids = self.search(cr, uid, [('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
According to minimum stock rules. I have 2 purchase orders for
@@ -220,11 +232,15 @@
assert pick_ids, _('No Incoming Shipments found!')
-
I receive both the products. My incoming pickings are done.
-
I create record for the incoming picking wizard.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_asus
address_id: base.res_partner_address_tang
-
I make my pickings done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
+29 -13
View File
@@ -4,7 +4,7 @@
-
I am creating products.
-
Creating a product.product record
I create record for product Shirt.
-
!record {model: product.product, id: product_product_shirt0}:
categ_id: product.cat1
@@ -27,7 +27,7 @@
weight: 0.0
weight_net: 0.0
-
Creating a product.product record
I create record for product Cloth.
-
!record {model: product.product, id: product_product_cloth0}:
categ_id: product.cat1
@@ -53,7 +53,7 @@
weight: 0.0
weight_net: 0.0
-
Creating a product.product record
I create record for product Buttons.
-
!record {model: product.product, id: product_product_buttons0}:
categ_id: product.cat1
@@ -81,7 +81,7 @@
-
I am creating bills of material for 'Shirt'.
-
Creating a mrp.bom record
I create bills of material for Shirt.
-
!record {model: mrp.bom, id: mrp_bom_shirt0}:
bom_lines:
@@ -129,7 +129,7 @@
-
I create a procurement order for product Shirt.
-
!record {model: mrp.procurement, id: mrp_procurement_shirt0}:
!record {model: procurement.order, id: procurement_order_shirt0}:
name: 'PROC: Shirt'
product_id: product_product_shirt0
product_qty: 5.00
@@ -138,11 +138,11 @@
-
I confirm the procurement order.
-
!workflow {model: mrp.procurement, action: button_confirm, ref: mrp_procurement_shirt0}
!workflow {model: procurement.order, action: button_confirm, ref: procurement_order_shirt0}
-
I run the procurement.
-
!workflow {model: mrp.procurement, action: button_check, ref: mrp_procurement_shirt0}
!workflow {model: procurement.order, action: button_check, ref: procurement_order_shirt0}
-
I see that there is a manufacturing order for Shirt.
-
@@ -153,15 +153,15 @@
-
I also check that there are two more procurement orders for sub products Cloth and Buttons.
-
!python {model: mrp.procurement}: |
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_cloth0'),ref('product_product_buttons0')])])
assert proc_ids, 'No Procurements.'
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[]"
-
I check that there is one purchase order for Cloth.
@@ -216,11 +216,15 @@
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
-
I create record for partial picking.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
-
I make my picking done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
@@ -245,17 +249,21 @@
})
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
-
I Check incoming shipments for buttons. And receive products.
I Check incoming shipments for buttons and receive products.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
-
I create record for partial picking.
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
-
I make my picking done.
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
@@ -282,8 +290,8 @@
-
Run scheduler again.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[]"
-
Check state of manufacturing order for Shirt.
@@ -303,22 +311,30 @@
wf_service = netsvc.LocalService("workflow")
for p_id in prod_ids:
wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr)
-
I create record for producing products with quantity 5.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
mode: 'consume_produce'
-
I produce 2 products with 5.00 quantities each.
-
!python {model: mrp.product.produce}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
I create record for remaining products with quantity 35.00.
-
!record {model: stock.move.consume, id: stock_move_consume0}:
product_id: product_product_buttons0
product_qty: 35.00
product_uom: product.product_uom_unit
location_id: stock.stock_location_stock
-
I produce remaining product Buttons with 35.00 quantity.
-
!python {model: stock.move.consume}: |
from tools.translate import _
+17 -11
View File
@@ -18,7 +18,7 @@
product_uom: product.product_uom_unit
product_uos_qty: 0.0
-
Creating a mrp.production.workcenter.line record
I create a record for Workcenter line.
-
!record {model: mrp.production.workcenter.line, id: mrp_production_workcenter_line_assemblyline0}:
cycle: 5.0
@@ -28,7 +28,7 @@
sequence: 0.0
workcenter_id: mrp.mrp_workcenter_0
-
Creating a mrp.production.product.line record
I create second record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_regularprocessorconfig0}:
name: Regular processor config
@@ -38,7 +38,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
Creating a mrp.production.product.line record
I create third record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_hddseagategb0}:
name: HDD Seagate 7200.8 80GB
@@ -48,7 +48,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
Creating a mrp.production.product.line record
I create fourth record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_atxmidsizetower0}:
name: ATX Mid-size Tower
@@ -58,7 +58,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
Creating a mrp.production.product.line record
I create a record for production line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_mouse0}:
name: Mouse
@@ -68,7 +68,7 @@
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
Creating a mrp.production.product.line record
I create second record for production line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_keyboard0}:
name: Keyboard
@@ -84,15 +84,15 @@
-
I am checking Procurement orders.
-
!python {model: mrp.procurement}: |
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','!=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
@@ -102,7 +102,7 @@
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
I see that there is a manufacturing order for the subproduct of PC1 with ready state.
I see that there is a manufacturing order for the sub product of PC1 with ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
@@ -110,17 +110,21 @@
assert order_ids, _('No manufacturing order!')
-
I start producing that product first. So I marked it as started.
-
I create record for producing products with quantity 5.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
mode: 'consume_produce'
-
I produce the product.
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
Now the manufacturing order for subproduct CPU_GEN is done. And manufacturing
Now the manufacturing order for subproduct CPU_GEN is done and manufacturing
order for PC1 is in ready state.
-
!python {model: mrp.production}: |
@@ -131,6 +135,8 @@
I start producing the product PC1.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
-
Finally my production order is done.
-
!python {model: mrp.product.produce}: |
from tools.translate import _
+1 -1
View File
@@ -40,7 +40,7 @@
""",
'author': 'Tiny',
'depends': ['mrp_procurement'],
'depends': ['procurement'],
'update_xml': ['mrp_jit.xml'],
'demo_xml': [],
'installable': True,
+1 -1
View File
@@ -2,7 +2,7 @@
<openerp>
<data>
<record model="workflow.transition" id="mrp_procurement.trans_confirm_confirm_wait">
<record model="workflow.transition" id="procurement.trans_confirm_confirm_wait">
<field name="signal" eval="False"/>
</record>
+1
View File
@@ -61,6 +61,7 @@
'process/mrp_operation_process.xml'
],
'demo_xml': ['mrp_operation_data.xml'],
'test': ['test/mrp_operations.yml'],
'installable': True,
'active': False,
'certificate': '0056233813133',
+100 -33
View File
@@ -47,6 +47,9 @@ stock_move()
class mrp_production_workcenter_line(osv.osv):
def _get_date_date(self, cr, uid, ids, field_name, arg, context):
""" Finds starting date.
@return: Dictionary of values.
"""
res={}
for op in self.browse(cr, uid, ids, context=context):
if op.date_start:
@@ -54,7 +57,11 @@ class mrp_production_workcenter_line(osv.osv):
else:
res[op.id]=False
return res
def _get_date_end(self, cr, uid, ids, field_name, arg, context):
""" Finds ending date.
@return: Dictionary of values.
"""
res = {}
for op in self.browse(cr, uid, ids, context=context):
res[op.id]= False
@@ -66,8 +73,10 @@ class mrp_production_workcenter_line(osv.osv):
else:
res[op.id] = op.date_planned
return res
_inherit = 'mrp.production.workcenter.line'
_order = "sequence, date_planned"
_columns = {
'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'State', readonly=True,
help="* When a work order is created it is set in 'Draft' state.\n" \
@@ -90,16 +99,21 @@ class mrp_production_workcenter_line(osv.osv):
'qty':fields.related('production_id','product_qty',type='float',string='Qty',readonly=True),
'uom':fields.related('production_id','product_uom',type='many2one',relation='product.uom',string='UOM',readonly=True),
}
_defaults = {
'state': lambda *a: 'draft',
'delay': lambda *a: 0.0
}
def modify_production_order_state(self,cr,uid,ids,action):
def modify_production_order_state(self, cr, uid, ids, action):
""" Modifies production order state if work order state is changed.
@param action: Action to perform.
@return: Nothing
"""
wf_service = netsvc.LocalService("workflow")
oper_obj=self.browse(cr,uid,ids)[0]
prod_obj=oper_obj.production_id
if action=='start':
oper_obj = self.browse(cr, uid, ids)[0]
prod_obj = oper_obj.production_id
if action == 'start':
if prod_obj.state =='confirmed':
self.pool.get('mrp.production').force_production(cr, uid, [prod_obj.id])
wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr)
@@ -110,12 +124,12 @@ class mrp_production_workcenter_line(osv.osv):
else:
raise osv.except_osv(_('Error!'),_('Production Order Cannot start in [%s] state') % (prod_obj.state,))
else:
oper_ids=self.search(cr,uid,[('production_id','=',prod_obj.id)])
obj=self.browse(cr,uid,oper_ids)
flag=True
oper_ids = self.search(cr,uid,[('production_id','=',prod_obj.id)])
obj = self.browse(cr,uid,oper_ids)
flag = True
for line in obj:
if line.state!='done':
flag=False
if line.state != 'done':
flag = False
if flag:
wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr)
return
@@ -132,15 +146,24 @@ class mrp_production_workcenter_line(osv.osv):
return result
def action_draft(self, cr, uid, ids):
""" Sets state to draft.
@return: True
"""
self.write(cr, uid, ids, {'state':'draft'})
return True
def action_start_working(self, cr, uid, ids):
self.modify_production_order_state(cr,uid,ids,'start')
""" Sets state to start working and writes starting date.
@return: True
"""
self.modify_production_order_state(cr, uid, ids, 'start')
self.write(cr, uid, ids, {'state':'startworking', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
def action_done(self, cr, uid, ids):
""" Sets state to done, writes finish date and calculates delay.
@return: True
"""
delay = 0.0
date_now = time.strftime('%Y-%m-%d %H:%M:%S')
obj_line = self.browse(cr, uid, ids[0])
@@ -155,14 +178,23 @@ class mrp_production_workcenter_line(osv.osv):
return True
def action_cancel(self, cr, uid, ids):
""" Sets state to cancel.
@return: True
"""
self.write(cr, uid, ids, {'state':'cancel'})
return True
def action_pause(self, cr, uid, ids):
""" Sets state to pause.
@return: True
"""
self.write(cr, uid, ids, {'state':'pause'})
return True
def action_resume(self, cr, uid, ids):
""" Sets state to startworking.
@return: True
"""
self.write(cr, uid, ids, {'state':'startworking'})
return True
@@ -175,6 +207,9 @@ class mrp_production(osv.osv):
}
def _production_date_end(self, cr, uid, ids, prop, unknow_none, context={}):
""" Calculates planned end date of production order.
@return: Dictionary of values
"""
result = {}
for prod in self.browse(cr, uid, ids, context=context):
result[prod.id] = prod.date_planned
@@ -183,10 +218,13 @@ class mrp_production(osv.osv):
return result
def action_production_end(self, cr, uid, ids):
obj=self.browse(cr,uid,ids)[0]
""" Finishes work order if production order is done.
@return: Super method
"""
obj = self.browse(cr, uid, ids)[0]
for workcenter_line in obj.workcenter_lines:
tmp = self.pool.get('mrp.production.workcenter.line').action_done(cr,uid,[workcenter_line.id])
return super(mrp_production,self).action_production_end(cr,uid,ids)
tmp = self.pool.get('mrp.production.workcenter.line').action_done(cr, uid, [workcenter_line.id])
return super(mrp_production,self).action_production_end(cr, uid, ids)
def action_in_production(self, cr, uid, ids):
""" Changes state to In Production and writes starting date.
@@ -199,12 +237,18 @@ class mrp_production(osv.osv):
return super(mrp_production,self).action_in_production(cr, uid, ids)
def action_cancel(self, cr, uid, ids):
obj=self.browse(cr,uid,ids)[0]
""" Cancels work order if production order is canceled.
@return: Super method
"""
obj = self.browse(cr, uid, ids)[0]
for workcenter_line in obj.workcenter_lines:
tmp=self.pool.get('mrp.production.workcenter.line').action_cancel(cr,uid,[workcenter_line.id])
tmp = self.pool.get('mrp.production.workcenter.line').action_cancel(cr, uid, [workcenter_line.id])
return super(mrp_production,self).action_cancel(cr,uid,ids)
def _compute_planned_workcenter(self, cr, uid, ids, context={}, mini=False):
""" Computes planned and finished dates for work order.
@return: Calculated date
"""
dt_end = DateTime.now()
for po in self.browse(cr, uid, ids, context=context):
dt_end = DateTime.strptime(po.date_start or po.date_planned, '%Y-%m-%d %H:%M:%S')
@@ -241,6 +285,9 @@ class mrp_production(osv.osv):
return dt_end
def _move_pass(self, cr, uid, ids, context={}):
""" Calculates start date for stock moves finding interval from resource calendar.
@return: True
"""
for po in self.browse(cr, uid, ids, context):
if po.allow_reorder:
continue
@@ -251,7 +298,7 @@ class mrp_production(osv.osv):
if l.state in ('done','cancel','draft'):
continue
todo += l.move_dest_id_lines
if l.production_id and (l.production_id.date_finnished>dt):
if l.production_id and (l.production_id.date_finnished > dt):
if l.production_id.state not in ('done','cancel'):
for wc in l.production_id.workcenter_lines:
i = self.pool.get('resource.calendar').interval_min_get(
@@ -261,11 +308,14 @@ class mrp_production(osv.osv):
dt, wc.hour or 0.0
)
dt = i[0][0]
if l.production_id.date_start>dt.strftime('%Y-%m-%d %H:%M:%S'):
if l.production_id.date_start > dt.strftime('%Y-%m-%d %H:%M:%S'):
self.write(cr, uid, [l.production_id.id], {'date_start':dt.strftime('%Y-%m-%d %H:%M:%S')}, mini=True)
return True
def _move_futur(self, cr, uid, ids, context={}):
""" Calculates start date for stock moves.
@return: True
"""
for po in self.browse(cr, uid, ids, context):
if po.allow_reorder:
continue
@@ -277,8 +327,8 @@ class mrp_production(osv.osv):
break
if l.production_id.state in ('done','cancel'):
break
if l.production_id and (l.production_id.date_start<po.date_finnished):
self.write(cr, uid, [l.production_id.id], {'date_start':po.date_finnished})
if l.production_id and (l.production_id.date_start < po.date_finnished):
self.write(cr, uid, [l.production_id.id], {'date_start': po.date_finnished})
break
@@ -291,17 +341,21 @@ class mrp_production(osv.osv):
if (vals.get('workcenter_lines', False) or vals.get('date_start', False)) and update:
self._compute_planned_workcenter(cr, uid, ids, context=context, mini=mini)
for d in direction:
if direction[d]==1:
if direction[d] == 1:
# the production order has been moved to the passed
self._move_pass(cr, uid, [d], context=context)
pass
elif direction[d]==-1:
elif direction[d] == -1:
self._move_futur(cr, uid, [d], context=context)
# the production order has been moved to the future
pass
return result
def action_compute(self, cr, uid, ids, properties=[]):
""" Computes bills of material of a product and planned date of work order.
@param properties: List containing dictionaries of properties.
@return: No. of products.
"""
result = super(mrp_production, self).action_compute(cr, uid, ids, properties=properties)
self._compute_planned_workcenter(cr, uid, ids, context={})
return result
@@ -321,25 +375,34 @@ class mrp_operations_operation(osv.osv):
_name="mrp_operations.operation"
def _order_date_search_production(self, cr, uid, ids, context=None):
operation_ids=self.pool.get('mrp_operations.operation').search(cr, uid, [('production_id','=',ids[0])], context=context)
""" Finds operations for a production order.
@return: List of ids
"""
operation_ids = self.pool.get('mrp_operations.operation').search(cr, uid, [('production_id','=',ids[0])], context=context)
return operation_ids
def _get_order_date(self, cr, uid, ids, field_name, arg, context):
""" Calculates planned date for an operation.
@return: Dictionary of values
"""
res={}
operation_obj=self.browse(cr, uid, ids, context=context)
operation_obj = self.browse(cr, uid, ids, context=context)
for operation in operation_obj:
res[operation.id]=operation.production_id.date_planned
res[operation.id] = operation.production_id.date_planned
return res
def calc_delay(self,cr,uid,vals):
code_lst=[]
time_lst=[]
def calc_delay(self, cr, uid, vals):
""" Calculates delay of work order.
@return: Delay
"""
code_lst = []
time_lst = []
code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])])
code=self.pool.get('mrp_operations.operation.code').browse(cr,uid,code_ids)[0]
code_ids = self.pool.get('mrp_operations.operation.code').search(cr, uid, [('id','=',vals['code_id'])])
code = self.pool.get('mrp_operations.operation.code').browse(cr, uid, code_ids)[0]
oper_ids=self.search(cr,uid,[('production_id','=',vals['production_id']),('workcenter_id','=',vals['workcenter_id'])])
oper_objs=self.browse(cr,uid,oper_ids)
oper_ids = self.search(cr,uid,[('production_id','=',vals['production_id']),('workcenter_id','=',vals['workcenter_id'])])
oper_objs = self.browse(cr,uid,oper_ids)
for oper in oper_objs:
code_lst.append(oper.code_id.start_stop)
@@ -349,7 +412,7 @@ class mrp_operations_operation(osv.osv):
time_lst.append(vals['date_start'])
diff = 0
for i in range(0,len(code_lst)):
if code_lst[i]=='pause' or code_lst[i]=='done' or code_lst[i]=='cancel':
if code_lst[i] == 'pause' or code_lst[i] == 'done' or code_lst[i] == 'cancel':
if not i: continue
if code_lst[i-1] not in ('resume','start'):
continue
@@ -359,7 +422,11 @@ class mrp_operations_operation(osv.osv):
diff += (b-a).seconds / float(60*60)
return diff
def check_operation(self,cr,uid,vals):
def check_operation(self, cr, uid, vals):
""" Finds which operation is called ie. start, pause, done, cancel.
@param vals: Dictionary of values.
@return: True or False
"""
code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])])
code=self.pool.get('mrp_operations.operation.code').browse(cr,uid,code_ids)[0]
code_lst = []
@@ -0,0 +1,151 @@
-
In order to test mrp_operations module in OpenERP I will put a Production order
and check its effects on Work orders.
-
I create a production order.
-
!record {model: mrp.production, id: mrp_production_mo0}:
company_id: base.main_company
date_planned: '2010-05-25 11:17:34'
location_dest_id: stock.stock_location_stock
location_src_id: stock.stock_location_stock
name: MO/00002
product_id: product.product_product_pc1
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
-
I am computing the data.
-
!python {model: mrp.production}: |
self.action_compute(cr, uid, [ref("mrp_production_mo0")], {"lang": "en_US", "tz":
False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids":
[ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"),
})
-
Now I confirm my production order.
-
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
-
I check that there is one Work order generated related to my production order.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','draft')])
assert order_id, _('No Work order!')
-
I am checking Procurement orders.
-
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
I see that there is a manufacturing order for the sub product CPU_GEN of PC1 with ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('state','=','ready')])
assert order_ids, _('No new manufacturing order!')
-
I check that there one more work order created for new production order.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','ready')])
workorder_id = self.search(cr, uid, [('production_id','=', prod_order_ids[0]),('state','=','draft')])
assert workorder_id, _('No Work order!')
-
I start the second production order of the CPU_GEN product.
-
!python {model: mrp.production}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
prod_order_ids = self.search(cr, uid, [('state','=','ready')])
for po in prod_order_ids:
wf_service.trg_validate(uid, 'mrp.production', po, 'button_produce', cr)
-
I am creating a mrp.product.produce record
-
!record {model: mrp.product.produce, id: mrp_product_produce_0}:
mode: consume_produce
product_qty: 5.0
-
I produce the product CPU_GEN.
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','in_production')])
self.do_produce(cr, uid, [ref("mrp_product_produce_0")], {"lang": "en_US", "tz":
False, "search_default_current": 1, "active_model": "mrp.production", "active_ids":
prod_order_ids, "active_id": prod_order_ids[0], })
-
I check that my production order and its related work order is in done state.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','done')])
workorder_id = self.search(cr, uid, [('production_id','=', prod_order_ids[0]),('state','=','done')])
assert workorder_id, _('Work order is not done!')
-
Now I check my original production order is now ready.
-
!python {model: mrp.production}: |
from tools.translate import _
prod_ids = self.search(cr, uid, [('id','=',ref('mrp_production_mo0')),('state','=','ready')])
assert prod_ids, _('Production order is not ready!')
-
I check that both internal pickings are done.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('state','=','done'),('type','=','internal')])
assert pick_ids, _('Internal pickings are not done!')
-
Now I start my first production order.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
-
I check that the related work order is in progress state.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')])
assert order_id, _('Work order not started yet!')
-
I am creating a mrp.product.produce record.
-
!record {model: mrp.product.produce, id: mrp_product_produce_0}:
mode: consume_produce
product_qty: 5.0
-
I produce the product PC1.
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_order_ids = prod_obj.search(cr, uid, [('state','=','in_production')])
self.do_produce(cr, uid, [ref("mrp_product_produce_0")], {"lang": "en_US", "tz":
False, "search_default_current": 1, "active_model": "mrp.production", "active_ids":
[ref("mrp_production_mo0")], "active_id": ref("mrp_production_mo0"), })
-
I check the related work order is done.
-
!python {model: mrp.production.workcenter.line}: |
from tools.translate import _
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','done')])
assert order_id, _('Work order not done yet!')
+1 -1
View File
@@ -44,7 +44,7 @@ class repair_cancel(osv.osv_memory):
if repair_order.invoiced or repair_order.invoice_method == 'none':
repair_order_obj.action_cancel(cr, uid, [record_id], context=context)
else:
raise osv.except_osv(_('Warning!'),_('Repair is not cancelled. It is not invoiced.'))
raise osv.except_osv(_('Warning!'),_('Repair order is not invoiced.'))
return {}
+16 -7
View File
@@ -35,10 +35,15 @@ class mrp_subproduct(osv.osv):
_defaults={
'subproduct_type': lambda *args: 'fixed'
}
def onchange_product_id(self, cr, uid, ids, product_id,context={}):
""" Changes UoM if product_id changes.
@param product_id: Changed product_id
@return: Dictionary of changed values
"""
if product_id:
prod=self.pool.get('product.product').browse(cr,uid,product_id)
v = {'product_uom':prod.uom_id.id}
prod = self.pool.get('product.product').browse(cr, uid, product_id)
v = {'product_uom': prod.uom_id.id}
return {'value': v}
return {}
@@ -48,6 +53,7 @@ class mrp_bom(osv.osv):
_name = 'mrp.bom'
_description = 'Bill of Material'
_inherit='mrp.bom'
_columns={
'sub_products':fields.one2many('mrp.subproduct', 'bom_id', 'sub_products'),
}
@@ -59,7 +65,10 @@ class mrp_production(osv.osv):
_inherit= 'mrp.production'
def action_confirm(self, cr, uid, ids):
picking_id=super(mrp_production,self).action_confirm(cr, uid, ids)
""" Confirms production order and calculates quantity based on subproduct_type.
@return: Newly generated picking Id.
"""
picking_id = super(mrp_production,self).action_confirm(cr, uid, ids)
for production in self.browse(cr, uid, ids):
source = production.product_id.product_tmpl_id.property_stock_production.id
if not production.bom_id:
@@ -67,13 +76,13 @@ class mrp_production(osv.osv):
for sub_product in production.bom_id.sub_products:
qty1 = sub_product.product_qty
qty2 = production.product_uos and production.product_uos_qty or False
if sub_product.subproduct_type=='variable':
if sub_product.subproduct_type == 'variable':
if production.product_qty:
qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0)
if production.product_uos_qty:
qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
data = {
'name':'PROD:'+production.name,
'name': 'PROD:'+production.name,
'date_planned': production.date_planned,
'product_id': sub_product.product_id.id,
'product_qty': qty1,
@@ -84,9 +93,9 @@ class mrp_production(osv.osv):
'location_dest_id': production.location_dest_id.id,
'move_dest_id': production.move_prod_id.id,
'state': 'waiting',
'production_id':production.id
'production_id': production.id
}
sub_prod_ids=self.pool.get('stock.move').create(cr, uid,data)
sub_prod_ids = self.pool.get('stock.move').create(cr, uid, data)
return picking_id
mrp_production()
-1
View File
@@ -23,7 +23,6 @@
import pos
import account_bank_statement
import pos_account_bank_statement
import stock
import wizard
import report
+23 -12
View File
@@ -463,12 +463,13 @@ class pos_order(osv.osv):
"""Create a picking for each order and validate it."""
picking_obj = self.pool.get('stock.picking')
pick_name=self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
orders = self.browse(cr, uid, ids, context)
for order in orders:
if not order.picking_id:
new = True
picking_id = picking_obj.create(cr, uid, {
'name':pick_name,
'origin': order.name,
'type': 'out',
'state': 'draft',
@@ -504,7 +505,7 @@ class pos_order(osv.osv):
if line.qty < 0:
location_id, stock_dest_id = stock_dest_id, location_id
self.pool.get('stock.move').create(cr, uid, {
self.pool.get('stock.move').create(cr, uid, {
'name': 'Stock move (POS %d)' % (order.id, ),
'product_uom': line.product_id.uom_id.id,
'product_uos': line.product_id.uom_id.id,
@@ -1086,17 +1087,18 @@ class pos_order_line(osv.osv):
raise osv.except_osv(_('No Pricelist !'),
_('You have to select a pricelist in the sale form !\n' \
'Please set one before choosing a product.'))
p_obj = self.pool.get('product.product').browse(cr,uid,product_id).list_price
p_obj = self.pool.get('product.product').browse(cr,uid,[product_id])[0]
uom_id=p_obj.uom_po_id.id
price = self.pool.get('product.pricelist').price_get(cr, uid,
[pricelist], product_id, qty or 1.0, partner_id)[pricelist]
# Todo need to check
# if price is False:
# raise osv.except_osv(_('No valid pricelist line found !'),
# _("Couldn't find a pricelist line matching this product" \
# " and quantity.\nYou have to change either the product," \
# " the quantity or the pricelist."))
return price or p_obj
[pricelist], product_id, qty or 1.0, partner_id,{'uom': uom_id})[pricelist]
unit_price=price or p_obj.list_price
if unit_price is False:
raise osv.except_osv(_('No valid pricelist line found !'),
_("Couldn't find a pricelist line matching this product" \
" and quantity.\nYou have to change either the product," \
" the quantity or the pricelist."))
return unit_price
def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False):
price = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id)
self.write(cr,uid,ids,{'price_unit':price})
@@ -1329,4 +1331,13 @@ class product_product(osv.osv):
'disc_controle': lambda *a: True,
}
product_product()
class stock_picking(osv.osv):
_inherit = 'stock.picking'
_columns = {
'pos_order': fields.many2one('pos.order', 'Pos order'),
}
stock_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+4 -6
View File
@@ -66,7 +66,7 @@
<button name="%(action_report_pos_receipt)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
<button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
<button name="%(action_view_pos_return)d" string="Return Picking" type="action" icon="gtk-ok" states="paid"
attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}"/>
attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'return':'return'}" />
</group>
</page>
@@ -85,6 +85,7 @@
<field name="date_order"/>
<field name="date_validation" />
<field name="date_payment" groups="base.group_extended"/>
<field name="type_rec" colspan="4"/>
</group>
<group colspan="4">
<separator string="Invoicing" colspan="4"/>
@@ -109,12 +110,9 @@
</form>
</field>
</page>
<page string="Notes" >
<separator string="Notes" colspan="4" />
<group colspan="4">
<field name="type_rec" colspan="4"/>
<field name="note" colspan="4"/>
</group>
<field colspan="4" name="note" nolabel="1"/>
</page>
</notebook>
+6 -6
View File
@@ -95,7 +95,7 @@
ref('stock.menu_action_picking_tree7'),
ref('stock.menu_action_picking_tree8'),
ref('stock.menu_action_picking_tree9'),
ref('mrp_procurement.menu_mrp_procurement_action3'),
ref('procurement.menu_mrp_procurement_action3'),
ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
<field eval="[(6,0,[ref('res_users_shopuser0'),ref('res_users_shopuser1')])]" name="users"/>
<field eval="[(6,0,[ref('point_of_sale.ir_rule_group_point0'),ref('point_of_sale.ir_rule_group_poslinecompany0'),ref('point_of_sale.ir_rule_group_posreporting0')])]" name="rule_groups"/>
@@ -132,7 +132,7 @@
</record>
<record id="ir_modelsmrp_pdt0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="perm_read"/>
<field eval="&quot;&quot;&quot;MRP - Procurement&quot;&quot;&quot;" name="name"/>
<field eval="0" name="perm_unlink"/>
@@ -206,7 +206,7 @@
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_stockwarehouseorderpoint0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_stock_warehouse_orderpoint"/>
<field name="model_id" ref="procurement.model_stock_warehouse_orderpoint"/>
<field eval="1" name="perm_read"/>
<field eval="&quot;&quot;&quot;stock.warehouse.orderpoint&quot;&quot;&quot;" name="name"/>
<field eval="0" name="perm_unlink"/>
@@ -474,12 +474,12 @@
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_procurement0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_mrp_procurement" />
<field name="model_id" ref="procurement.model_procurement_order" />
<field eval="1" name="perm_read" />
<field eval="1" name="perm_write" />
<field eval="1" name="perm_create" />
<field eval="0" name="perm_unlink" />
<field name="name" eval="&quot;&quot;&quot;mrp.procurement&quot;&quot;&quot;" />
<field name="name" eval="&quot;&quot;&quot;procurement.order&quot;&quot;&quot;" />
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_tax0" model="ir.model.access">
@@ -497,7 +497,7 @@
name="Reporting"
parent="stock.menu_stock_root" groups="base.group_user"/>
<menuitem action="stock.action_picking_tree" id="stock.menu_action_picking_tree" parent="stock.menu_stock_warehouse_mgmt" sequence="19" groups="res_groups_posuser0"/>
<!-- <menuitem id="mrp_procurement.menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4" groups="base.group_user"/>-->
<!-- <menuitem id="procurement.menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4" groups="base.group_user"/>-->
<menuitem parent="stock.next_id_61" action="stock.action_stock_line_date" id="stock.menu_report_stock_line_date" groups="base.group_user"/>
</data>
+4 -4
View File
@@ -177,7 +177,7 @@
ref('stock.menu_action_picking_tree7'),
ref('stock.menu_action_picking_tree8'),
ref('stock.menu_action_picking_tree9'),
ref('mrp_procurement.menu_mrp_procurement_action3'),
ref('procurement.menu_mrp_procurement_action3'),
ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
<field eval="[(6,0,[ref('point_of_sale.ir_rule_group_point0'),ref('point_of_sale.ir_rule_group_poslinecompany0'),ref('point_of_sale.ir_rule_group_posreporting0')])]" name="rule_groups"/>
<field eva="[(6,0,[ref('res_users_shopuser0'),ref('res_users_shopuser1')])]" name="users"/>
@@ -214,7 +214,7 @@
</record>
<record id="ir_modelsmrp_pdt0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="perm_read"/>
<field eval="&quot;&quot;&quot;MRP - Procurement&quot;&quot;&quot;" name="name"/>
<field eval="0" name="perm_unlink"/>
@@ -557,12 +557,12 @@
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_procurement0" model="ir.model.access">
<field name="model_id" ref="mrp_procurement.model_mrp_procurement" />
<field name="model_id" ref="procurement.model_procurement_order" />
<field eval="1" name="perm_read" />
<field eval="1" name="perm_write" />
<field eval="1" name="perm_create" />
<field eval="0" name="perm_unlink" />
<field name="name" eval="&quot;&quot;&quot;mrp.procurement&quot;&quot;&quot;" />
<field name="name" eval="&quot;&quot;&quot;procurement.order&quot;&quot;&quot;" />
<field name="group_id" ref="res_groups_posuser0"/>
</record>
<record id="ir_model_access_tax0" model="ir.model.access">
+1 -1
View File
@@ -33,7 +33,7 @@
<field eval="1" name="global"/>
</record>
<record id="point_of_sale.res_groups_posuser0" model="res.groups">
<field eval="[(6,0,[ref('product.menu_config_product'),ref('product.menu_product_category_action_form'),ref('point_of_sale.menu_point_ofsale'),ref('point_of_sale.menu_point_config'),ref('point_of_sale.menu_statement_tree_all'),ref('stock.menu_stock_root'),ref('stock.menu_action_location_form'),ref('stock.menu_action_location_tree'),ref('stock.menu_picking_waiting'),ref('stock.menu_action_picking_tree3'),ref('stock.menu_action_picking_tree5'),ref('stock.menu_action_picking_form'),ref('stock.menu_action_picking_tree7'),ref('stock.menu_action_picking_tree8'),ref('stock.menu_action_picking_tree9'),ref('mrp_procurement.menu_mrp_procurement_action3'),ref('mrp_procurement.menu_mrp_procurement_new'),ref('mrp.next_id_77'),ref('mrp.menu_report_workcenter_load'),ref('mrp.menu_report_in_out_picking'),ref('base.menu_sales'),ref('sale.menu_action_shop_form'),ref('sale.menu_sale_order'),ref('sale.menu_action_order_tree'),ref('sale.menu_action_order_tree_all'),ref('sale.menu_action_order_tree2'),ref('sale.menu_action_order_tree3'),ref('sale.menu_action_order_tree7'),ref('sale.menu_action_order_tree8'),ref('sale.menu_action_order_line_tree1'),ref('delivery.menu_action_delivery_carrier_form'),ref('delivery.menu_action_delivery_grid_form'),ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
<field eval="[(6,0,[ref('product.menu_config_product'),ref('product.menu_product_category_action_form'),ref('point_of_sale.menu_point_ofsale'),ref('point_of_sale.menu_point_config'),ref('point_of_sale.menu_statement_tree_all'),ref('stock.menu_stock_root'),ref('stock.menu_action_location_form'),ref('stock.menu_action_location_tree'),ref('stock.menu_picking_waiting'),ref('stock.menu_action_picking_tree3'),ref('stock.menu_action_picking_tree5'),ref('stock.menu_action_picking_form'),ref('stock.menu_action_picking_tree7'),ref('stock.menu_action_picking_tree8'),ref('stock.menu_action_picking_tree9'),ref('procurement.menu_mrp_procurement_action3'),ref('procurement.menu_mrp_procurement_new'),ref('mrp.next_id_77'),ref('mrp.menu_report_workcenter_load'),ref('mrp.menu_report_in_out_picking'),ref('base.menu_sales'),ref('sale.menu_action_shop_form'),ref('sale.menu_sale_order'),ref('sale.menu_action_order_tree'),ref('sale.menu_action_order_tree_all'),ref('sale.menu_action_order_tree2'),ref('sale.menu_action_order_tree3'),ref('sale.menu_action_order_tree7'),ref('sale.menu_action_order_tree8'),ref('sale.menu_action_order_line_tree1'),ref('delivery.menu_action_delivery_carrier_form'),ref('delivery.menu_action_delivery_grid_form'),ref('point_of_sale.menu_point_root')])]" name="menu_access"/>
<field eval="[(6,0,[ref('ir_rule_group_bankstatementcompany0'),ref('ir_rule_group_bankstatementlinecompany0'),ref('point_of_sale.ir_rule_group_point0'),ref('point_of_sale.ir_rule_group_poslinecompany0'),ref('point_of_sale.ir_rule_group_posreporting0')])]" name="rule_groups"/>
<field eval="&quot;&quot;&quot;POS_user&quot;&quot;&quot;" name="name"/>
</record>
-37
View File
@@ -1,37 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
import time
import netsvc
class stock_picking(osv.osv):
_inherit = 'stock.picking'
_columns = {
'pos_order': fields.many2one('pos.order', 'Pos order'),
}
stock_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -62,6 +62,14 @@ class add_product(osv.osv_memory):
'type': 'ir.actions.act_window',
}
def close_action(self, cr, uid, ids, context):
"""
To get the product and Make the payment .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : Return the Make Payment
"""
record_id = context and context.get('active_id', False)
order_obj= self.pool.get('pos.order')
@@ -37,6 +37,14 @@ class pos_discount(osv.osv_memory):
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
res = super(pos_discount, self).view_init(cr, uid, fields_list, context=context)
record_id = context and context.get('active_id', False) or False
order = self.pool.get('pos.order').browse(cr, uid, record_id)
+13 -6
View File
@@ -123,7 +123,7 @@ class pos_make_payment(osv.osv_memory):
"""
return result
def check(self, cr, uid, ids, context=None):
def check(self, cr, uid, ids, context):
"""Check the order:
if the order is not paid: continue payment,
@@ -153,8 +153,11 @@ class pos_make_payment(osv.osv_memory):
return self.create_invoice(cr,uid,ids,context)
else:
context.update({'flag': True})
order_obj.action_paid(cr,uid,[active_id],context)
order_obj.write(cr, uid, [active_id],{'state':'paid'})
order_obj.action_paid(cr,uid,[active_id],context)
if context.get('return'):
order_obj.write(cr, uid, [active_id],{'state':'done'})
else:
order_obj.write(cr, uid, [active_id],{'state':'paid'})
return self.print_report(cr, uid, ids, context)
if order.amount_paid > 0.0:
context.update({'flag': True})
@@ -166,6 +169,10 @@ class pos_make_payment(osv.osv_memory):
def create_invoice(self, cr, uid, ids, context):
"""
Create a invoice
"""
wf_service = netsvc.LocalService("workflow")
active_ids = [context and context.get('active_id',False)]
for i in active_ids:
@@ -178,8 +185,6 @@ class pos_make_payment(osv.osv_memory):
}
def print_report(self, cr, uid, ids, context=None):
if not context:
context={}
"""
@summary: To get the date and print the report
@param self: The object pointer.
@@ -187,7 +192,9 @@ class pos_make_payment(osv.osv_memory):
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : retrun report
"""
"""
if not context:
context={}
active_id=context.get('active_id',[])
datas = {'ids' : [active_id]}
res = {}
@@ -26,9 +26,6 @@ import time
class pos_payment_report_date(osv.osv_memory):
'''
Open ERP Model
'''
_name = 'pos.payment.report.date'
_description = 'POS Payment Report according to date'
def print_report(self, cr, uid, ids, context=None):
@@ -25,9 +25,6 @@ from osv import fields
class pos_payment_report_user(osv.osv_memory):
'''
Open ERP Model
'''
_name = 'pos.payment.report.user'
_description = 'Sales lines by Users'
def print_report(self, cr, uid, ids, context=None):
@@ -32,6 +32,14 @@ class pos_receipt(osv.osv_memory):
}
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'])
for order in order_lst:
if order.state_2 in ('to_verify'):
+33 -2
View File
@@ -63,6 +63,14 @@ class pos_return(osv.osv_memory):
return res
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
res = super(pos_return, self).view_init(cr, uid, fields_list, context=context)
order_obj=self.pool.get('pos.order')
if not context:
@@ -77,6 +85,18 @@ class pos_return(osv.osv_memory):
return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view.
"""
result = super(pos_return, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
if not context:
context={}
@@ -123,6 +143,15 @@ class pos_return(osv.osv_memory):
def create_returns(self, cr, uid, data, context):
"""
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: Return the add product form again for adding more product
"""
return {
'name': _('Add Product'),
'view_type': 'form',
@@ -186,6 +215,7 @@ class pos_return(osv.osv_memory):
line_obj.copy(cr,uid,line.id,{'qty':-qty ,
'order_id': new_order,
})
order_obj.write(cr,uid, active_id, {'state':'done'})
order_obj.write(cr,uid, new_order, {'state':'done'})
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)
@@ -334,8 +364,9 @@ class add_product(osv.osv_memory):
})
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)
obj=order_obj.browse(cr,uid, active_ids[0])
obj=order_obj.browse(cr,uid, active_ids[0])
context.update({'return':'return'})
if obj.amount_total != obj.amount_paid:
return {
'name': _('Make Payment'),
@@ -19,7 +19,7 @@
#
##############################################################################
import mrp_procurement
import procurement
import wizard
import schedulers
import company
@@ -33,18 +33,18 @@
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
'security/mrp_procurement_security.xml',
'mrp_procurement_data.xml',
'security/procurement_security.xml',
'procurement_data.xml',
'wizard/make_procurement_view.xml',
'wizard/mrp_procurement_view.xml',
'wizard/orderpoint_procurement_view.xml',
'mrp_procurement_view.xml',
'procurement_view.xml',
'wizard/schedulers_all_view.xml',
'mrp_procurement_workflow.xml',
'procurement_workflow.xml',
'process/procurement_process.xml',
"company_view.xml",
],
# 'demo_xml': [],
'demo_xml': ['stock_orderpoint.xml'],
'installable': True,
'active': False,
'certificate': '',
@@ -8,7 +8,7 @@
<record id="process_process_procurementprocess0" model="process.process">
<field eval="&quot;&quot;&quot;Procurement&quot;&quot;&quot;" name="name"/>
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="1" name="active"/>
</record>
@@ -62,11 +62,11 @@ mrp_property()
# Produce, Buy or Find products and place a move
# then wizard for picking lists & move
#
class mrp_procurement(osv.osv):
class procurement_order(osv.osv):
"""
Procurement Orders
"""
_name = "mrp.procurement"
_name = "procurement.order"
_description = "Procurement"
_order = 'priority,date_planned desc'
_log_create = False
@@ -92,7 +92,7 @@ class mrp_procurement(osv.osv):
'note': fields.text('Note'),
'property_ids': fields.many2many('mrp.property', 'mrp_procurement_property_rel', 'procurement_id','property_id', 'Properties'),
'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'),
'message': fields.char('Latest error', size=64, help="Exception occurred while computing procurement orders."),
'state': fields.selection([
@@ -115,7 +115,7 @@ class mrp_procurement(osv.osv):
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'close_move': lambda *a: 0,
'procure_method': lambda *a: 'make_to_order',
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'procurement.order', context=c)
}
def unlink(self, cr, uid, ids, context=None):
@@ -176,7 +176,7 @@ class mrp_procurement(osv.osv):
return res
#
# This method may be overrided by objects that override mrp.procurment
# This method may be overrided by objects that override procurement.order
# for computing their own purpose
#
def _quantity_compute_get(self, cr, uid, proc, context={}):
@@ -287,7 +287,7 @@ class mrp_procurement(osv.osv):
if procurement.product_id.product_tmpl_id.supply_method <> 'buy':
return False
if not procurement.product_id.seller_ids:
cr.execute('update mrp_procurement set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
return False
partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in procurement.product_id.seller_ids if partner_id and partner_id.sequence])
partner = partner_list and partner_list[0] and partner_list[0][1] and partner_list[0][1].name or False
@@ -297,7 +297,7 @@ class mrp_procurement(osv.osv):
return False
address_id = partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery']
if not address_id:
cr.execute('update mrp_procurement set message=%s where id=%s', (_('No address defined for the supplier'), procurement.id))
cr.execute('update procurement_order set message=%s where id=%s', (_('No address defined for the supplier'), procurement.id))
return False
return True
@@ -361,7 +361,7 @@ class mrp_procurement(osv.osv):
ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id])
cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%s', (procurement.product_id.id,))
if not cr.fetchone()[0]:
cr.execute('update mrp_procurement set message=%s where id=%s', (_('Stock is not enough and No minimum orderpoint rule defined'), procurement.id))
cr.execute('update procurement_order set message=%s where id=%s', (_('Stock is not enough and No minimum orderpoint rule defined'), procurement.id))
return ok
def action_produce_assign_service(self, cr, uid, ids, context={}):
@@ -406,7 +406,7 @@ class mrp_procurement(osv.osv):
self.write(cr, uid, ids, {'state': 'cancel'})
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
wf_service.trg_trigger(uid, 'procurement.order', id, cr)
return True
def action_check_finnished(self, cr, uid, ids):
@@ -442,7 +442,7 @@ class mrp_procurement(osv.osv):
res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')})
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
wf_service.trg_trigger(uid, 'procurement.order', id, cr)
return res
def run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
@@ -455,7 +455,7 @@ class mrp_procurement(osv.osv):
self._procure_orderpoint_confirm(cr, uid, automatic=automatic,\
use_new_cursor=use_new_cursor, context=context)
mrp_procurement()
procurement_order()
class stock_warehouse_orderpoint(osv.osv):
@@ -463,16 +463,16 @@ class stock_warehouse_orderpoint(osv.osv):
Defines Minimum stock rules.
"""
_name = "stock.warehouse.orderpoint"
_description = "Orderpoint minimum rule"
_description = "Minimum Inventory Rule"
_columns = {
'name': fields.char('Name', size=32, required=True),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the orderpoint without removing it."),
'logic': fields.selection([('max','Order to Max'),('price','Best price (not yet active!)')], 'Reordering Mode', required=True),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True),
'location_id': fields.many2one('stock.location', 'Location', required=True),
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True, ondelete="cascade"),
'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete="cascade"),
'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','=','product')]),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True ),
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'product_min_qty': fields.float('Min Quantity', required=True,
help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
"a procurement to bring the virtual stock to the Max Quantity."),
@@ -481,18 +481,21 @@ class stock_warehouse_orderpoint(osv.osv):
"a procurement to bring the virtual stock to the Max Quantity."),
'qty_multiple': fields.integer('Qty Multiple', required=True,
help="The procurement quantity will by rounded up to this multiple."),
'procurement_id': fields.many2one('mrp.procurement', 'Latest procurement'),
'procurement_id': fields.many2one('procurement.order', 'Latest procurement', ondelete="set null"),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {
'active': lambda *a: 1,
'logic': lambda *a: 'max',
'qty_multiple': lambda *a: 1,
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'stock.orderpoint') or '',
'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
}
_sql_constraints = [
('qty_multiple_check', 'CHECK( qty_multiple > 0 )', _('Qty Multiple must be greater than zero.')),
]
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
""" Finds location id for changed warehouse.
@param warehouse_id: Changed id of warehouse.
@@ -503,7 +506,7 @@ class stock_warehouse_orderpoint(osv.osv):
v = {'location_id': w.lot_stock_id.id}
return {'value': v}
return {}
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
""" Finds UoM for changed product.
@param product_id: Changed id of product.
@@ -514,14 +517,14 @@ class stock_warehouse_orderpoint(osv.osv):
v = {'product_uom': prod.uom_id.id}
return {'value': v}
return {}
def copy(self, cr, uid, id, default=None,context={}):
if not default:
default = {}
default.update({
'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.warehouse.orderpoint') or '',
'name': self.pool.get('ir.sequence').get(cr, uid, 'stock.orderpoint') or '',
})
return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
stock_warehouse_orderpoint()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -10,10 +10,23 @@
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall"/>
<field eval="'mrp.procurement'" name="model"/>
<field eval="'procurement.order'" name="model"/>
<field eval="'run_scheduler'" name="function"/>
<field eval="'(False,)'" name="args"/>
</record>
<record id="sequence_mrp_op_type" model="ir.sequence.type">
<field name="name">Stock orderpoint</field>
<field name="code">stock.orderpoint</field>
</record>
<record id="sequence_mrp_op" model="ir.sequence">
<field name="name">Stock orderpoint</field>
<field name="code">stock.orderpoint</field>
<field name="prefix">OP/</field>
<field name="padding">5</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>
</data>
</openerp>
@@ -5,9 +5,9 @@
Procurement
-->
<record id="mrp_procurement_tree_view" model="ir.ui.view">
<field name="name">mrp.procurement.tree</field>
<field name="model">mrp.procurement</field>
<record id="procurement_tree_view" model="ir.ui.view">
<field name="name">procurement.order.tree</field>
<field name="model">procurement.order</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Procurement Lines" colors="red:date_planned&lt;current_date and state in ('exception');black:state=='running';green:state=='confirmed';gray:state in ['done','cancel'];blue:state in ('ready')">
@@ -22,9 +22,9 @@
</tree>
</field>
</record>
<record id="mrp_procurement_form_view" model="ir.ui.view">
<field name="name">mrp.procurement.form</field>
<field name="model">mrp.procurement</field>
<record id="procurement_form_view" model="ir.ui.view">
<field name="name">procurement.order.form</field>
<field name="model">procurement.order</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Procurement">
@@ -79,9 +79,9 @@
</form>
</field>
</record>
<record id="view_mrp_procurement_filter" model="ir.ui.view">
<field name="name">mrp.procurement.select</field>
<field name="model">mrp.procurement</field>
<record id="view_procurement_filter" model="ir.ui.view">
<field name="name">procurement.order.select</field>
<field name="model">procurement.order</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Procurement">
@@ -109,51 +109,51 @@
</search>
</field>
</record>
<record id="mrp_procurement_action" model="ir.actions.act_window">
<record id="procurement_action" model="ir.actions.act_window">
<field name="name">Procurement Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.procurement</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="context">{'search_default_current':1}</field>
<field name="search_view_id" ref="view_mrp_procurement_filter"/>
<field name="search_view_id" ref="view_procurement_filter"/>
<field name="context">{'search_default_Current':1}</field>
</record>
<record id="mrp_procurement_action3" model="ir.actions.act_window">
<record id="procurement_action3" model="ir.actions.act_window">
<field name="name">Procurements</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.procurement</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_mrp_procurement_filter"/>
<field name="search_view_id" ref="view_procurement_filter"/>
<field name="domain">[]</field>
<field name="context">{}</field>
</record>
<record id="mrp_procurement_action5" model="ir.actions.act_window">
<record id="procurement_action5" model="ir.actions.act_window">
<field name="name">Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.procurement</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception')]</field>
</record>
<record id="mrp_procurement_action4" model="ir.actions.act_window">
<record id="procurement_action4" model="ir.actions.act_window">
<field name="name">Procurement Exceptions to Fix</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.procurement</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception'), ('message', '&lt;&gt;', '')]</field>
<field name="filter" eval="True"/>
</record>
<record id="mrp_procurement_action11" model="ir.actions.act_window">
<record id="procurement_action11" model="ir.actions.act_window">
<field name="name">Temporary Procurement Exceptions</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.procurement</field>
<field name="res_model">procurement.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception'), ('message', '=', '')]</field>
@@ -255,17 +255,17 @@
<act_window
context="{'product_uom': locals().has_key('uom_id') and uom_id}"
domain="[('product_id', '=', active_id)]"
id="act_mrp_procurement_2_stock_warehouse_orderpoint"
id="act_procurement_2_stock_warehouse_orderpoint"
name="Minimum Stock Rules"
res_model="stock.warehouse.orderpoint"
src_model="mrp.procurement"/>
src_model="procurement.order"/>
<act_window
domain="[('id', '=', product_id)]"
id="act_product_product_2_stock_warehouse_orderpoint"
name="Product"
res_model="product.product"
src_model="mrp.procurement"/>
src_model="procurement.order"/>
</data>
</openerp>
@@ -3,8 +3,8 @@
<data>
<record id="wkf_procurement" model="workflow">
<field name="name">mrp.procurement.basic</field>
<field name="osv">mrp.procurement</field>
<field name="name">procurement.order.basic</field>
<field name="osv">procurement.order</field>
<field name="on_create">True</field>
</record>
@@ -26,8 +26,8 @@ from mx import DateTime
import time
class mrp_procurement(osv.osv):
_inherit = 'mrp.procurement'
class procurement_order(osv.osv):
_inherit = 'procurement.order'
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None):
'''
@@ -40,11 +40,11 @@ class mrp_procurement(osv.osv):
cr = pooler.get_db(use_new_cursor).cursor()
wf_service = netsvc.LocalService("workflow")
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
if not ids:
ids = procurement_obj.search(cr, uid, [], order="date_planned")
for id in ids:
wf_service.trg_validate(uid, 'mrp.procurement', id, 'button_restart', cr)
wf_service.trg_validate(uid, 'procurement.order', id, 'button_restart', cr)
if use_new_cursor:
cr.commit()
@@ -57,11 +57,11 @@ class mrp_procurement(osv.osv):
report_except = 0
report_later = 0
while True:
cr.execute('select id from mrp_procurement where state=%s and procure_method=%s order by priority,date_planned limit 500 offset %s', ('confirmed', 'make_to_order', offset))
cr.execute('select id from procurement_order where state=%s and procure_method=%s order by priority,date_planned limit 500 offset %s', ('confirmed', 'make_to_order', offset))
ids = map(lambda x: x[0], cr.fetchall())
for proc in procurement_obj.browse(cr, uid, ids):
if (maxdate.strftime('%Y-%m-%d') >= proc.date_planned):
wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
else:
offset += 1
report_later += 1
@@ -84,7 +84,7 @@ class mrp_procurement(osv.osv):
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
for proc in procurement_obj.browse(cr, uid, ids):
if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) :
wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr)
report_ids.append(proc.id)
else:
report_later += 1
@@ -129,7 +129,7 @@ class mrp_procurement(osv.osv):
if not context:
context = {}
product_obj = self.pool.get('product.product')
proc_obj = self.pool.get('mrp.procurement')
proc_obj = self.pool.get('procurement.order')
warehouse_obj = self.pool.get('stock.warehouse')
wf_service = netsvc.LocalService("workflow")
@@ -161,8 +161,8 @@ class mrp_procurement(osv.osv):
'location_id': location_id,
'procure_method': 'make_to_order',
})
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_check', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr)
def _procure_orderpoint_confirm(self, cr, uid, automatic=False,\
use_new_cursor=False, context=None, user_id=False):
@@ -175,7 +175,7 @@ class mrp_procurement(osv.osv):
cr = pooler.get_db(use_new_cursor).cursor()
orderpoint_obj = self.pool.get('stock.warehouse.orderpoint')
location_obj = self.pool.get('stock.location')
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
request_obj = self.pool.get('res.request')
wf_service = netsvc.LocalService("workflow")
report = []
@@ -186,8 +186,9 @@ class mrp_procurement(osv.osv):
while ids:
ids = orderpoint_obj.search(cr, uid, [], offset=offset, limit=100)
for op in orderpoint_obj.browse(cr, uid, ids):
if op.procurement_id and op.procurement_id.purchase_id and op.procurement_id.purchase_id.state in ('draft', 'confirmed'):
continue
if op.procurement_id.state != 'exception':
if op.procurement_id and op.procurement_id.purchase_id and op.procurement_id.purchase_id.state in ('draft', 'confirmed'):
continue
prods = location_obj._product_virtual_get(cr, uid,
op.location_id.id, [op.product_id.id],
{'uom': op.product_uom.id})[op.product_id.id]
@@ -217,9 +218,9 @@ class mrp_procurement(osv.osv):
'procure_method': 'make_to_order',
'origin': op.name
})
wf_service.trg_validate(uid, 'mrp.procurement', proc_id,
wf_service.trg_validate(uid, 'procurement.order', proc_id,
'button_confirm', cr)
wf_service.trg_validate(uid, 'mrp.procurement', proc_id,
wf_service.trg_validate(uid, 'procurement.order', proc_id,
'button_check', cr)
orderpoint_obj.write(cr, uid, [op.id],
{'procurement_id': proc_id})
@@ -237,6 +238,6 @@ class mrp_procurement(osv.osv):
cr.commit()
cr.close()
return {}
mrp_procurement()
procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -22,7 +22,7 @@
import xmlrpclib
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/wizard')
wiz_id = sock.create('trunk', 1, 'admin', 'mrp.procurement.compute.all')
wiz_id = sock.create('trunk', 1, 'admin', 'procurement.order.compute.all')
sock.execute('trunk', 1, 'admin', wiz_id, {'form': {'po_cycle': 1.0, 'po_lead': 1.0, 'user_id': 3, 'schedule_cycle': 1.0, 'picking_lead': 1.0, 'security_lead': 50.0, 'automatic': False}, 'ids': [], 'report_type': 'pdf', 'model': 'ir.ui.menu', 'id': False}, 'compute', {})
@@ -1,9 +1,9 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_mrp_property_group","mrp.property.group","model_mrp_property_group",,1,0,0,0
"access_mrp_property","mrp.property","model_mrp_property",,1,0,0,0
"access_mrp_procurement","mrp.procurement","model_mrp_procurement",,1,0,0,0
"access_procurement","procurement.order","model_procurement_order",,1,0,0,0
"access_stock_warehouse_orderpoint","stock.warehouse.orderpoint","model_stock_warehouse_orderpoint",,1,0,0,0
"access_mrp_procurement_compute_all","mrp.procurement.compute.all","model_mrp_procurement_compute_all",,1,0,0,0
"access_mrp_procurement_orderpoint_compute","mrp.procurement.orderpoint.compute","model_mrp_procurement_orderpoint_compute",,1,0,0,0
"access_procurement_compute_all","procurement.order.compute.all","model_procurement_order_compute_all",,1,0,0,0
"access_procurement_orderpoint_compute","procurement.orderpoint.compute","model_procurement_orderpoint_compute",,1,0,0,0
"access_mrp_make_procurement","make.procurement","model_make_procurement",,1,0,0,0
"access_mrp_make_procurement","mrp.procurement.compute","model_mrp_procurement_compute",,1,0,0,0
"access_mrp_make_procurement","procurement.order.compute","model_procurement_order_compute",,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mrp_property_group mrp.property.group model_mrp_property_group 1 0 0 0
3 access_mrp_property mrp.property model_mrp_property 1 0 0 0
4 access_mrp_procurement access_procurement mrp.procurement procurement.order model_mrp_procurement model_procurement_order 1 0 0 0
5 access_stock_warehouse_orderpoint stock.warehouse.orderpoint model_stock_warehouse_orderpoint 1 0 0 0
6 access_mrp_procurement_compute_all access_procurement_compute_all mrp.procurement.compute.all procurement.order.compute.all model_mrp_procurement_compute_all model_procurement_order_compute_all 1 0 0 0
7 access_mrp_procurement_orderpoint_compute access_procurement_orderpoint_compute mrp.procurement.orderpoint.compute procurement.orderpoint.compute model_mrp_procurement_orderpoint_compute model_procurement_orderpoint_compute 1 0 0 0
8 access_mrp_make_procurement make.procurement model_make_procurement 1 0 0 0
9 access_mrp_make_procurement mrp.procurement.compute procurement.order.compute model_mrp_procurement_compute model_procurement_order_compute 1 0 0 0
@@ -2,9 +2,9 @@
<openerp>
<data noupdate="0">
<record model="ir.rule" id="mrp_procurement_rule">
<field name="name">mrp_procurement multi-company</field>
<field name="model_id" search="[('model','=','mrp.procurement')]" model="ir.model"/>
<record model="ir.rule" id="procurement_rule">
<field name="name">procurement multi-company</field>
<field name="model_id" search="[('model','=','procurement.order')]" model="ir.model"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
</record>
@@ -64,7 +64,7 @@ class make_procurement(osv.osv_memory):
"""
user = self.pool.get('res.users').browse(cr, uid, uid, context).login
wh_obj = self.pool.get('stock.warehouse')
procurement_obj = self.pool.get('mrp.procurement')
procurement_obj = self.pool.get('procurement.order')
wf_service = netsvc.LocalService("workflow")
data_obj = self.pool.get('ir.model.data')
@@ -80,11 +80,11 @@ class make_procurement(osv.osv_memory):
'procure_method':'make_to_order',
})
wf_service.trg_validate(uid, 'mrp.procurement', procure_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', procure_id, 'button_confirm', cr)
id2 = data_obj._get_id(cr, uid, 'mrp_procurement', 'mrp_procurement_tree_view')
id3 = data_obj._get_id(cr, uid, 'mrp_procurement', 'mrp_procurement_form_view')
id2 = data_obj._get_id(cr, uid, 'procurement', 'procurement_tree_view')
id3 = data_obj._get_id(cr, uid, 'procurement', 'procurement_form_view')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
@@ -94,7 +94,7 @@ class make_procurement(osv.osv_memory):
return {
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'mrp.procurement',
'res_model': 'procurement.order',
'res_id' : procure_id,
'views': [(id3,'form'),(id2,'tree')],
'type': 'ir.actions.act_window',
@@ -23,12 +23,12 @@ import threading
from osv import osv, fields
class procurement_compute(osv.osv_memory):
_name = 'mrp.procurement.compute'
_name = 'procurement.order.compute'
_description = 'Compute Procurement'
def _procure_calculation_procure(self, cr, uid, ids, context):
try:
proc_obj = self.pool.get('mrp.procurement')
proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context)
finally:
cr.close()
@@ -6,7 +6,7 @@
<record id="view_compute_procurment_wizard" model="ir.ui.view">
<field name="name">Compute Procurements</field>
<field name="model">mrp.procurement.compute</field>
<field name="model">procurement.order.compute</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Parameters">
@@ -23,8 +23,8 @@
</record>
<!-- <act_window name="Compute Procurements" -->
<!-- res_model="mrp.procurement.compute"-->
<!-- src_model="mrp.procurement"-->
<!-- res_model="procurement.order.compute"-->
<!-- src_model="procurement.order"-->
<!-- view_mode="form"-->
<!-- target="new" -->
<!-- key2="client_action_multi" -->
@@ -28,7 +28,7 @@ import threading
from osv import fields,osv
class procurement_compute(osv.osv_memory):
_name = 'mrp.procurement.orderpoint.compute'
_name = 'procurement.orderpoint.compute'
_description = 'Automatic Order Point'
_columns = {
@@ -47,7 +47,7 @@ class procurement_compute(osv.osv_memory):
@param ids: List of IDs selected
@param context: A standard dictionary
"""
proc_obj = self.pool.get('mrp.procurement')
proc_obj = self.pool.get('procurement.order')
for proc in self.browse(cr, uid, ids):
proc_obj._procure_orderpoint_confirm(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname, context=context)
@@ -6,7 +6,7 @@
<record id="view_procurement_compute_wizard" model="ir.ui.view">
<field name="name">Compute Stock Minimum Rules Only</field>
<field name="model">mrp.procurement.orderpoint.compute</field>
<field name="model">procurement.orderpoint.compute</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Parameters">
@@ -23,8 +23,8 @@
</record>
<act_window name="Compute Stock Minimum Rules Only"
res_model="mrp.procurement.orderpoint.compute"
src_model="mrp.procurement"
res_model="procurement.orderpoint.compute"
src_model="procurement.order"
view_mode="form"
target="new"
key2="client_action_multi"
@@ -23,8 +23,8 @@ import threading
from osv import osv, fields
class procurement_compute(osv.osv_memory):
_name = 'mrp.procurement.compute.all'
class procurement_compute_all(osv.osv_memory):
_name = 'procurement.order.compute.all'
_description = 'Compute all schedulers'
_columns = {
@@ -43,7 +43,7 @@ class procurement_compute(osv.osv_memory):
@param ids: List of IDs selected
@param context: A standard dictionary
"""
proc_obj = self.pool.get('mrp.procurement')
proc_obj = self.pool.get('procurement.order')
for proc in self.browse(cr, uid, ids):
proc_obj.run_scheduler(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname,\
context=context)
@@ -61,7 +61,7 @@ class procurement_compute(osv.osv_memory):
threaded_calculation.start()
return {}
procurement_compute()
procurement_compute_all()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -6,7 +6,7 @@
<record id="view_compute_schedulers_wizard" model="ir.ui.view">
<field name="name">Compute Schedulers</field>
<field name="model">mrp.procurement.compute.all</field>
<field name="model">procurement.order.compute.all</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Scheduler Parameters">
@@ -23,8 +23,8 @@
</record>
<act_window name="Compute Schedulers"
res_model="mrp.procurement.compute.all"
src_model="mrp.procurement"
res_model="procurement.order.compute.all"
src_model="procurement.order"
view_mode="form"
target="new"
key2="client_action_multi"
+1
View File
@@ -210,6 +210,7 @@ class product_category(osv.osv):
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."),
'type': fields.selection([('view','View'), ('normal','Normal')], 'Category Type'),
}
_defaults = {
'type' : lambda *a : 'normal',
+1 -1
View File
@@ -145,6 +145,6 @@ parameter) will see those record just disappear.
<field name="name">Stock Weight</field>
<field name="digits">2</field>
</record>
</data>
</openerp>
+1 -2
View File
@@ -466,8 +466,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Product Variant">
<separator colspan="4" string="Description"/>
<field name="product_tmpl_id" select="1"/>
<field name="product_tmpl_id" select="1"/>
<field name="active" select="1"/>
<field name="variants" select="1"/>
<field name="default_code" select="1"/>
+2 -1
View File
@@ -47,12 +47,13 @@ automatically created via sale orders.
""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['project', 'mrp_procurement', 'sale', 'mrp_jit'],
'depends': ['project', 'procurement', 'sale', 'mrp_jit'],
'init_xml': [],
'update_xml': ['project_mrp_workflow.xml',
#'process/project_mrp_process.xml',
],
'demo_xml': [],
'test': ['test/project_task_procurement.yml'],
'installable': True,
'active': False,
'certificate': '0031976495453',
+4 -4
View File
@@ -22,9 +22,9 @@
from osv import fields, osv, orm
import tools
class mrp_procurement(osv.osv):
_name = "mrp.procurement"
_inherit = "mrp.procurement"
class procurement_order(osv.osv):
_name = "procurement.order"
_inherit = "procurement.order"
def action_produce_assign_service(self, cr, uid, ids, context={}):
for procurement in self.browse(cr, uid, ids):
@@ -91,7 +91,7 @@ class mrp_procurement(osv.osv):
'project_id': project_id,
},context=context)
return task_id
mrp_procurement()
procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+3 -3
View File
@@ -26,7 +26,7 @@ class project_task(osv.osv):
_name = "project.task"
_inherit = "project.task"
_columns = {
'procurement_id': fields.many2one('mrp.procurement', 'Procurement', ondelete='set null')
'procurement_id': fields.many2one('procurement.order', 'Procurement', ondelete='set null')
}
def do_close(self, cr, uid, ids, *args):
@@ -35,7 +35,7 @@ class project_task(osv.osv):
for task in tasks:
if task.procurement_id:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.procurement', task.procurement_id.id, 'subflow.done', cr)
wf_service.trg_validate(uid, 'procurement.order', task.procurement_id.id, 'subflow.done', cr)
return res
def do_cancel(self, cr, uid, ids, *args):
@@ -44,7 +44,7 @@ class project_task(osv.osv):
for task in tasks:
if task.procurement_id:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.procurement', task.procurement_id.id, 'subflow.cancel', cr)
wf_service.trg_validate(uid, 'procurement.order', task.procurement_id.id, 'subflow.cancel', cr)
return True
project_task()
+3 -3
View File
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="workflow.transition" id="mrp_procurement.trans_produce_service_make_done">
<field name="act_from" ref="mrp_procurement.act_produce_service"/>
<field name="act_to" ref="mrp_procurement.act_make_done"/>
<record model="workflow.transition" id="procurement.trans_produce_service_make_done">
<field name="act_from" ref="procurement.act_produce_service"/>
<field name="act_to" ref="procurement.act_make_done"/>
<field name="signal">subflow.done</field>
</record>
</data>
@@ -1,3 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_mrp_procurement_project_user","mrp.procurement project_user","model_mrp_procurement","project.group_project_user",1,1,1,1
"access_mrp_procurement_project_manager","mrp.procurement project_manager","model_mrp_procurement","project.group_project_manager",1,1,1,1
"access_procurement_project_user","procurement.order project_user","model_procurement_order","project.group_project_user",1,1,1,1
"access_procurement_project_manager","procurement.order project_manager","model_procurement_order","project.group_project_manager",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mrp_procurement_project_user access_procurement_project_user mrp.procurement project_user procurement.order project_user model_mrp_procurement model_procurement_order project.group_project_user 1 1 1 1
3 access_mrp_procurement_project_manager access_procurement_project_manager mrp.procurement project_manager procurement.order project_manager model_mrp_procurement model_procurement_order project.group_project_manager 1 1 1 1
@@ -0,0 +1,75 @@
-
In order to test project_mrp module with OpenERP I want to create sale orders
with product type 'service' so when procurement runs one task is created.
-
I create record for a service type product.
-
!record {model: product.product, id: product_product_partnerstraining0}:
categ_id: product.product_category_7
cost_method: standard
mes_type: fixed
name: Partners Training
procure_method: make_to_order
supply_method: produce
type: service
uom_id: product.uom_day
uom_po_id: product.uom_day
warranty: 0.0
-
I create a sale order for product Partners Training which has type 'Service'.
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-21'
invoice_quantity: order
name: SO006
order_policy: manual
partner_id: base.res_partner_asus
partner_invoice_id: base.res_partner_address_tang
partner_order_id: base.res_partner_address_tang
partner_shipping_id: base.res_partner_address_tang
order_line:
- state: draft
delay: 7.0
name: Partners Training
price_unit: 1.0
product_id: product_product_partnerstraining0
product_uom: product.uom_day
product_uom_qty: 5.0
th_weight: 0.0
type: make_to_order
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
user_id: base.user_demo
-
I confirm this sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
I check the procurements.
-
!python {model: procurement.order}: |
from tools.translate import _
orderline_obj = self.pool.get('sale.order.line')
line_ids = orderline_obj.search(cr, uid, [('order_id','=', ref('sale_order_so0'))])
orders = orderline_obj.browse(cr, uid, line_ids)
proc_ids = map(lambda x: x.procurement_id.id, orders)
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
-
Now I check the tasks.
-
I see that one task is created for my sale order.
-
!python {model: project.task}: |
from tools.translate import _
order_obj = self.pool.get('sale.order')
order = order_obj.browse(cr, uid, ref('sale_order_so0'))
task_id = self.search(cr, uid, [('project_id.name','=', order.name)])
assert task_id, _('No Task is created!')
+1 -1
View File
@@ -31,7 +31,7 @@
""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['base', 'account', 'stock', 'process', 'mrp_procurement'],
'depends': ['base', 'account', 'stock', 'process', 'procurement'],
'init_xml': [],
'update_xml': [
+3 -3
View File
@@ -698,8 +698,8 @@ class purchase_order_line(osv.osv):
return True
purchase_order_line()
class mrp_procurement(osv.osv):
_inherit = 'mrp.procurement'
class procurement_order(osv.osv):
_inherit = 'procurement.order'
_columns = {
'purchase_id': fields.many2one('purchase.order', 'Latest Requisition'),
}
@@ -779,7 +779,7 @@ class mrp_procurement(osv.osv):
res[procurement.id] = purchase_id
self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': purchase_id})
return res
mrp_procurement()
procurement_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+3 -3
View File
@@ -353,9 +353,9 @@
-->
<record id="view_procurement_form_inherit" model="ir.ui.view">
<field name="name">mrp.procurement.form.inherit</field>
<field name="model">mrp.procurement</field>
<field name="inherit_id" ref="mrp_procurement.mrp_procurement_form_view"/>
<field name="name">procurement.order.form.inherit</field>
<field name="model">procurement.order</field>
<field name="inherit_id" ref="procurement.procurement_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/field[@name='close_move']" position="before">
+4 -4
View File
@@ -180,7 +180,7 @@
<!-- Procurement -->
<record id="act_buy" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="wkf_id" ref="procurement.wkf_procurement"/>
<field name="name">buy</field>
<field name="kind">subflow</field>
<field name="subflow_id" search="[('osv','=','purchase.order')]"/>
@@ -188,20 +188,20 @@
</record>
<record id="trans_confirm_mto_buy" model="workflow.transition">
<field name="act_from" ref="mrp_procurement.act_confirm_mto"/>
<field name="act_from" ref="procurement.act_confirm_mto"/>
<field name="act_to" ref="act_buy"/>
<field name="condition">check_buy()</field>
</record>
<record id="trans_buy_make_done" model="workflow.transition">
<field name="act_from" ref="act_buy"/>
<field name="act_to" ref="mrp_procurement.act_make_done"/>
<field name="act_to" ref="procurement.act_make_done"/>
<field name="signal">subflow.delivery_done</field>
</record>
<record id="trans_buy_cancel" model="workflow.transition">
<field name="act_from" ref="act_buy"/>
<field name="act_to" ref="mrp_procurement.act_cancel"/>
<field name="act_to" ref="procurement.act_cancel"/>
<field name="signal">subflow.cancel</field>
</record>
+19 -29
View File
@@ -1,5 +1,5 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
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'
@@ -22,14 +22,14 @@
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
In order to test the purchase flow,I create a new record where "invoice_method" is From Manual
-
Creating an purchase.order record
I create purchase order for iPod.
-
!record {model: purchase.order, id: purchase_order_po1}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: order
invoice_method: manual
location_id: stock.stock_location_stock
name: PO00010
order_line:
@@ -44,26 +44,21 @@
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
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
I confirm the 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.
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
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 _
@@ -72,14 +67,14 @@
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
To check that wizard "Create Invoices" gets opened
-
Creating a purchase.order.line_invoice record
I create purchase order line invoice entry.
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
I create invoice for products in the purchase order.
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
@@ -89,7 +84,7 @@
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
I check that invoice gets created.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -98,7 +93,7 @@
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
I check that a record gets created in the Pending Invoices.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -107,33 +102,28 @@
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
Supplier approve the 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.
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
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
I check that an entry gets created in the stock pickings.
-
!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
I check that an entry gets created in the stock moves.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -145,4 +135,4 @@
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 Traceability moves are created.
+19 -29
View File
@@ -1,5 +1,5 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
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'
@@ -22,9 +22,9 @@
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
In order to test the purchase flow,I create a new record where "invoice_method" is From Order.
-
Creating a purchase.order record
I create purchase order for iPod.
-
!record {model: purchase.order, id: purchase_order_po0}:
company_id: base.main_company
@@ -44,26 +44,21 @@
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
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
I confirm the purchase order for iPod.
-
!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.
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
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 _
@@ -72,14 +67,14 @@
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
To check that wizard "Create Invoices" gets called.
-
Creating a purchase.order.line_invoice record
I create purchase order line invoice entry.
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
I create invoice for products in the purchase order.
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
@@ -89,7 +84,7 @@
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
I check that invoice gets created.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -98,7 +93,7 @@
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
I check that a record gets created in the Pending Invoices.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -107,33 +102,28 @@
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
Supplier approve the 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.
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
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
I check that an entry gets created in the pickings.
-
!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
I check that an entry gets created in the stock moves.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -145,9 +135,9 @@
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 Traceability moves are created.
-
I check that an invoice_id field of Delivery&Invoices gets bind with the value
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"))
+20 -30
View File
@@ -1,5 +1,5 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
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'
@@ -22,9 +22,9 @@
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
In order to test the purchase flow,I create a new record where "invoice_method" is From Picking
-
Creating an purchase.order record
I create purchase order for iPod.
-
!record {model: purchase.order, id: purchase_order_po2}:
company_id: base.main_company
@@ -44,17 +44,12 @@
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
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
I confirm the purchase order for iPod.
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po2}
-
@@ -63,7 +58,7 @@
!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
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 _
@@ -72,14 +67,14 @@
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
To check that wizard "Create Invoices" gets opened.
-
Creating a purchase.order.line_invoice record
I create purchase order line invoice entry.
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
I create invoice for products in the purchase order.
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
@@ -89,7 +84,7 @@
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
I check that invoice gets created.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -98,7 +93,7 @@
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
I check that a record gets created in the Pending Invoices.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -107,12 +102,7 @@
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
Supplier approve the purchase order.
-
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po2}
-
@@ -121,19 +111,19 @@
!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
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
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
I check that an entry gets created related to stock move.
-
!python {model: purchase.order}: |
from tools.translate import _
@@ -145,18 +135,18 @@
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 Traceability moves are created.
-
Then I create an invoice from picking by clicking on "Create Invoice" wizard
Then I create an invoice from picking by clicking on "Create Invoice" wizard
-
Creating a stock.invoice.onshipping record
I create stock invoice on shipping entry.
-
!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
I create Invoice.
-
!python {model: stock.invoice.onshipping}: |
pur_obj=self.pool.get('purchase.order')
@@ -167,7 +157,7 @@
"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
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"))
@@ -136,11 +136,11 @@ class product_product(osv.osv):
product_product()
class mrp_procurement(osv.osv):
_inherit = 'mrp.procurement'
class procurement_order(osv.osv):
_inherit = 'procurement.order'
def make_po(self, cr, uid, ids, context={}):
sequence_obj=self.pool.get('ir.sequence')
res = super(mrp_procurement, self).make_po(cr, uid, ids, context)
res = super(procurement_order, self).make_po(cr, uid, ids, context)
for proc_id,po_id in res.items():
procurement = self.browse(cr, uid, proc_id)
if procurement.product_id.purchase_requisition:
@@ -157,4 +157,4 @@ class mrp_procurement(osv.osv):
'purchase_ids': [(6,0,[po_id])]
})
return res
mrp_procurement()
procurement_order()
@@ -59,8 +59,8 @@
-
I launch he scheduler to compute all procurements, and specify all requisitions orders.
-
!python {model: mrp.procurement.compute.all}: |
proc_obj = self.pool.get('mrp.procurement')
!python {model: procurement.order.compute.all}: |
proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr,uid)
-
On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on
@@ -52,8 +52,8 @@
-
I launch he scheduler to compute all procurements, and planify all requisitions orders.
-
!python {model: mrp.procurement.compute.all}: |
proc_obj = self.pool.get('mrp.procurement')
!python {model: procurement.order.compute.all}: |
proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr,uid)
-
I should find a purchase requisition with the origin 'TEST/TENDER/0002', that includes a request for
-1
View File
@@ -26,7 +26,6 @@
import sale
import stock
import product
#import mrp
import wizard
import report
import company
+3 -1
View File
@@ -42,7 +42,7 @@
""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['product', 'stock', 'mrp_procurement', 'process'],
'depends': ['product', 'stock', 'procurement', 'process'],
'init_xml': [],
'update_xml': [
'wizard/sale_make_invoice_advance.xml',
@@ -65,6 +65,8 @@
'test/shipping_manual_sale_order.yml',
'test/prepaid_sale_order.yml',
'test/advance_invoice.yml',
'test/so_make_line_invoice.yml',
'test/so_make_invoice.yml',
'test/sale_procurement.yml',
],
'installable': True,
+5 -5
View File
@@ -35,7 +35,7 @@
<field eval="&quot;&quot;&quot;Sale Order Requisition&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;Drives procurement orders for every sale order line.&quot;&quot;&quot;" name="note"/>
<field name="subflow_id" ref="process_process_salesprocess0"/>
<field name="process_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="procurement.process_process_procurementprocess0"/>
<field eval="&quot;&quot;&quot;object.state in ('draft', 'waiting_date', 'manual', 'progress', 'shipping_except', 'invoice_except', 'done', 'cancel')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
@@ -63,12 +63,12 @@
</record>
<record id="process_node_saleprocurement0" model="process.node">
<field name="menu_id" ref="mrp_procurement.menu_mrp_procurement_action"/>
<field name="model_id" ref="mrp_procurement.model_mrp_procurement"/>
<field name="menu_id" ref="procurement.menu_mrp_procurement_action"/>
<field name="model_id" ref="procurement.model_procurement_order"/>
<field eval="&quot;&quot;&quot;subflow&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Procurement Order&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;One Procurement order for each sale order line and for each of the components.&quot;&quot;&quot;" name="note"/>
<field name="subflow_id" ref="mrp_procurement.process_process_procurementprocess0"/>
<field name="subflow_id" ref="procurement.process_process_procurementprocess0"/>
<field name="process_id" ref="process_process_salesprocess0"/>
<field eval="&quot;&quot;&quot;object.state=='confirmed'&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
@@ -202,7 +202,7 @@
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="&quot;&quot;&quot;Procurement of sold material&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;For every sale order line, a procurement order is created to supply the sold product.&quot;&quot;&quot;" name="note"/>
<field model="process.node" name="target_node_id" ref="mrp_procurement.process_node_procureproducts0"/>
<field model="process.node" name="target_node_id" ref="procurement.process_node_procureproducts0"/>
<field model="process.node" name="source_node_id" ref="process_node_saleorderprocurement0"/>
</record>
+4
View File
@@ -41,8 +41,12 @@ class sale_report(osv.osv):
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'uom_id': fields.many2one('product.uom', 'Default Unit Of Measure', readonly=True),
'product_qty':fields.float('# of Qty', readonly=True),
'uom_name': fields.char('Default UoM', size=128, readonly=True),
'product_uom_qty':fields.float('# of Qty', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
+8 -8
View File
@@ -112,7 +112,7 @@ class sale_order(osv.osv):
LEFT JOIN
stock_picking p on (p.id=m.picking_id)
LEFT JOIN
mrp_procurement mp on (mp.move_id=m.id)
procurement_order mp on (mp.move_id=m.id)
WHERE
p.sale_id = ANY(%s) GROUP BY mp.state, p.sale_id''',(ids,))
for oid, nbr, mp_state in cr.fetchall():
@@ -658,7 +658,7 @@ class sale_order(osv.osv):
'note': line.notes,
'company_id': order.company_id.id,
})
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
proc_id = self.pool.get('procurement.order').create(cr, uid, {
'name': order.name,
'origin': order.name,
'date_planned': date_planned,
@@ -676,10 +676,10 @@ class sale_order(osv.osv):
'company_id': order.company_id.id,
})
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id})
elif line.product_id and line.product_id.product_tmpl_id.type == 'service':
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
proc_id = self.pool.get('procurement.order').create(cr, uid, {
'name': line.name,
'origin': order.name,
'date_planned': date_planned,
@@ -693,7 +693,7 @@ class sale_order(osv.osv):
})
self.pool.get('sale.order.line').write(cr, uid, [line.id], {'procurement_id': proc_id})
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
else:
#
# No procurement because no product in the sale.order.line.
@@ -807,7 +807,7 @@ class sale_order_line(osv.osv):
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True),
'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
'invoiced': fields.boolean('Invoiced', readonly=True),
'procurement_id': fields.many2one('mrp.procurement', 'Procurement'),
'procurement_id': fields.many2one('procurement.order', 'Procurement'),
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price'), readonly=True, states={'draft':[('readonly',False)]}),
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute= dp.get_precision('Sale Price')),
'tax_id': fields.many2many('account.tax', 'sale_order_tax', 'order_line_id', 'tax_id', 'Taxes', readonly=True, states={'draft':[('readonly',False)]}),
@@ -856,7 +856,7 @@ class sale_order_line(osv.osv):
return line.product_uos_qty or 0.0
return line.product_uom_qty
else:
return self.pool.get('mrp.procurement').quantity_get(cr, uid,
return self.pool.get('procurement.order').quantity_get(cr, uid,
line.procurement_id.id, context=context)
def _get_line_uom(line):
@@ -865,7 +865,7 @@ class sale_order_line(osv.osv):
return line.product_uos.id
return line.product_uom.id
else:
return self.pool.get('mrp.procurement').uom_get(cr, uid,
return self.pool.get('procurement.order').uom_get(cr, uid,
line.procurement_id.id, context=context)
create_ids = []
+1 -1
View File
@@ -206,7 +206,7 @@
<workflow action="order_confirm" model="sale.order" ref="order5"/>
<!-- Run all schedulers -->
<function model="mrp.procurement" name="run_scheduler"/>
<function model="procurement.order" name="run_scheduler"/>
<!-- sale advance demo.. -->
+1 -1
View File
@@ -112,7 +112,7 @@
</assert>
<!-- Run all schedulers -->
<function model="mrp.procurement" name="run_scheduler"/>
<function model="procurement.order" name="run_scheduler"/>
<assert id="test_order_1" model="sale.order" string="the sale order is now done">
<test expr="state">done</test>
+2 -2
View File
@@ -218,7 +218,7 @@
<record id="trans_ship_ship_end" model="workflow.transition">
<field name="act_from" ref="act_ship"/>
<field name="act_to" ref="act_ship_end"/>
<field name="trigger_model">mrp.procurement</field>
<field name="trigger_model">procurement.order</field>
<field name="trigger_expr_id">procurement_lines_get()</field>
<field name="condition">test_state('finished')</field>
</record>
@@ -226,7 +226,7 @@
<field name="act_from" ref="act_ship"/>
<field name="act_to" ref="act_ship_except"/>
<!--
<field name="trigger_model">mrp.procurement</field>
<field name="trigger_model">procurement.order</field>
<field name="trigger_expr_id">procurement_lines_get()</field>
-->
<field name="condition">test_state('canceled')</field>
+1 -1
View File
@@ -11,7 +11,7 @@
"access_account_analytic_account_salesman","account_analytic_account salesman","analytic.model_account_analytic_account","group_sale_user",1,1,1,1
"access_stock_picking_salesman","stock_picking salesman","stock.model_stock_picking","group_sale_user",1,1,1,1
"access_stock_move_salesman","stock_move salesman","stock.model_stock_move","group_sale_user",1,1,1,0
"access_mrp_procurement_salesman","mrp.procurement salesman","mrp_procurement.model_mrp_procurement","group_sale_user",1,1,1,1
"access_procurement_salesman","procurement.order salesman","procurement.model_procurement_order","group_sale_user",1,1,1,1
"access_sale_order_stock_worker","sale.order stock worker","model_sale_order","stock.group_stock_user",1,1,0,0
"access_sale_order_line_stock_worker","sale.order.line stock worker","model_sale_order_line","stock.group_stock_user",1,1,0,0
"access_sale_order_manager","sale.order.manager","model_sale_order","group_sale_manager",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
11 access_account_analytic_account_salesman account_analytic_account salesman analytic.model_account_analytic_account group_sale_user 1 1 1 1
12 access_stock_picking_salesman stock_picking salesman stock.model_stock_picking group_sale_user 1 1 1 1
13 access_stock_move_salesman stock_move salesman stock.model_stock_move group_sale_user 1 1 1 0
14 access_mrp_procurement_salesman access_procurement_salesman mrp.procurement salesman procurement.order salesman mrp_procurement.model_mrp_procurement procurement.model_procurement_order group_sale_user 1 1 1 1
15 access_sale_order_stock_worker sale.order stock worker model_sale_order stock.group_stock_user 1 1 0 0
16 access_sale_order_line_stock_worker sale.order.line stock worker model_sale_order_line stock.group_stock_user 1 1 0 0
17 access_sale_order_manager sale.order.manager model_sale_order group_sale_manager 1 1 1 1
+8 -4
View File
@@ -3,6 +3,8 @@
products with different supply method and procurement method.
-
I create two products.
-
I create one product Table.
-
!record {model: product.product, id: product_product_table0}:
categ_id: product.cat1
@@ -12,6 +14,8 @@
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create another product Wood.
-
!record {model: product.product, id: product_product_wood0}:
categ_id: product.cat1
@@ -68,21 +72,21 @@
-
I check that one procurement is generated.
-
!python {model: mrp.procurement}: |
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
-
I check that the procurement for the product table is in exception state.
As my product's supply method is produce and mrp module is yet not installed.
-
!python {model: mrp.procurement}: |
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','exception')])
assert proc_ids, _('No Procurements are in exception state!')
@@ -211,7 +211,7 @@
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define LG Viewty Smart product template.
I define New Chocolate Slider Mobile template.
-
!record {model: product.template, id: product_template_newchocolateslidermobile0}:
categ_id: product_category_allproductssellable0
@@ -226,7 +226,7 @@
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define LG Viewty Smart product.
I define New Chocolate Slider Mobile.
-
!record {model: product.product, id: product_product_newchocolateslidermobile0}:
categ_id: product_category_allproductssellable0
+341
View File
@@ -0,0 +1,341 @@
-
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
-
I am going to sell my Mobile products to the customer with name Cleartrail
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!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
-
I create Payable Account.
-
!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
-
I create Receivable Account.
-
!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
-
I create Cash Account.
-
!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
-
I create Purchases Account.
-
!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
-
I create Sales Account.
-
!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
-
I create Purchase Journal.
-
!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
-
I create Sale Journal.
-
!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
-
I create Bank Journal.
-
!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
-
I create ir.property for account payable.
-
!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
-
I create ir.property for account receivable.
-
!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
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create contact address for Cleartrail.
-
!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
-
I create invoice address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
I create delivery address for Cleartrail.
-
!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 requirement regarding the stockable products.
-
I define product category Mobile Products Sellable.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define LG Viewty Smart product template.
-
!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
-
I define LG Viewty Smart product.
-
!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
-
I define New Chocolate Slider Mobile template.
-
!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
-
I define New Chocolate Slider Mobile.
-
!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
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy manual.
-
!record {model: sale.order, id: sale_order_so4}:
date_order: '2010-05-12'
invoice_quantity: order
name: Test_SO004
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
- 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: 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
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so4}
-
I create an invoice on sale order.
-
!record {model: sale.make.invoice, id: sale_make_invoice_1}:
{}
-
Invoice is created for specific sale order.
-
!python {model: sale.make.invoice}: |
self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], {"lang": 'en_US', "search_default_user_id":
1, "tz": False, "active_model": 'sale.order', "active_ids": [ref("sale_order_so4")], "active_id":
ref("sale_order_so4"), })
-
I verify that invoice regarding sale order has been created.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so4"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
+342
View File
@@ -0,0 +1,342 @@
-
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
-
I am going to sell my Mobile products to the customer with name Cleartrail
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!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
-
I create Payable Account.
-
!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
-
I create Receivable Account.
-
!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
-
I create Cash Account.
-
!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
-
I create Purchases Account.
-
!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
-
I create Sales Account.
-
!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
-
I create Purchase Journal.
-
!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
-
I create Sale Journal.
-
!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
-
I create Bank Journal.
-
!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
-
I create ir.property for account payable.
-
!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
-
I create ir.property for account receivable.
-
!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
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create contact address for Cleartrail.
-
!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
-
I create invoice address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
I create delivery address for Cleartrail.
-
!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 requirement regarding the stockable products.
-
I define product category Mobile Products Sellable.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define LG Viewty Smart product template.
-
!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
-
I define LG Viewty Smart product.
-
!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
-
I define New Chocolate Slider Mobile template.
-
!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
-
I define New Chocolate Slider Mobile.
-
!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
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy manual.
-
!record {model: sale.order, id: sale_order_so3}:
date_order: '2010-05-12'
invoice_quantity: order
name: Test_SO003
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
- 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: 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
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so3}
-
I create an invoice on sale order line.
-
!record {model: sale.order.line.make.invoice, id: sale_order_line_make_invoice_0}:
{}
-
invoice is created for specific sale order line.
-
!python {model: sale.order.line.make.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
sol = so.order_line[0]
self.make_invoices(cr, uid, [ref("sale_order_line_make_invoice_0")], {"lang":
'en_US', "active_model": "sale.order.line", "active_ids": [ref(sol.id)], "tz":
False, "active_id": ref(sol.id), })
-
I verify that invoice regarding sale order line has been created.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so3"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
+24
View File
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import sale_mrp
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+44
View File
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Sales and MRP Management',
'version': '1.0',
'category': 'Generic Modules/Sales & MRP',
'description': """
This module provides facility to the user to install mrp and sale modules
at a time. It is basically used when we want to keep track of production
orders generated from sale orders.
""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['mrp', 'sale'],
'init_xml': [],
'update_xml': [
'sale_mrp_view.xml',
],
'demo_xml': [],
'installable': True,
'active': False,
'certificate': '',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Some files were not shown because too many files have changed in this diff Show More