bzr revid: hmo@tinyerp.com-20100908110255-7ylclj5v8v06cbd1
This commit is contained in:
Harry (OpenERP) 2010-09-08 16:32:55 +05:30
commit 30a5d585fe
16 changed files with 109 additions and 115 deletions

View File

@ -467,9 +467,8 @@ class mrp_production(osv.osv):
'state': fields.selection([('draft','Draft'),('picking_except', 'Picking Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Cancelled'),('done','Done')],'State', readonly=True,
help='When the production order is created the state is set to \'Draft\'.\n If the order is confirmed the state is set to \'Waiting Goods\'.\n If any exceptions are there, the state is set to \'Picking Exception\'.\
\nIf the stock is available then the state is set to \'Ready to Produce\'.\n When the production gets started then the state is set to \'In Production\'.\n When the production is over, the state is set to \'Done\'.'),
'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'),
'hour_total': fields.function(_production_calc, method=True, type='float', string='Total Hours', multi='workorder', store=True),
'cycle_total': fields.function(_production_calc, method=True, type='float', string='Total Cycles', multi='workorder', store=True),
'company_id': fields.many2one('res.company','Company',required=True),
}
_defaults = {

View File

@ -615,7 +615,7 @@
<field name="location_dest_id" readonly="1" string="Destination Loc."/>
<field name="prodlot_id" />
<field name="state" invisible="1"/>
<field name="scraped" invisible="1"/>
<field name="scrapped" invisible="1"/>
<button
name="%(stock.track_line)d"
string="Split in production lots"
@ -664,7 +664,7 @@
<field name="product_uom" readonly="1" string="UOM"/>
<field name="location_dest_id" readonly="1" string="Destination Loc."/>
<field name="prodlot_id" />
<field name="scraped" invisible="1"/>
<field name="scrapped" invisible="1"/>
<button name="%(stock.track_line)d"
string="Split in production lots" type="action" icon="gtk-justify-fill" states="done,cancel"/>
<button name="%(stock.move_scrap)d"

View File

@ -96,7 +96,7 @@
stock of beers remains exact.
-
!assert {model: stock.picking, id: picking_out, string: pack_of_beer_splitted}:
- len(move_lines) == 2
- len(move_lines) >= 2
- move_lines[0].product_id.id <> move_lines[1].product_id.id
- move_lines[0].product_id.id in (ref('product_product_beers0'), ref('product_product_beerspack0'))
- move_lines[1].product_id.id in (ref('product_product_beers0'), ref('product_product_beerspack0'))

View File

@ -200,7 +200,7 @@
-
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','confirmed')])
proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_orange0'),ref('product_product_sugar0'),ref('product_product_water0')])])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.

View File

@ -5,113 +5,61 @@
-
I am creating one manufacturing order.
-
!record {model: mrp.production, id: mrp_production_mo0}:
bom_id: mrp.mrp_bom_9
routing_id: mrp.mrp_routing_0
!record {model: mrp.production, id: mrp_production_mo1}:
company_id: base.main_company
date_planned: '2010-05-06 14:55:52'
location_dest_id: stock.stock_location_stock
location_src_id: stock.stock_location_stock
name: MO/00004
product_id: product.product_product_pc1
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
-
I create a record for Workcenter line.
-
!record {model: mrp.production.workcenter.line, id: mrp_production_workcenter_line_assemblyline0}:
cycle: 5.0
hour: 10.0
name: Assembly Line 1
production_id: mrp_production_mo0
sequence: 0.0
workcenter_id: mrp.mrp_workcenter_0
-
I create second record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_regularprocessorconfig0}:
name: Regular processor config
product_id: product.product_product_cpu_gen
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
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
product_id: product.product_product_hdd1
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
I create fourth record for Workcenter line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_atxmidsizetower0}:
name: ATX Mid-size Tower
product_id: product.product_product_tow1
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
I create a record for production line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_mouse0}:
name: Mouse
product_id: product.product_product_25
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
I create second record for production line.
-
!record {model: mrp.production.product.line, id: mrp_production_product_line_keyboard0}:
name: Keyboard
product_id: product.product_product_24
product_qty: 5.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
production_id: mrp_production_mo0
-
I compute the data.
-
!python {model: mrp.production}: |
self.action_compute(cr, uid, [ref("mrp_production_mo1")], {"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"),
})
-
I confirm the order.
-
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1}
-
I am checking Procurement orders.
-
!python {model: procurement.order}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','confirmed')])
production_obj = self.pool.get('mrp.production')
production = production_obj.browse(cr, uid, ref('mrp_production_mo1'))
product_ids = map(lambda x:x.product_id.id, production.move_lines)
proc_ids = self.search(cr, uid, [('product_id','in',product_ids)])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: procurement.order, name: run_scheduler}:
- model: procurement.order
search: "[('state','=','confirmed')]"
search: "[]"
-
I am checking Internal picking.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
pick_ids = self.search(cr, uid, [('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
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 _
order_ids = self.search(cr, uid, [('state','=','confirmed')])
assert order_ids, _('No manufacturing order!')
order_ids = self.search(cr, uid, [('state','=','ready')])
assert order_ids, _('No manufacturing order in Ready state!')
-
I start producing that product first. So I marked it as started.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
-
I create record for producing products with quantity 5.00.
-
@ -124,19 +72,25 @@
!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})
self.do_produce(cr, uid, [ref('mrp_product_produce0')], context={'active_ids': prod_ids})
-
Now the manufacturing order for subproduct CPU_GEN is done and manufacturing
order for PC1 is in ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
prod_ids = self.search(cr, uid, [('state','!=','done')])
prod_ids = self.search(cr, uid, [('state','=','done')])
assert prod_ids, _('Manufacturing order is yet not done!')
-
I start producing the product PC1.
-
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
-
I create record for producing products with quantity 5.00.
-
!record {model: mrp.product.produce, id: mrp_product_produce1}:
product_qty: 5.00
mode: 'consume_produce'
-
Finally my production order is done.
-
@ -144,4 +98,4 @@
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids})

View File

@ -75,7 +75,7 @@ class mrp_production_workcenter_line(osv.osv):
_order = "sequence, date_planned"
_columns = {
'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'State', readonly=True,
'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Cancelled'),('done','Finished')],'State', readonly=True,
help="* When a work order is created it is set in 'Draft' state.\n" \
"* When user sets work order in start mode that time it will be set in 'In Progress' state.\n" \
"* When work order is in running mode, during that time if user wants to stop or to make changes in order then can set in 'Pause' state.\n" \
@ -93,7 +93,7 @@ class mrp_production_workcenter_line(osv.osv):
string='Production State', readonly=True),
'product':fields.related('production_id','product_id',type='many2one',relation='product.product',string='Product',
readonly=True),
'qty':fields.related('production_id','product_qty',type='float',string='Qty',readonly=True),
'qty':fields.related('production_id','product_qty',type='float',string='Qty',readonly=True, store=True),
'uom':fields.related('production_id','product_uom',type='many2one',relation='product.uom',string='UOM',readonly=True),
}
@ -263,7 +263,7 @@ class mrp_production(osv.osv):
dt = dt_end
if context.get('__last_update'):
del context['__last_update']
if (wc.date_planned<dt.strftime('%Y-%m-%d %H:%M:%S')) or mini:
if (wc.date_planned < dt.strftime('%Y-%m-%d %H:%M:%S')) or mini:
self.pool.get('mrp.production.workcenter.line').write(cr, uid, [wc.id], {
'date_planned':dt.strftime('%Y-%m-%d %H:%M:%S')
}, context=context, update=False)

View File

