commit
23fc0d6f5a
|
@ -844,7 +844,7 @@ class account_move(osv.osv):
|
|||
|
||||
if line.account_id.currency_id:
|
||||
if line.account_id.currency_id.id != line.currency_id.id and (line.account_id.currency_id.id != line.account_id.company_id.currency_id.id or line.currency_id):
|
||||
raise osv.except_osv(_('Error'), _('Couldn\'t create move with currency different than the secondary currency of the account'))
|
||||
raise osv.except_osv(_('Error'), _('Couldn\'t create move with currency different than the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.' % (line.account_id.code, line.account_id.name)))
|
||||
|
||||
if abs(amount) < 0.0001:
|
||||
if not len(line_draft_ids):
|
||||
|
@ -1851,9 +1851,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
obj_journal = self.pool.get('account.journal')
|
||||
obj_acc_template = self.pool.get('account.account.template')
|
||||
|
||||
if obj_multi.code_digits<=5:
|
||||
raise osv.except_osv(_('User Error'), _('Account code should be of more than 5 digits.'))
|
||||
|
||||
# Creating Account
|
||||
obj_acc_root = obj_multi.chart_template_id.account_root_id
|
||||
tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id
|
||||
|
@ -1936,7 +1933,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
'name': (obj_acc_root.id == account_template.id) and obj_multi.company_id.name or account_template.name,
|
||||
#'sign': account_template.sign,
|
||||
'currency_id': account_template.currency_id and account_template.currency_id.id or False,
|
||||
'code': code_acc[:dig],
|
||||
'code': code_acc,
|
||||
'type': account_template.type,
|
||||
'user_type': account_template.user_type and account_template.user_type.id or False,
|
||||
'reconcile': account_template.reconcile,
|
||||
|
|
|
@ -35,11 +35,8 @@ from crm.report import report_businessopp
|
|||
from report.interface import report_int
|
||||
from reportlab.graphics.shapes import Drawing
|
||||
from reportlab.graphics.charts.barcharts import VerticalBarChart
|
||||
import reportlab.lib.colors as colors
|
||||
#from reportlab.graphics.widgetbase import Widget, TypedPropertyCollection
|
||||
#from reportlab.graphics.charts.textlabels import BarChartLabel
|
||||
import reportlab.lib.colors
|
||||
#from reportlab.graphics import renderPM
|
||||
import tools
|
||||
|
||||
class accounting_report1(report_sxw.rml_parse):
|
||||
|
||||
|
@ -49,88 +46,34 @@ class accounting_report1(report_sxw.rml_parse):
|
|||
self.localcontext.update({
|
||||
'time': time,
|
||||
'test': self.test1,
|
||||
'lines':self.lines,
|
||||
# 'childs':self.process
|
||||
})
|
||||
self.count=0
|
||||
self.list=[]
|
||||
|
||||
def lines(self,data):
|
||||
res={}
|
||||
result=[]
|
||||
obj_inds=self.pool.get('account.report.report').browse(self.cr,self.uid,data['indicator_id'])
|
||||
def find_child(obj):
|
||||
self.list.append(obj)
|
||||
if obj.child_ids:
|
||||
for child in obj.child_ids:
|
||||
find_child(child)
|
||||
return True
|
||||
find_child(obj_inds)
|
||||
|
||||
for obj_ind in self.list:
|
||||
res = {
|
||||
'id':obj_ind.id,
|
||||
'name':obj_ind.name,
|
||||
'code':obj_ind.code,
|
||||
'expression':obj_ind.expression,
|
||||
'disp_graph':obj_ind.disp_graph,
|
||||
'note':obj_ind.note,
|
||||
'type':obj_ind.type
|
||||
}
|
||||
result.append(res)
|
||||
return result
|
||||
|
||||
def test1(self,data,object):
|
||||
path=tools.config['root_path']+"/Temp_report/Image"
|
||||
obj_history=self.pool.get('account.report.history')
|
||||
|
||||
if data['select_base']=='year':
|
||||
tuple_search=('fiscalyear_id','in',data['base_selection'][0][2])
|
||||
else:
|
||||
tuple_search=('period_id','in',data['base_selection'][0][2])
|
||||
|
||||
history_ids=obj_history.search(self.cr,self.uid,[('name','=',object['id']),tuple_search])
|
||||
obj_his=obj_history.browse(self.cr,self.uid,history_ids)
|
||||
|
||||
data_val=[]
|
||||
data_period=[]
|
||||
for item in obj_his:
|
||||
data_val.append(item.val)
|
||||
data_period.append(item.period_id.name)
|
||||
self.count +=1
|
||||
drawing = Drawing(400, 300)
|
||||
def test1(self):
|
||||
drawing = Drawing(400, 200)
|
||||
data = [
|
||||
tuple(data_val),
|
||||
(13, 5, 20, 22, 37, 45, 19, 4),
|
||||
(11, 3, 10, 22, 30, 25, 29, 6),
|
||||
]
|
||||
value_min=0.0
|
||||
vmin=min(data_val)
|
||||
vmax=max(data_val)
|
||||
|
||||
val_min=((vmin < 0.00 and vmin-2.00) or 0.00)
|
||||
# calculating maximum
|
||||
val_max=(vmax/(pow(10,len(str(int(vmax)))-2))+1)*pow(10,len(str(int(vmax)))-2)
|
||||
bc = VerticalBarChart()
|
||||
bc.x = 50
|
||||
bc.y = 50
|
||||
bc.height = 245
|
||||
bc.height = 125
|
||||
bc.width = 300
|
||||
bc.data = data
|
||||
value_step=(abs(val_max)-abs(val_min))/5
|
||||
|
||||
bc.strokeColor = colors.black
|
||||
bc.valueAxis.valueMin = val_min
|
||||
bc.valueAxis.valueMax = val_max
|
||||
bc.valueAxis.valueStep = value_step
|
||||
|
||||
bc.strokeColor = reportlab.lib.colors.black
|
||||
bc.valueAxis.valueMin = 0
|
||||
bc.valueAxis.valueMax = 50
|
||||
bc.valueAxis.valueStep = 10
|
||||
bc.categoryAxis.labels.boxAnchor = 'ne'
|
||||
bc.categoryAxis.labels.dx = 8
|
||||
|
||||
bc.categoryAxis.labels.dy = -2
|
||||
bc.categoryAxis.labels.angle = 30
|
||||
bc.categoryAxis.categoryNames = data_period
|
||||
bc.categoryAxis.categoryNames = ['Jan-99','Feb-99','Mar-99',
|
||||
'Apr-99','May-99','Jun-99','Jul-99','Aug-99']
|
||||
drawing.add(bc)
|
||||
drawing.save(formats=['png'],fnRoot=path+str(self.count),title="helo")
|
||||
# renderPM.drawToFile(drawing1, 'example1.jpg','jpg')
|
||||
return path+str(self.count)+'.png'
|
||||
# renderPM.drawToFile(drawing, 'example1.jpg','jpg')
|
||||
return True
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.print.indicators', 'account.report.history',
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<field name="active" select="1"/>
|
||||
<field name="carrier_id" select="1"/>
|
||||
<field name="sequence" select="1"/>
|
||||
<notebook>
|
||||
<notebook colspan="4">
|
||||
<page string="Grid definition">
|
||||
<field colspan="4" name="line_ids" nolabel="1" select="1"/>
|
||||
</page>
|
||||
|
|
|
@ -531,6 +531,7 @@ class product_packaging(osv.osv):
|
|||
_description = "Packaging"
|
||||
_rec_name = 'ean'
|
||||
_columns = {
|
||||
'sequence': fields.integer('Sequence'),
|
||||
'name' : fields.char('Description', size=64),
|
||||
'qty' : fields.float('Quantity by Package',
|
||||
help="The total number of products you can put by palet or box."),
|
||||
|
@ -559,6 +560,7 @@ class product_packaging(osv.osv):
|
|||
|
||||
_defaults = {
|
||||
'rows' : lambda *a : 3,
|
||||
'sequence' : lambda *a : 1,
|
||||
'ul' : _get_1st_ul,
|
||||
}
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@
|
|||
<field colspan="4" name="packaging" nolabel="1">
|
||||
<form string="Packaging">
|
||||
<field name="ean" select="1"/>
|
||||
<field name="sequence"/>
|
||||
<newline/>
|
||||
<field name="qty" select="1"/>
|
||||
<field name="ul"/>
|
||||
|
@ -322,6 +323,7 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Packaging">
|
||||
<field name="sequence"/>
|
||||
<field name="ean"/>
|
||||
<field name="qty"/>
|
||||
<field name="ul"/>
|
||||
|
@ -336,7 +338,9 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Packaging">
|
||||
<field name="product_id" select="1"/>
|
||||
<newline/>
|
||||
<field name="ean" select="1"/>
|
||||
<field name="sequence"/>
|
||||
<newline/>
|
||||
<field name="qty" select="1"/>
|
||||
<field name="ul"/>
|
||||
|
|
|
@ -451,7 +451,8 @@ class sale_order(osv.osv):
|
|||
def test_state(self, cr, uid, ids, mode, *args):
|
||||
assert mode in ('finished', 'canceled'), _("invalid mode for test_state")
|
||||
finished = True
|
||||
canceled = False
|
||||
canceled = False
|
||||
notcanceled = False
|
||||
write_done_ids = []
|
||||
write_cancel_ids = []
|
||||
for order in self.browse(cr, uid, ids, context={}):
|
||||
|
@ -460,6 +461,8 @@ class sale_order(osv.osv):
|
|||
finished = False
|
||||
if line.procurement_id and line.procurement_id.state == 'cancel':
|
||||
canceled = True
|
||||
if line.procurement_id and line.procurement_id.state <> 'cancel':
|
||||
notcanceled = True
|
||||
# if a line is finished (ie its procuremnt is done or it has not procuremernt and it
|
||||
# is not already marked as done, mark it as being so...
|
||||
if ((not line.procurement_id) or line.procurement_id.state == 'done') and line.state != 'done':
|
||||
|
@ -475,6 +478,8 @@ class sale_order(osv.osv):
|
|||
if mode=='finished':
|
||||
return finished
|
||||
elif mode=='canceled':
|
||||
if notcanceled:
|
||||
return False
|
||||
return canceled
|
||||
|
||||
def action_ship_create(self, cr, uid, ids, *args):
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
rml="sale/report/prepare_allot.rml"
|
||||
auto="False"/>
|
||||
-->
|
||||
<report auto="False" id="report_sale_order" model="sale.order" name="sale.order" rml="sale/report/order.rml" string="Print Order"/>
|
||||
|
||||
<report auto="False" id="report_sale_order" model="sale.order" name="sale.order" rml="sale/report/order.rml" string="Quotation / Order"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue