Skip to main content

Annexe

Par défaut le module installe un certain nombre de type de matière et d’unité de conversion avec des valeurs par défaut pour les formules de calcules :  

Exemple de formule de calcul : 

Tube rond :  

#nom   
result['name']="%s-%s-%s-%d*%d*%d" % ( 
wizard.mf_category_id.mf_code 

          ,wizard.mf_matiere_id.name 

          ,wizard.mf_finition_id.name 
          ,dimension['mf_diameter'] 
          ,dimension['mf_thickness'] 
          ,dimension['mf_length']) 
#Code 
result['code']="%s-%s-%s-%d*%d*%d" % ( 
wizard.mf_category_id.mf_code 
          ,wizard.mf_matiere_id.mf_code 
          ,wizard.mf_finition_id.mf_code 
          ,dimension['mf_diameter'] 
          ,dimension['mf_thickness'] 
          ,dimension['mf_length']) 

 
# calcul poids :  dimensions en mm et densité en kg/litre 
r1=dimension['mf_diameter']/2 
r2=dimension['mf_diameter']/2- dimension['mf_thickness'] 
L=dimension['mf_length'] 
pi=3.141592653589793 
section_mm2=(r1**2-r2**2) *pi 
result['net_weight']=wizard.mf_matiere_id.mf_densite*section_mm2*L /1000000 

result['picture']=wizard.mf_image

Tole
 

#nom  
result['name']="%s-%s-%s-%d*%d*%d" % ( 
wizard.mf_category_id.mf_code 

          ,wizard.mf_matiere_id.name 

          ,wizard.mf_finition_id.name 

          ,dimension['mf_length'] 

          ,dimension['mf_width'] 

          ,dimension['mf_thickness']) 

#Code 
result['code']="%s-%s-%s-%d*%d*%d" % ( 
wizard.mf_category_id.mf_code 

          ,wizard.mf_matiere_id.mf_code 

          ,wizard.mf_finition_id.mf_code 

          ,dimension['mf_length'] 

          ,dimension['mf_width'] 

          ,dimension['mf_thickness']) 

# calcul poids :  dimensions en mm et densité en kg/litre 
result['net_weight']=wizard.mf_matiere_id.mf_densite*dimension['mf_width']*dimension['mf_length']*dimension['mf_thickness']/1000000 


result['picture']=wizard.mf_image