@ -60,12 +60,12 @@
<field name="cycle"/>
<field name="hour"/>
<field name="state" />
<button name="button_draft" string="Set Draft" states="cancel" icon="gtk-convert"/>
<button name="button_start_working" string="Start" states="draft" icon="gtk-go-forward"/>
<button name="button_resume" string="Resume" states="pause" icon="gtk-media-pause"/>
<button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-cancel"/>
<button name="button_pause" string="Pause" states="startworking" icon="gtk-media-pause"/>
<button name="button_done" string="Finished" states="startworking" icon="gtk-ok"/>
<button name="button_draft" string="Set Draft" states="cancel" icon="gtk-convert" help="Set to Draft"/>
<button name="button_start_working" string="Start" states="draft" icon="gtk-go-forward" help="Start Working"/>
<button name="button_resume" string="Resume" states="pause" icon="gtk-media-pause" help="Resume Work Order"/>
<button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-cancel" help="Cancel Order"/>
<button name="button_pause" string="Pause" states="startworking" icon="gtk-media-pause" help="Pause Work Order"/>
<button name="button_done" string="Finished" states="startworking" icon="gtk-ok" help="Finish Order"/>
</tree>
</field>
</record>

View File

@ -26,7 +26,38 @@ class sale_order(osv.osv):
_columns = {
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
}
def action_cancel(self, cr, uid, ids, context=None):
res = super(sale_order, self).action_cancel(cr, uid, ids, context=context)
case_pool = self.pool.get('crm.lead')
data_pool = self.pool.get('ir.model.data')
data = data_pool._get_id(cr, uid, 'crm', 'stage_lead6')
res_data = data_pool.read(cr, uid, data, ['res_id'])
lost_stage_id = False
if res_data and res_data.get('res_id'):
lost_stage_id = res_data.get('res_id', False)
if not lost_stage_id:
return res
# After sale cancel, lead also lost
for sale_id in ids:
lead_ids = case_pool.search(cr, uid, [('ref','=','sale.order,%s'%(sale_id))])
case_pool.write(cr, uid, lead_ids, {'stage_id': lost_stage_id})
return res
def action_ship_create(self, cr, uid, ids, *args):
res = super(sale_order, self).action_ship_create(cr, uid, ids, *args)
case_pool = self.pool.get('crm.lead')
data_pool = self.pool.get('ir.model.data')
data = data_pool._get_id(cr, uid, 'crm', 'stage_lead5')
res_data = data_pool.read(cr, uid, data, ['res_id'])
win_stage_id = False
if res_data and res_data.get('res_id'):
win_stage_id = res_data.get('res_id', False)
if not win_stage_id:
return res
# After sale confimed, lead also win
for sale_id in ids:
lead_ids = case_pool.search(cr, uid, [('ref','=','sale.order,%s'%(sale_id))])
case_pool.write(cr, uid, lead_ids, {'stage_id': win_stage_id})
return res
def _get_section(self, cr, uid, context=None):
return context.get('context_section_id', False)
@ -36,4 +67,4 @@ class sale_order(osv.osv):
sale_order()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -147,7 +147,9 @@ class crm_make_sale(osv.osv_memory):
value['discount']=line.discount
value['notes']=line.notes
sale_line_obj.create(cr, uid, value)
case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id})
stage_data = mod_obj._get_id(cr, uid, 'crm', 'stage_lead3')
stage_data = mod_obj.read(cr, uid, stage_data, ['res_id'])
case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id, 'stage_id': stage_data['res_id']})
new_ids.append(new_id)
message = _('Opportunity ') + " '" + case.name + "' "+ _("is converted to Sales Quotation.")
self.log(cr, uid, case.id, message)
@ -244,4 +246,4 @@ class sale_order_make_line(osv.osv_memory):
sale_order_make_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -171,7 +171,6 @@
Creating a stock.location record
-
!record {model: stock.location, id: stock_location_suppiler0}:
allocation_method: fifo
chained_auto_packing: auto
chained_delay: 15
chained_location_type: none
@ -212,7 +211,6 @@
-
!record {model: stock.location, id: stock_location_suppiler0}:
address_id: res_partner_address_0
allocation_method: fifo
chained_auto_packing: manual
chained_delay: 20
chained_location_type: none

View File

@ -3,7 +3,7 @@
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/address.dtd">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&title.label;" onload="myPrefObserver.createContactAddress()" height="480" width="764">
title="&title.label;" onload="myPrefObserver.createContactAddress();" height="480" width="764">
<script type="text/javascript" src="chrome://openerp_plugin/content/tiny_xmlrpc.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/config.js"></script>
@ -23,9 +23,10 @@
</hbox>
<hbox>
<label align="right" id="name" value="&name.value;" width="80" />
<textbox id="txtname" align="right" width="270" readonly="true"/>
<textbox id="txtselectpartner" align="right" width="270" readonly="true"/>
<spacer width="5"/>
<button label="New Partner" image="&imagecreate.value;" oncommand="CreatePartner.onMenuItemCommand(event);" width="133"/>
<button label="Search Partner" image="&imagesearch.value;" oncommand="Select.onMenuItemCommand(event);getPartnerList();" width="128"/>
</hbox>
<separator class="groove-thin" orient="horizontal" width="94"/>
</groupbox>

View File

@ -92,7 +92,7 @@ var myPrefObserver =
createContactAddress: function()
{
document.getElementById("txtname").value = getPartnerName();
document.getElementById("txtselectpartner").value = getPartnerName();
document.getElementById("txtcontactname").value = getSenderName();
document.getElementById("txtstreet").value = getStreet();
document.getElementById("txtstreet2").value = getStreet2();

View File

@ -177,6 +177,7 @@ function searchmail()
}
}
function open_contact()
{
setTimeout("createConnection()",5000)
@ -222,8 +223,8 @@ function open_contact()
}
//set the initial information for the selected email
setSenderEmail(senderemail);
setSenderName(sendername);
setSenderEmail(senderemail);
setSenderName(sendername);
setPartnerName("");
setStreet("");
setStreet2("");
@ -238,10 +239,10 @@ function open_contact()
alert("Please install the thunderbird module on your '" + getDbName() +"' database and try again !");
return false
}
window.open("chrome://openerp_plugin/content/address.xul", "", "chrome, resizable=yes");
}
//function to open the configuration window
var Config = {
onLoad: function() {
@ -286,7 +287,7 @@ var Address = {
onMenuItemCommand: function(){
open_contact();
searchContact();
searchContact();
}
};
@ -297,9 +298,10 @@ var Select = {
this.initialized=true;
},
onMenuItemCommand: function(){
window.open("chrome://openerp_plugin/content/selectpartner.xul", "", "chrome");
}
onMenuItemCommand: function(){
//document.getElementById("txtselectpartner").value="";
window.open("chrome://openerp_plugin/content/selectpartner.xul", "", "chrome");
}
};
var CreatePartner = {

View File

@ -985,8 +985,13 @@ var listSearchContactHandler = {
if(strlSearchResult=="email" && strlSearchResultValue!=''){
setSenderEmail(strlSearchResultValue);
var t = getSenderEmail();}
var t = getSenderEmail();
window.open("chrome://openerp_plugin/content/address.xul", "", "chrome, resizable=yes");}
if(strlSearchResult=="email" && strlSearchResultValue==''){
alert("Contact is not available.");
}
if(strlSearchResult=="res_id"){
setResourceId(strlSearchResultValue);
var t = getResourceId();}
@ -1014,11 +1019,11 @@ var listSearchContactdetailHandler = {
var strlSearchResultValue = strlResult.QueryElementAt(1, Components.interfaces.nsISupportsCString);
if(strlSearchResult=="email" && strlSearchResultValue=='')
{
alert("Contact is not Available")
alert("Contact is not Available.")
document.getElementById("txtemail").value = sendername;
}
if(strlSearchResult=="partner_name"){
document.getElementById("txtname").value =strlSearchResultValue;}
document.getElementById("txtselectpartner").value =strlSearchResultValue;}
if(strlSearchResult=="contactname"){
document.getElementById("txtcontactname").value =strlSearchResultValue;}
@ -1043,7 +1048,7 @@ var listSearchContactdetailHandler = {
document.getElementById("txtmobile").value =strlSearchResultValue;}
if(strlSearchResult=="email"&& strlSearchResultValue!=''){
document.getElementById("txtemail").value =strlSearchResultValue;}
document.getElementById("txtemail").value =strlSearchResultValue;}
if(strlSearchResult=="res_id"){
setResourceId(strlSearchResultValue);
@ -1080,7 +1085,7 @@ function searchContactdetail()
var strmethod = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strmethod.data = 'search_contact';
var strname = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strname.data =document.getElementById("txtemail").value;
strname.data = document.getElementById("txtemail").value;
xmlRpcClient.asyncCall(listSearchContactdetailHandler,cmbSearchList,'execute',[ strDbName,struid,strpass,strobj,strmethod,strname ],6);
}
@ -1259,7 +1264,7 @@ function searchContact()
var strmethod = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strmethod.data = 'search_contact';
var strname = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strname.data =getSenderEmail();
strname.data = getSenderEmail();
xmlRpcClient.asyncCall(listSearchContactHandler,cmbSearchList,'execute',[ strDbName,struid,strpass,strobj,strmethod,strname ],6);
}
@ -1335,6 +1340,8 @@ function getPartnerList(){
strvalue.data = document.getElementById('txtselectpartner').value;
xmlRpcClient.asyncCall(listPartnerHandler,cmdPartnerList,'execute',[ strDbName,struid,strpass,strobj,strmethod,strvalue ],6);
}
//function to create the xmlrpc supported variables for xmlrpc request
function dictcontact(a,b){
var temp = xmlRpcClient.createType(xmlRpcClient.ARRAY,{});
@ -1527,7 +1534,7 @@ function createContact(){
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strobj.data = 'thunderbird.partner';
var a = ['partner_id','name','street','street2','zip','city','country_id','state_id','phone','fax','mobile','email'];
var b = [getPartnerId(),getSenderName(),document.getElementById("txtstreet").value,document.getElementById("txtstreet2").value,document.getElementById("txtzip").value, document.getElementById("txtcity").value,document.getElementById("country").value,document.getElementById("state").value,document.getElementById("txtoffice").value,document.getElementById("txtfax").value,document.getElementById("txtmobile").value,document.getElementById("txtemail").value];
var b = [getPartnerId(),document.getElementById("txtname").value,document.getElementById("txtstreet").value,document.getElementById("txtstreet2").value,document.getElementById("txtzip").value, document.getElementById("txtcity").value,document.getElementById("country").value,document.getElementById("state").value,document.getElementById("txtoffice").value,document.getElementById("txtfax").value,document.getElementById("txtmobile").value,document.getElementById("txtemail").value];
var arrofarr = dictcontact(a,b);
xmlRpcClient.asyncCall(listCreateContactHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
}
@ -1548,7 +1555,7 @@ function UpdateContact(){
var strobj = xmlRpcClient.createType(xmlRpcClient.STRING,{});
strobj.data = 'thunderbird.partner';
var a = ['res_id','partner_id','name','street','street2','zip','city','country_id','state_id','phone','fax','mobile','email'];
var b = [getResourceId(),getPartnerName(),document.getElementById("txtcontactname").value,document.getElementById("txtstreet").value,document.getElementById("txtstreet2").value,document.getElementById("txtzip").value, document.getElementById("txtcity").value,document.getElementById("country").value,document.getElementById("state").value,document.getElementById("txtoffice").value,document.getElementById("txtfax").value,document.getElementById("txtmobile").value,document.getElementById("txtemail").value];
var b = [getResourceId(),document.getElementById("txtselectpartner").value,document.getElementById("txtcontactname").value,document.getElementById("txtstreet").value,document.getElementById("txtstreet2").value,document.getElementById("txtzip").value, document.getElementById("txtcity").value,document.getElementById("country").value,document.getElementById("state").value,document.getElementById("txtoffice").value,document.getElementById("txtfax").value,document.getElementById("txtmobile").value,document.getElementById("txtemail").value];
var arrofarr = dictcontact(a,b);
xmlRpcClient.asyncCall(listUpdateContactHandler,null,'execute',[strDbName,struids,strpass,strobj,strmethod,arrofarr],6);
}