[MERGE] merged trunk-dev-addon1
bzr revid: hmo@tinyerp.com-20101001151233-54w0ay8q5d1xy03i
This commit is contained in:
@@ -673,9 +673,10 @@ true, it will allow you to hide the event alarm information without removing it.
|
||||
new_res_alarm = res_alarm_obj.create(cr, uid, val, context=context)
|
||||
else:
|
||||
new_res_alarm = alarm_ids[0]
|
||||
cr.execute('Update %s set base_calendar_alarm_id=%s, alarm_id=%s \
|
||||
where id=%s' % (model_obj._table, \
|
||||
cal_alarm.id, new_res_alarm, data.id))
|
||||
cr.execute('UPDATE %s ' % model_obj._table + \
|
||||
' SET base_calendar_alarm_id=%s, alarm_id=%s ' \
|
||||
' WHERE id=%s',
|
||||
(cal_alarm.id, new_res_alarm, data.id))
|
||||
|
||||
self.do_alarm_unlink(cr, uid, [data.id], model)
|
||||
if basic_alarm:
|
||||
@@ -697,9 +698,10 @@ true, it will allow you to hide the event alarm information without removing it.
|
||||
'user_id': uid
|
||||
}
|
||||
alarm_id = alarm_obj.create(cr, uid, vals)
|
||||
cr.execute('Update %s set base_calendar_alarm_id=%s, alarm_id=%s \
|
||||
where id=%s' % (model_obj._table, \
|
||||
alarm_id, basic_alarm.id, data.id))
|
||||
cr.execute('UPDATE %s ' % model_obj._table + \
|
||||
' SET base_calendar_alarm_id=%s, alarm_id=%s '
|
||||
' WHERE id=%s', \
|
||||
( alarm_id, basic_alarm.id, data.id) )
|
||||
return True
|
||||
|
||||
def do_alarm_unlink(self, cr, uid, ids, model, context=None):
|
||||
@@ -722,7 +724,7 @@ true, it will allow you to hide the event alarm information without removing it.
|
||||
if alarm_ids:
|
||||
alarm_obj.unlink(cr, uid, alarm_ids)
|
||||
cr.execute('Update %s set base_calendar_alarm_id=NULL, alarm_id=NULL\
|
||||
where id=%s' % (model_obj._table, datas.id))
|
||||
where id=%%d' % model_obj._table,(datas.id,))
|
||||
return True
|
||||
|
||||
res_alarm()
|
||||
@@ -994,10 +996,10 @@ class calendar_event(osv.osv):
|
||||
context = {}
|
||||
cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\
|
||||
mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\
|
||||
day=0,select1='date',month_list=Null ,byday=Null where id=%s" % (self._table, id))
|
||||
day=0,select1='date',month_list=Null ,byday=Null where id=%%s" % (self._table), (id,))
|
||||
|
||||
if not value:
|
||||
cr.execute("UPDATE %s set rrule_type='none' where id=%s" % (self._table, id))
|
||||
cr.execute("UPDATE %s set rrule_type='none' where id=%%s" % self._table,(id,))
|
||||
return True
|
||||
val = {}
|
||||
for part in value.split(';'):
|
||||
@@ -1063,7 +1065,7 @@ class calendar_event(osv.osv):
|
||||
'rule_type': rrule_type,
|
||||
'id': id,
|
||||
})
|
||||
cr.execute(qry % val)
|
||||
cr.execute(qry, val) # Hopefully psycopg2 works with dicts. But, FIXME
|
||||
return True
|
||||
|
||||
def _get_rulestring(self, cr, uid, ids, name, arg, context=None):
|
||||
@@ -1081,7 +1083,7 @@ class calendar_event(osv.osv):
|
||||
if datas.get('rrule_type'):
|
||||
if datas.get('rrule_type') == 'none':
|
||||
result[event] = False
|
||||
cr.execute("UPDATE %s set exrule=Null where id=%s" % (self._table, event))
|
||||
cr.execute("UPDATE %s set exrule=Null where id=%%s" % self._table,( event,))
|
||||
elif datas.get('rrule_type') == 'custom':
|
||||
if datas.get('interval', 0) < 0:
|
||||
raise osv.except_osv('Warning!', 'Interval can not be Negative')
|
||||
@@ -1258,7 +1260,7 @@ true, it will allow you to hide the event alarm information without removing it.
|
||||
if defaults.get('location'):
|
||||
qry += ", location = '%(location)s'"
|
||||
qry += "WHERE id = %s" % (event_id)
|
||||
cr.execute(qry %(defaults))
|
||||
cr.execute(qry, defaults)
|
||||
|
||||
return True
|
||||
|
||||
@@ -1283,8 +1285,7 @@ true, it will allow you to hide the event alarm information without removing it.
|
||||
if ids and (base_start_date or base_until_date):
|
||||
cr.execute("select m.id, m.rrule, m.date, m.date_deadline, m.duration, \
|
||||
m.exdate, m.exrule, m.recurrent_id, m.recurrent_uid from " + self._table + \
|
||||
" m where m.id in ("\
|
||||
+ ','.join(map(lambda x: str(x), ids))+")")
|
||||
" m where m.id = ANY(%s)", (ids,) )
|
||||
|
||||
count = 0
|
||||
for data in cr.dictfetchall():
|
||||
@@ -1683,10 +1684,8 @@ class calendar_todo(osv.osv):
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
event = self.browse(cr, uid, id, context=context)
|
||||
cr.execute("UPDATE %s set date_start='%s' where id=%s" \
|
||||
% (self._table, value, id))
|
||||
return True
|
||||
assert name == 'date'
|
||||
return self.write(cr, uid, id, { 'date_start': value }, context=context)
|
||||
|
||||
_columns = {
|
||||
'date': fields.function(_get_date, method=True, fnct_inv=_set_date, \
|
||||
|
||||
@@ -159,8 +159,8 @@ send an Email to Invited Person')
|
||||
|
||||
if not partner_id:
|
||||
return {'value': {'contact_ids': []}}
|
||||
cr.execute('select id from res_partner_address \
|
||||
where partner_id=%s' % (partner_id))
|
||||
cr.execute('SELECT id FROM res_partner_address \
|
||||
WHERE partner_id=%s', (partner_id,))
|
||||
contacts = map(lambda x: x[0], cr.fetchall())
|
||||
return {'value': {'contact_ids': contacts}}
|
||||
|
||||
|
||||
@@ -61,10 +61,10 @@ def uid2openobjectid(cr, uidval, oomodel, rdate):
|
||||
model_obj = pooler.get_pool(cr.dbname).get(model)
|
||||
if (not model == oomodel) or (not dbname == cr.dbname):
|
||||
return (False, None)
|
||||
qry = 'select distinct(id) from %s' % model_obj._table
|
||||
qry = 'SELECT DISTINCT(id) FROM %s' % model_obj._table
|
||||
if rdate:
|
||||
qry += " where recurrent_id='%s'" % (rdate)
|
||||
cr.execute(qry)
|
||||
qry += " WHERE recurrent_id=%s"
|
||||
cr.execute(qry, (rdate,))
|
||||
r_id = cr.fetchone()
|
||||
if r_id:
|
||||
return (id, r_id[0])
|
||||
@@ -364,8 +364,8 @@ class CalDAV(object):
|
||||
model_obj = self.pool.get(model)
|
||||
r_ids = []
|
||||
if model_obj._columns.get('recurrent_uid', None):
|
||||
cr.execute('select id from %s where recurrent_uid=%s'
|
||||
% (model_obj._table, data[map_field]))
|
||||
cr.execute('SELECT id FROM %s WHERE recurrent_uid=%%s' % model_obj._table,
|
||||
(data[map_field],))
|
||||
r_ids = map(lambda x: x[0], cr.fetchall())
|
||||
if r_ids:
|
||||
r_datas = model_obj.read(cr, uid, r_ids, context=context)
|
||||
@@ -715,8 +715,9 @@ class basic_calendar_line(osv.osv):
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
cr.execute("Select count(id) from basic_calendar_lines \
|
||||
where name='%s' and calendar_id=%s" % (vals.get('name'), vals.get('calendar_id')))
|
||||
cr.execute("SELECT COUNT(id) FROM basic_calendar_lines \
|
||||
WHERE name='%s' AND calendar_id=%s",
|
||||
(vals.get('name'), vals.get('calendar_id')))
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
if res[0] > 0:
|
||||
@@ -797,8 +798,8 @@ class basic_calendar_fields(osv.osv):
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
cr.execute('select name from basic_calendar_attributes \
|
||||
where id=%s' % (vals.get('name')))
|
||||
cr.execute('SELECT name FROM basic_calendar_attributes \
|
||||
WHERE id=%s', (vals.get('name'),))
|
||||
name = cr.fetchone()
|
||||
name = name[0]
|
||||
if name in ('valarm', 'attendee'):
|
||||
|
||||
@@ -34,11 +34,11 @@ class calendar_collection(osv.osv):
|
||||
def _get_root_calendar_directory(self, cr, uid, context=None):
|
||||
objid = self.pool.get('ir.model.data')
|
||||
try:
|
||||
mid = objid._get_id(cr, uid, 'document', 'dir_calendars')
|
||||
mid = objid._get_id(cr, uid, 'document', 'dir_calendars')
|
||||
if not mid:
|
||||
return False
|
||||
root_id = objid.read(cr, uid, mid, ['res_id'])['res_id']
|
||||
root_cal_dir = self.browse(cr, uid, root_id, context=context)
|
||||
root_id = objid.read(cr, uid, mid, ['res_id'])['res_id']
|
||||
root_cal_dir = self.browse(cr,uid, root_id, context=context)
|
||||
return root_cal_dir.name
|
||||
except Exception, e:
|
||||
import netsvc
|
||||
@@ -67,7 +67,7 @@ class calendar_collection(osv.osv):
|
||||
], limit=1, context=context)
|
||||
|
||||
root_cal_dir = self._get_root_calendar_directory(cr, uid, context=context)
|
||||
if not calendar_ids:
|
||||
if not calendar_ids:
|
||||
return root_cal_dir
|
||||
calendar_id = calendar_ids[0]
|
||||
calendar = calendar_obj.browse(cr, uid, calendar_id,
|
||||
|
||||
+8
-26
@@ -232,14 +232,6 @@
|
||||
<field name="type">phantom</field>
|
||||
<field model="product.product" name="product_id" ref="product.product_product_20"/>
|
||||
</record>
|
||||
<record id="mrp_bom_8" model="mrp.bom">
|
||||
<field name="name">HDD Seagate</field>
|
||||
<field name="sequence">26</field>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="product_qty">1.0</field>
|
||||
<field name="type">normal</field>
|
||||
<field model="product.product" name="product_id" ref="product.product_product_hdd1"/>
|
||||
</record>
|
||||
<record id="mrp_bom_9" model="mrp.bom">
|
||||
<field name="name">Assembly Basic PC</field>
|
||||
<field name="sequence">29</field>
|
||||
@@ -563,6 +555,14 @@
|
||||
<!--
|
||||
Resource: mrp.bom new EVV
|
||||
-->
|
||||
<record id="mrp_bom_defaultbomforshelfofcm0" model="mrp.bom">
|
||||
<field name="name">Default BOM for Shelf of 100cm</field>
|
||||
<field name="code">SHE100</field>
|
||||
<field name="sequence">129</field>
|
||||
<field name="product_id" ref="product.product_product_shelfofcm0"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="product_qty">1.0</field>
|
||||
</record>
|
||||
|
||||
<record id="mrp_bom_assemblysection0" model="mrp.bom">
|
||||
<field name="name">Assembly Section</field>
|
||||
@@ -591,15 +591,6 @@
|
||||
<field model="mrp.bom" name="bom_id" search="[('name', '=', u'Default BOM for Shelf of 100cm')]"/>
|
||||
</record>
|
||||
|
||||
<record id="mrp_bom_defaultbomforshelfofcm0" model="mrp.bom">
|
||||
<field name="name">Default BOM for Shelf of 100cm</field>
|
||||
<field name="code">SHE100</field>
|
||||
<field name="sequence">129</field>
|
||||
<field name="product_id" ref="product.product_product_shelfofcm0"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="product_qty">1.0</field>
|
||||
</record>
|
||||
|
||||
<record id="mrp_bom_rearpanelarm0" model="mrp.bom">
|
||||
<field name="sequence">131</field>
|
||||
<field name="product_id" ref="product.product_product_rearpanelarm0"/>
|
||||
@@ -647,15 +638,6 @@
|
||||
<field name="type">phantom</field>
|
||||
</record>
|
||||
|
||||
<record id="mrp_bom_rearpanelarm1" model="mrp.bom">
|
||||
<field name="sequence">141</field>
|
||||
<field name="product_id" ref="product.product_product_rearpanelarm0"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="bom_id" ref="mrp_bom_defaultbomforshelfofcm0"/>
|
||||
<field name="product_qty">1.0</field>
|
||||
<field name="name">Rear panel SHE100</field>
|
||||
</record>
|
||||
|
||||
<record id="mrp_bom_assemblysection2" model="mrp.bom">
|
||||
<field name="name">Assembly Section</field>
|
||||
<field name="sequence">143</field>
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
from report.render import render
|
||||
from report.interface import report_int
|
||||
from pychart import *
|
||||
from mx.DateTime import *
|
||||
import time
|
||||
from datetime import datetime
|
||||
from datetime import date, datetime, timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from report.misc import choice_colors
|
||||
@@ -55,8 +54,8 @@ class report_custom(report_int):
|
||||
stop = start
|
||||
if time_unit == 'month':
|
||||
dates = {}
|
||||
a = Date(*map(int, start.split("-"))).year*12+Date(*map(int, start.split("-"))).month
|
||||
z = Date(*map(int, stop.split("-"))).year*12+Date(*map(int, stop.split("-"))).month+1
|
||||
a = int(start.split("-")[0])*12 + int(start.split("-")[1])
|
||||
z = int(stop.split("-")[0])*12 + int(stop.split("-")[1]) + 1
|
||||
for i in range(a,z):
|
||||
year = i/12
|
||||
month = i%12
|
||||
@@ -66,27 +65,31 @@ class report_custom(report_int):
|
||||
months = {1:"January",2:"February",3:"March",4:"April",5:"May",6:"June",7:"July",8:"August",9:"September",10:"October",11:"November",12:"December"}
|
||||
dates[i] = {
|
||||
'name' :months[month],
|
||||
'start':(datetime.date(year, month, 2) + relativedelta(day=1)).strftime('%Y-%m-%d'),
|
||||
'stop' :(datetime.date(year, month, 2) + relativedelta(day=-1)).strftime('%Y-%m-%d'),
|
||||
'start':(datetime(year, month, 2) + relativedelta(day=1)).strftime('%Y-%m-%d'),
|
||||
'stop' :(datetime(year, month, 2) + relativedelta(day=31)).strftime('%Y-%m-%d'),
|
||||
}
|
||||
return dates
|
||||
elif time_unit == 'week':
|
||||
dates = {}
|
||||
a = Date(*map(int, start.split("-"))).iso_week[0]*52+Date(*map(int, start.split("-"))).iso_week[1]
|
||||
z = Date(*map(int, stop.split("-"))).iso_week[0]*52+Date(*map(int, stop.split("-"))).iso_week[1]
|
||||
start_week = date(int(start.split("-")[0]),int(start.split("-")[1]),int(start.split("-")[2])).isocalendar()
|
||||
end_week = date(int(stop.split("-")[0]),int(stop.split("-")[1]),int(stop.split("-")[2])).isocalendar()
|
||||
a = int(start.split("-")[0])*52 + start_week[1]
|
||||
z = int(stop.split("-")[0])*52 + end_week[1]
|
||||
for i in range(a,z+1):
|
||||
year = i/52
|
||||
week = i%52
|
||||
d = date(year, 1, 1)
|
||||
|
||||
dates[i] = {
|
||||
'name' :"Week #%d" % week,
|
||||
'start':ISO.WeekTime(year, week, 1).strftime('%Y-%m-%d'),
|
||||
'stop' :ISO.WeekTime(year, week, 7).strftime('%Y-%m-%d'),
|
||||
'start':(d + timedelta(days=-d.weekday(), weeks=week)).strftime('%Y-%m-%d'),
|
||||
'stop' :(d + timedelta(days=6-d.weekday(), weeks=week)).strftime('%Y-%m-%d'),
|
||||
}
|
||||
return dates
|
||||
else: # time_unit = day
|
||||
dates = {}
|
||||
a = Date(*map(int, start.split("-")))
|
||||
z = Date(*map(int, stop.split("-")))
|
||||
a = datetime(int(start.split("-")[0]),int(start.split("-")[1]),int(start.split("-")[2]))
|
||||
z = datetime(int(stop.split("-")[0]),int(stop.split("-")[1]),int(stop.split("-")[2]))
|
||||
i = a
|
||||
while i <= z:
|
||||
dates[map(int,i.strftime('%Y%m%d').split())[0]] = {
|
||||
|
||||
@@ -21,10 +21,9 @@
|
||||
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
import datetime
|
||||
import netsvc
|
||||
import time
|
||||
from mx import DateTime
|
||||
from datetime import datetime
|
||||
from tools.translate import _
|
||||
|
||||
#----------------------------------------------------------
|
||||
@@ -75,7 +74,6 @@ class mrp_production_workcenter_line(osv.osv):
|
||||
for op in ops:
|
||||
res[op.id] = False
|
||||
if op.date_planned:
|
||||
d = DateTime.strptime(op.date_planned,'%Y-%m-%d %H:%M:%S')
|
||||
i = intervals[(op.date_planned, op.hour, op.workcenter_id.calendar_id.id)]
|
||||
if i:
|
||||
res[op.id] = i[-1][1].strftime('%Y-%m-%d %H:%M:%S')
|
||||
@@ -176,8 +174,8 @@ class mrp_production_workcenter_line(osv.osv):
|
||||
date_now = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
obj_line = self.browse(cr, uid, ids[0])
|
||||
|
||||
date_start = datetime.datetime.strptime(obj_line.date_start,'%Y-%m-%d %H:%M:%S')
|
||||
date_finished = datetime.datetime.strptime(date_now,'%Y-%m-%d %H:%M:%S')
|
||||
date_start = datetime.strptime(obj_line.date_start,'%Y-%m-%d %H:%M:%S')
|
||||
date_finished = datetime.strptime(date_now,'%Y-%m-%d %H:%M:%S')
|
||||
delay += (date_finished-date_start).days * 24
|
||||
delay += (date_finished-date_start).seconds / float(60*60)
|
||||
|
||||
@@ -259,9 +257,9 @@ class mrp_production(osv.osv):
|
||||
""" Computes planned and finished dates for work order.
|
||||
@return: Calculated date
|
||||
"""
|
||||
dt_end = DateTime.now()
|
||||
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')
|
||||
dt_end = datetime.strptime(po.date_planned, '%Y-%m-%d %H:%M:%S')
|
||||
if not po.date_start:
|
||||
self.write(cr, uid, [po.id], {
|
||||
'date_start': po.date_planned
|
||||
@@ -275,7 +273,7 @@ class mrp_production(osv.osv):
|
||||
del context['__last_update']
|
||||
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')
|
||||
'date_planned': dt.strftime('%Y-%m-%d %H:%M:%S')
|
||||
}, context=context, update=False)
|
||||
i = self.pool.get('resource.calendar').interval_get(
|
||||
cr,
|
||||
@@ -287,7 +285,7 @@ class mrp_production(osv.osv):
|
||||
if i:
|
||||
dt_end = max(dt_end, i[-1][1])
|
||||
else:
|
||||
dt_end = DateTime.strptime(wc.date_planned_end, '%Y-%m-%d %H:%M:%S')
|
||||
dt_end = datetime.strptime(wc.date_planned_end, '%Y-%m-%d %H:%M:%S')
|
||||
old = wc.sequence or 0
|
||||
super(mrp_production, self).write(cr, uid, [po.id], {
|
||||
'date_finnished': dt_end
|
||||
@@ -302,7 +300,7 @@ class mrp_production(osv.osv):
|
||||
if po.allow_reorder:
|
||||
continue
|
||||
todo = po.move_lines
|
||||
dt = DateTime.strptime(po.date_start,'%Y-%m-%d %H:%M:%S')
|
||||
dt = datetime.strptime(po.date_start,'%Y-%m-%d %H:%M:%S')
|
||||
while todo:
|
||||
l = todo.pop(0)
|
||||
if l.state in ('done','cancel','draft'):
|
||||
@@ -426,8 +424,8 @@ class mrp_operations_operation(osv.osv):
|
||||
if not i: continue
|
||||
if code_lst[i-1] not in ('resume','start'):
|
||||
continue
|
||||
a = datetime.datetime.strptime(time_lst[i-1],'%Y-%m-%d %H:%M:%S')
|
||||
b = datetime.datetime.strptime(time_lst[i],'%Y-%m-%d %H:%M:%S')
|
||||
a = datetime.strptime(time_lst[i-1],'%Y-%m-%d %H:%M:%S')
|
||||
b = datetime.strptime(time_lst[i],'%Y-%m-%d %H:%M:%S')
|
||||
diff += (b-a).days * 24
|
||||
diff += (b-a).seconds / float(60*60)
|
||||
return diff
|
||||
@@ -513,7 +511,7 @@ class mrp_operations_operation(osv.osv):
|
||||
if code.start_stop=='done':
|
||||
self.pool.get('mrp.production.workcenter.line').action_done(cr,uid,wc_op_id)
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', wc_op_id[0], 'button_done', cr)
|
||||
self.pool.get('mrp.production').write(cr,uid,vals['production_id'],{'date_finnished':DateTime.now().strftime('%Y-%m-%d %H:%M:%S')})
|
||||
self.pool.get('mrp.production').write(cr,uid,vals['production_id'],{'date_finnished':datetime.now().strftime('%Y-%m-%d %H:%M:%S')})
|
||||
|
||||
if code.start_stop=='pause':
|
||||
self.pool.get('mrp.production.workcenter.line').action_pause(cr,uid,wc_op_id)
|
||||
@@ -551,7 +549,7 @@ class mrp_operations_operation(osv.osv):
|
||||
'order_date': fields.function(_get_order_date,method=True,string='Order Date',type='date',store={'mrp.production':(_order_date_search_production,['date_planned'], 10)}),
|
||||
}
|
||||
_defaults={
|
||||
'date_start': lambda *a:DateTime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
'date_start': lambda *a:datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
}
|
||||
|
||||
mrp_operations_operation()
|
||||
|
||||
@@ -67,12 +67,11 @@ Main features :
|
||||
'report/report_pos_order_view.xml',
|
||||
'report/report_cash_register_view.xml',
|
||||
'pos_sequence.xml',
|
||||
'pos_data.xml',
|
||||
'pos_workflow.xml',
|
||||
'statement_view.xml',
|
||||
'statement_report.xml',
|
||||
],
|
||||
'demo_xml': ['pos_demo.xml','singer_statement_demo.xml','multi_company_stock_data.xml',],
|
||||
'demo_xml': ['pos_demo.xml','singer_statement_demo.xml'],
|
||||
'test':['test/pos_test.yml',
|
||||
'test/pos_report.yml',
|
||||
],
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
</data>
|
||||
</openerp>
|
||||
+19
-50
@@ -25,8 +25,6 @@ from osv import fields, osv
|
||||
from mx import DateTime
|
||||
from tools.translate import _
|
||||
from decimal import Decimal
|
||||
import tools
|
||||
import re
|
||||
import decimal_precision as dp
|
||||
|
||||
class pos_config_journal(osv.osv):
|
||||
@@ -114,18 +112,18 @@ class pos_order(osv.osv):
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
pay_obj = self.pool.get('account.bank.statement')
|
||||
stat_obj_line = self.pool.get('account.bank.statement.line')
|
||||
tot =0.0
|
||||
val=None
|
||||
for order in self.browse(cr, uid, ids):
|
||||
cr.execute("select date_payment from pos_order where id=%d"%(order.id))
|
||||
cr.execute("SELECT date_payment FROM pos_order WHERE id=%s", (order.id,))
|
||||
date_p=cr.fetchone()
|
||||
date_p=date_p and date_p[0] or None
|
||||
if date_p:
|
||||
res[order.id]=date_p
|
||||
return res
|
||||
cr.execute(" SELECT max(l.date) from account_move_line l, account_move m, account_invoice i, account_move_reconcile r, pos_order o where i.move_id=m.id and l.move_id=m.id and l.reconcile_id=r.id and o.id=%d and o.invoice_id=i.id"%(order.id))
|
||||
cr.execute(" SELECT max(l.date) "
|
||||
" FROM account_move_line l, account_move m, account_invoice i, account_move_reconcile r, pos_order o "
|
||||
" WHERE i.move_id=m.id AND l.move_id=m.id AND l.reconcile_id=r.id AND o.id=%s AND o.invoice_id=i.id",
|
||||
(order.id,))
|
||||
val=cr.fetchone()
|
||||
val= val and val[0] or None
|
||||
if val:
|
||||
@@ -138,11 +136,9 @@ class pos_order(osv.osv):
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
pay_obj = self.pool.get('pos.payment')
|
||||
tot =0.0
|
||||
val=None
|
||||
for order in self.browse(cr, uid, ids):
|
||||
cr.execute("select date_validation from pos_order where id=%d"%(order.id))
|
||||
cr.execute("SELECT date_validation FROM pos_order WHERE id=%s", (order.id,))
|
||||
date_p=cr.fetchone()
|
||||
date_p=date_p and date_p[0] or None
|
||||
if date_p:
|
||||
@@ -153,7 +149,7 @@ class pos_order(osv.osv):
|
||||
if line.discount > discount_allowed:
|
||||
return {order.id: None }
|
||||
if order.amount_paid == order.amount_total and not date_p:
|
||||
cr.execute("select max(date) from account_bank_statement_line where pos_statement_id=%d"%(order.id))
|
||||
cr.execute("SELECT MAX(date) FROM account_bank_statement_line WHERE pos_statement_id=%s", (order.id,))
|
||||
val=cr.fetchone()
|
||||
val=val and val[0] or None
|
||||
if order.invoice_id and order.invoice_id.move_id and not date_p and not val:
|
||||
@@ -215,7 +211,6 @@ class pos_order(osv.osv):
|
||||
""" To get Shop for this order"
|
||||
@return: Shop id """
|
||||
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
|
||||
res = self.pool.get('sale.shop').search(cr, uid, [])
|
||||
if res:
|
||||
return res[0]
|
||||
@@ -242,23 +237,21 @@ class pos_order(osv.osv):
|
||||
""" Changed the Validation state of order
|
||||
@return: State """
|
||||
|
||||
flag=False
|
||||
res_company = self.pool.get('res.company')
|
||||
res_obj = self.pool.get('res.users')
|
||||
company_disc=self.browse(cr,uid,ids)
|
||||
if not company_disc:
|
||||
comp=res_obj.browse(cr,uid,uid).company_id.company_discount or 0.0
|
||||
else:
|
||||
comp= company_disc[0] and company_disc[0].company_id and company_disc[0].company_id.company_discount or 0.0
|
||||
cr.execute("select discount from pos_order_line where order_id=%s and discount <= %s"%(ids[0],comp))
|
||||
cr.execute("select discount from pos_order_line where order_id=%s and discount <= %s", (ids[0],comp))
|
||||
res=cr.fetchone()
|
||||
cr.execute("select discount from pos_order_line where order_id=%s and discount > %s"%(ids[0],comp))
|
||||
cr.execute("select discount from pos_order_line where order_id=%s and discount > %s", (ids[0],comp))
|
||||
res2=cr.fetchone()
|
||||
cr.execute("select journal_id from account_bank_statement_line where pos_statement_id=%s "%(ids[0]))
|
||||
cr.execute("select journal_id from account_bank_statement_line where pos_statement_id=%s ", (ids[0],))
|
||||
res3=cr.fetchall()
|
||||
list_jrnl=[]
|
||||
for r in res3:
|
||||
cr.execute("select id from account_journal where name= '%s' and special_journal='t'"%(r[0]))
|
||||
cr.execute("select id from account_journal where name= '%s' and special_journal='t'", (r[0],))
|
||||
res3=cr.fetchone()
|
||||
is_special=res3 and res3[0] or None
|
||||
if is_special:
|
||||
@@ -489,7 +482,7 @@ class pos_order(osv.osv):
|
||||
continue
|
||||
prop_ids = property_obj.search(cr, uid, [('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid, prop_ids[0]).value_reference
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order.shop_id.warehouse_id.id))
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id=%s", (order.shop_id.warehouse_id.id,))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = val.id
|
||||
@@ -540,7 +533,7 @@ class pos_order(osv.osv):
|
||||
res_obj = self.pool.get('res.company')
|
||||
try:
|
||||
part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!'))
|
||||
if part_company:
|
||||
raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!'))
|
||||
@@ -559,12 +552,10 @@ class pos_order(osv.osv):
|
||||
|
||||
"""Create a new payment for the order"""
|
||||
|
||||
res_obj = self.pool.get('res.company')
|
||||
statement_obj= self.pool.get('account.bank.statement')
|
||||
statementl_obj = self.pool.get('account.bank.statement.line')
|
||||
prod_obj = self.pool.get('product.product')
|
||||
property_obj=self.pool.get('ir.property')
|
||||
flag=''
|
||||
curr_c=self.pool.get('res.users').browse(cr, uid, uid).company_id
|
||||
curr_company=curr_c.id
|
||||
order = self.browse(cr, uid, order_id, context)
|
||||
@@ -600,7 +591,7 @@ class pos_order(osv.osv):
|
||||
args['statement_id']= statement_id
|
||||
args['pos_statement_id']= order_id
|
||||
args['journal_id']= data['journal']
|
||||
statement_line_id = statementl_obj.create(cr, uid, args)
|
||||
statementl_obj.create(cr, uid, args)
|
||||
ids_new.append(statement_id)
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
@@ -661,14 +652,12 @@ class pos_order(osv.osv):
|
||||
def action_invoice(self, cr, uid, ids, context=None):
|
||||
"""Create a invoice of order """
|
||||
|
||||
res_obj = self.pool.get('res.company')
|
||||
inv_ref = self.pool.get('account.invoice')
|
||||
inv_line_ref = self.pool.get('account.invoice.line')
|
||||
product_obj= self.pool.get('product.product')
|
||||
inv_ids = []
|
||||
|
||||
for order in self.pool.get('pos.order').browse(cr, uid, ids, context):
|
||||
curr_c = order.user_salesman_id.company_id
|
||||
if order.invoice_id:
|
||||
inv_ids.append(order.invoice_id.id)
|
||||
continue
|
||||
@@ -894,21 +883,12 @@ class pos_order(osv.osv):
|
||||
raise osv.except_osv(_('Error !'),
|
||||
_('There is no receivable account defined for this journal:'\
|
||||
' "%s" (id:%d)') % (order.sale_journal.name, order.sale_journal.id, ))
|
||||
am=0.0
|
||||
for payment in order.statement_ids:
|
||||
am+=payment.amount
|
||||
|
||||
if am > 0:
|
||||
payment_account = \
|
||||
payment.statement_id.journal_id.default_debit_account_id.id
|
||||
else:
|
||||
payment_account = \
|
||||
payment.statement_id.journal_id.default_credit_account_id.id
|
||||
|
||||
# Create one entry for the payment
|
||||
if payment.is_acc:
|
||||
continue
|
||||
payment_move_id = account_move_obj.create(cr, uid, {
|
||||
account_move_obj.create(cr, uid, {
|
||||
'journal_id': payment.statement_id.journal_id.id,
|
||||
'period_id': period,
|
||||
}, context=context)
|
||||
@@ -1022,7 +1002,7 @@ class pos_order_line(osv.osv):
|
||||
def _amount_line_ttc(self, cr, uid, ids, field_name, arg, context):
|
||||
res = dict.fromkeys(ids, 0.0)
|
||||
account_tax_obj = self.pool.get('account.tax')
|
||||
prices = self.price_by_product_multi(cr, uid, ids)
|
||||
self.price_by_product_multi(cr, uid, ids)
|
||||
for line in self.browse(cr, uid, ids):
|
||||
tax_amount = 0.0
|
||||
taxes = [t for t in line.product_id.taxes_id]
|
||||
@@ -1031,7 +1011,6 @@ class pos_order_line(osv.osv):
|
||||
computed_taxes = account_tax_obj.compute_all(cr, uid, taxes, line.price_unit, line.qty)['taxes']
|
||||
for tax in computed_taxes:
|
||||
tax_amount += tax['amount']
|
||||
price = prices[line.id]
|
||||
if line.discount!=0.0:
|
||||
res[line.id] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0)
|
||||
else:
|
||||
@@ -1042,9 +1021,8 @@ class pos_order_line(osv.osv):
|
||||
def _amount_line(self, cr, uid, ids, field_name, arg, context):
|
||||
res = {}
|
||||
|
||||
prices = self.price_by_product_multi(cr, uid, ids)
|
||||
self.price_by_product_multi(cr, uid, ids)
|
||||
for line in self.browse(cr, uid, ids):
|
||||
price = prices[line.id]
|
||||
if line.discount!=0.0:
|
||||
res[line.id] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0)
|
||||
else:
|
||||
@@ -1056,11 +1034,10 @@ class pos_order_line(osv.osv):
|
||||
|
||||
account_tax_obj = self.pool.get('account.tax')
|
||||
|
||||
prices = self.price_by_product_multi(cr, uid, ids)
|
||||
self.price_by_product_multi(cr, uid, ids)
|
||||
for line in self.browse(cr, uid, ids):
|
||||
for f in field_names:
|
||||
if f == 'price_subtotal':
|
||||
price = prices[line.id]
|
||||
if line.discount != 0.0:
|
||||
res[line.id][f] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0)
|
||||
else:
|
||||
@@ -1073,7 +1050,6 @@ class pos_order_line(osv.osv):
|
||||
computed_taxes = account_tax_obj.compute_all(cr, uid, taxes, line.price_unit, line.qty)['taxes']
|
||||
for tax in computed_taxes:
|
||||
tax_amount += tax['amount']
|
||||
price = prices[line.id]
|
||||
if line.discount!=0.0:
|
||||
res[line.id][f] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0)
|
||||
else:
|
||||
@@ -1097,8 +1073,6 @@ class pos_order_line(osv.osv):
|
||||
for line in lines:
|
||||
pricelist = line.order_id.pricelist_id.id
|
||||
product_id = line.product_id
|
||||
qty = line.qty or 0
|
||||
partner_id = line.order_id.partner_id.id or False
|
||||
|
||||
if not product_id:
|
||||
res[line.id] = 0.0
|
||||
@@ -1108,8 +1082,6 @@ class pos_order_line(osv.osv):
|
||||
_('You have to select a pricelist in the sale form !\n' \
|
||||
'Please set one before choosing a product.'))
|
||||
|
||||
uom_id = product_id.uom_po_id.id
|
||||
|
||||
#old_price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], product_id.id, qty or 1.0, partner_id, {'uom': uom_id})[pricelist]
|
||||
#print "prod_id: %s, pricelist: %s, price: %s" % (product_id.id, pricelist, price)
|
||||
price = price_get_multi_res[line.product_id.id][pricelist]
|
||||
@@ -1170,9 +1142,7 @@ class pos_order_line(osv.osv):
|
||||
return {'value': {'price_subtotal_incl':sub_total_discount}}
|
||||
|
||||
def onchange_ded(self, cr, uid,ids, val_ded,price_u,*a):
|
||||
pos_order = self.pool.get('pos.order.line')
|
||||
res_obj = self.pool.get('res.users')
|
||||
res_company = self.pool.get('res.company')
|
||||
comp = res_obj.browse(cr,uid,uid).company_id.company_discount or 0.0
|
||||
val=0.0
|
||||
if val_ded and price_u:
|
||||
@@ -1184,7 +1154,6 @@ class pos_order_line(osv.osv):
|
||||
def onchange_discount(self, cr, uid,ids, discount,price,*a):
|
||||
pos_order = self.pool.get('pos.order.line')
|
||||
res_obj = self.pool.get('res.users')
|
||||
res_company = self.pool.get('res.company')
|
||||
company_disc = pos_order.browse(cr,uid,ids)
|
||||
if discount:
|
||||
if not company_disc:
|
||||
@@ -1282,7 +1251,7 @@ class pos_order_line(osv.osv):
|
||||
}
|
||||
line_id = self.write(cr, uid, order_line_id, vals)
|
||||
if not line_id:
|
||||
raise wizard.except_wizard(_('Error'), _('Modify line failed !'))
|
||||
raise osv.except_osv(_('Error'), _('Modify line failed !'))
|
||||
line_id = order_line_id
|
||||
|
||||
price_line = float(qty)*float(price)
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -169,20 +169,6 @@
|
||||
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_pos_order_tobinvoiced">
|
||||
<field name="name">Uninvoiced Sales</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pos.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_pos_order_tree"/>
|
||||
<field name="domain">[('state','not in', ('invoiced','done')),('invoice_id','=',False)]</field>
|
||||
<field name="context">{"search_default_user_id":uid}</field>
|
||||
<field name="search_view_id" ref="view_pos_order_filter"/>
|
||||
|
||||
</record>
|
||||
<menuitem name="Invoicing" id="menu_point_of_sale_invoicing" parent="menu_point_root" sequence="5" />
|
||||
<menuitem name="Uninvoiced Sales" action="action_pos_order_tobinvoiced" id="menu_point_of_sale_tobinvoiced" parent="menu_point_of_sale_invoicing"/>
|
||||
<record model="ir.actions.act_window" id="action_pos_order_accepted">
|
||||
<field name="name">Accepted Sales</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
</openerp>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -28,7 +28,7 @@ class pos_details(report_sxw.rml_parse):
|
||||
def _get_invoice(self,inv_id,user):
|
||||
res={}
|
||||
if inv_id:
|
||||
self.cr.execute("select name from account_invoice as ac where id = %d" %(inv_id))
|
||||
self.cr.execute("select name from account_invoice as ac where id = %s", (inv_id,))
|
||||
res = self.cr.fetchone()
|
||||
return res[0]
|
||||
else:
|
||||
@@ -107,14 +107,8 @@ class pos_details(report_sxw.rml_parse):
|
||||
objects,
|
||||
0.0)
|
||||
|
||||
def _get_payments(self, form,user, ignore_gift=False):
|
||||
def _get_payments(self, form,user):
|
||||
statement_line_obj = self.pool.get("account.bank.statement.line")
|
||||
gift_journal_id = None
|
||||
if ignore_gift:
|
||||
config_journal_ids = self.pool.get("pos.config.journal").search(self.cr, self.uid, [('code', '=', 'GIFT')])
|
||||
if len(config_journal_ids):
|
||||
config_journal = self.pool.get("pos.config.journal").browse(self.cr, self.uid, config_journal_ids, {})[0]
|
||||
gift_journal_id = config_journal.journal_id.id
|
||||
pos_ids=self.pool.get("pos.order").search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','=',self.uid)])
|
||||
data={}
|
||||
if pos_ids:
|
||||
@@ -162,7 +156,6 @@ class pos_details(report_sxw.rml_parse):
|
||||
res = {}
|
||||
temp={}
|
||||
list_ids = []
|
||||
c=[]
|
||||
temp2 = 0.0
|
||||
pos_ids=self.pool.get("pos.order").search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','=',self.uid)])
|
||||
temp.update({'name':''})
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"access_pos_payment","pos.payment","model_pos_payment","group_pos_user",1,1,1,1
|
||||
"access_report_transaction_pos","report.transaction.pos","model_report_transaction_pos","group_pos_manager",1,1,1,1
|
||||
"access_pos_config_journal_manager","pos.config.journal.manager","model_pos_config_journal","group_pos_manager",1,1,1,1
|
||||
"access_account_journal_pos_manager","account.journal pos_manager","account.model_account_journal","group_pos_manager",1,0,0,0
|
||||
"access_account_journal_pos_manager","account.journal pos_manager","account.model_account_journal","group_pos_manager",1,1,1,0
|
||||
"access_account_journal_pos_user","account.journal pos_user","account.model_account_journal","group_pos_user",1,0,0,0
|
||||
"access_account_move_pos_user","account.move pos_user","account.model_account_move","group_pos_user",1,0,0,0
|
||||
"access_account_account_pos_user","account.account pos_user","account.model_account_account","group_pos_user",1,0,0,0
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<field name="code">VIJ</field>
|
||||
<field name="type">cash</field>
|
||||
<field name="view_id" ref="account.account_journal_view"/>
|
||||
<field name="sequence_id" ref="account.sequence_sale_journal"/>
|
||||
<field name="sequence_id" ref="account.sequence_journal"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="account.a_sale"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
@@ -18,7 +18,7 @@
|
||||
<field name="code">CAJ</field>
|
||||
<field name="type">cash</field>
|
||||
<field name="view_id" ref="account.account_journal_view"/>
|
||||
<field name="sequence_id" ref="account.sequence_sale_journal"/>
|
||||
<field name="sequence_id" ref="account.sequence_journal"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="account.a_sale"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
@@ -30,7 +30,7 @@
|
||||
<field name="code">BACJ</field>
|
||||
<field name="type">cash</field>
|
||||
<field name="view_id" ref="account.account_journal_view"/>
|
||||
<field name="sequence_id" ref="account.sequence_sale_journal"/>
|
||||
<field name="sequence_id" ref="account.sequence_journal"/>
|
||||
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
|
||||
<field model="account.account" name="default_debit_account_id" ref="account.a_sale"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -67,6 +67,15 @@
|
||||
(data, format) = netsvc.LocalService('report.pos.details').create(cr, uid, [], {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d') }}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale- pos details report'+format), 'wb+').write(data)
|
||||
-
|
||||
I create a cash journal.
|
||||
-
|
||||
!record {model: account.journal, id: account_journal_cash0}:
|
||||
name: 'Cash Journal'
|
||||
code: 'CSJ'
|
||||
type: 'cash'
|
||||
view_id: account.account_journal_bank_view
|
||||
sequence_id: account.sequence_journal
|
||||
-
|
||||
I create a record for Bank Statement.
|
||||
-
|
||||
@@ -74,7 +83,7 @@
|
||||
name: St.05/19
|
||||
balance_end_real: 0.0
|
||||
date: '2010-05-19'
|
||||
journal_id: account.bank_journal
|
||||
journal_id: account_journal_cash0
|
||||
period_id: account.period_5
|
||||
state: 'draft'
|
||||
-
|
||||
|
||||
@@ -36,7 +36,7 @@ def get_journal(self, cr, uid, context):
|
||||
|
||||
obj = self.pool.get('account.journal')
|
||||
statement_obj = self.pool.get('account.bank.statement')
|
||||
cr.execute("""select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id"""%(uid))
|
||||
cr.execute("SELECT DISTINCT journal_id from pos_journal_users where user_id=%s order by journal_id", (uid,))
|
||||
j_ids = map(lambda x1: x1[0], cr.fetchall())
|
||||
ids = obj.search(cr, uid, [('type', '=', 'cash'), ('id', 'in', j_ids)])
|
||||
obj_ids= statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', 'in', ids)])
|
||||
@@ -129,7 +129,7 @@ class pos_box_entries(osv.osv_memory):
|
||||
if address_u:
|
||||
partner_id = address_u.partner_id and address_u.partner_id.id or None
|
||||
args['partner_id'] = partner_id
|
||||
statement_line_id = bank_statement.create(cr, uid, args)
|
||||
bank_statement.create(cr, uid, args)
|
||||
|
||||
return {}
|
||||
|
||||
|
||||
@@ -35,12 +35,11 @@ class pos_close_statement(osv.osv_memory):
|
||||
@param context: A standard dictionary
|
||||
@return : Blank Dictionary
|
||||
"""
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
|
||||
list_statement = []
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
statement_obj = self.pool.get('account.bank.statement')
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
cr.execute("""select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id"""%(uid))
|
||||
cr.execute("SELECT DISTINCT journal_id FROM pos_journal_users "
|
||||
"WHERE user_id=%s ORDER BY journal_id", (uid,))
|
||||
j_ids = map(lambda x1: x1[0], cr.fetchall())
|
||||
journal_ids = journal_obj.search(cr, uid, [('auto_cash', '=', True), ('type', '=', 'cash'), ('id', 'in', j_ids)])
|
||||
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', 'in', journal_ids)])
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
import time
|
||||
|
||||
class pos_open_statement(osv.osv_memory):
|
||||
_name = 'pos.open.statement'
|
||||
@@ -42,7 +41,8 @@ class pos_open_statement(osv.osv_memory):
|
||||
statement_obj = self.pool.get('account.bank.statement')
|
||||
sequence_obj = self.pool.get('ir.sequence')
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
cr.execute("""select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id"""%(uid))
|
||||
cr.execute("SELECT DISTINCT journal_id FROM pos_journal_users "
|
||||
"WHERE user_id=%s ORDER BY journal_id"% (uid,))
|
||||
j_ids = map(lambda x1: x1[0], cr.fetchall())
|
||||
journal_ids = journal_obj.search(cr, uid, [('auto_cash', '=', True), ('type', '=', 'cash'), ('id', 'in', j_ids)])
|
||||
|
||||
@@ -50,32 +50,17 @@ class pos_open_statement(osv.osv_memory):
|
||||
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)])
|
||||
if len(ids):
|
||||
raise osv.except_osv(_('Message'), _('You can not open a Cashbox for "%s".\nPlease close its related Register.' %(journal.name)))
|
||||
|
||||
statement_ids = sorted(statement_obj.search(cr, uid, [('state', '=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)]))
|
||||
if statement_ids:
|
||||
res = []
|
||||
statement_ids.reverse()
|
||||
statement = statement_obj.browse(cr, uid, statement_ids[0])
|
||||
for end_bal in statement.ending_details_ids:
|
||||
dct = {
|
||||
'pieces': end_bal.pieces,
|
||||
'number': end_bal.number,
|
||||
}
|
||||
res.append((0, 0, dct))
|
||||
data['starting_details_ids'] = res
|
||||
else:
|
||||
data['starting_details_ids'] = statement_obj._get_cash_close_box_lines(cr, uid, [])
|
||||
|
||||
|
||||
number = ''
|
||||
if journal.sequence_id:
|
||||
number = sequence_obj.get_id(cr, uid, journal.sequence_id.id)
|
||||
else:
|
||||
number = sequence_obj.get(cr, uid, 'account.bank.statement')
|
||||
number = sequence_obj.get(cr, uid, 'account.cash.statement')
|
||||
|
||||
data.update({'journal_id': journal.id,
|
||||
'company_id': company_id,
|
||||
'user_id': uid,
|
||||
'state': 'open',
|
||||
'state': 'draft',
|
||||
'name': number })
|
||||
statement_id = statement_obj.create(cr, uid, data)
|
||||
statement_obj.button_open(cr, uid, [statement_id], context)
|
||||
|
||||
@@ -42,7 +42,8 @@ class pos_make_payment(osv.osv_memory):
|
||||
active_id = context and context.get('active_id',False)
|
||||
if active_id:
|
||||
j_obj = self.pool.get('account.journal')
|
||||
cr.execute("""select DISTINCT journal_id from pos_journal_users where user_id=%d order by journal_id"""%(uid))
|
||||
cr.execute("SELECT DISTINCT journal_id FROM pos_journal_users "
|
||||
"WHERE user_id=%d ORDER BY journal_id"% (uid,))
|
||||
j_ids = map(lambda x1: x1[0], cr.fetchall())
|
||||
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('id', 'in', j_ids)])
|
||||
|
||||
@@ -78,7 +79,7 @@ class pos_make_payment(osv.osv_memory):
|
||||
return res
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
res = super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
|
||||
super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
|
||||
active_id = context and context.get('active_id', False) or False
|
||||
if active_id:
|
||||
order = self.pool.get('pos.order').browse(cr, uid, active_id)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
"""
|
||||
|
||||
<!-- Select an Open Sale Order -->
|
||||
|
||||
<record id="view_pos_payment" model="ir.ui.view">
|
||||
@@ -12,30 +10,38 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Add payment :">
|
||||
<group colspan="4" width="600" height="220">
|
||||
<field name="journal"/>
|
||||
<field name="amount" />
|
||||
<field name="payment_date" />
|
||||
<!--field name="payment_name" /-->
|
||||
<field name="invoice_wanted" />
|
||||
<field name="num_sale" />
|
||||
<field name="is_acc"/>
|
||||
<group attrs="{'invisible':[('is_acc','=',False)]}" colspan="4" col="2">
|
||||
<field name="product_id" attrs="{'required':[('is_acc', '=', True)]}" domain="[('type','=','service')]"
|
||||
on_change="onchange_product_id(product_id, amount)"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('invoice_wanted','=',False)]}" colspan="4">
|
||||
<field name="partner_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
|
||||
<field name="pricelist_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<group col="2" colspan="2"/>
|
||||
<button icon='gtk-stop' special="cancel" string="Cancel" />
|
||||
<button name="check" string="Make Payment" colspan="1" type="object" icon="terp-dolar"/>
|
||||
</group>
|
||||
</group>
|
||||
<group colspan="8" col="8" width="660" height="230">
|
||||
<group colspan="4" col="4" width="150">
|
||||
<label align="0.0" string="The register must be opened to be able to execute a payment." colspan="2"/>
|
||||
<separator string="" orientation="vertical" rowspan="6"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<field name="journal"/>
|
||||
<field name="amount"/>
|
||||
<field name="payment_date"/>
|
||||
<!--field name="payment_name" /-->
|
||||
<field name="invoice_wanted"/>
|
||||
<field name="num_sale"/>
|
||||
<field name="is_acc"/>
|
||||
<group attrs="{'invisible':[('is_acc','=',False)]}" colspan="4" col="2">
|
||||
<field name="product_id" attrs="{'required':[('is_acc', '=', True)]}" domain="[('type','=','service')]" on_change="onchange_product_id(product_id, amount)"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('invoice_wanted','=',False)]}" colspan="4">
|
||||
<field name="partner_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
|
||||
<field name="pricelist_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator colspan="8"/>
|
||||
<group col="4" colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<group col="2" colspan="2"/>
|
||||
<group col="2" colspan="2">
|
||||
<button icon="gtk-stop" special="cancel" string="Cancel"/>
|
||||
<button name="check" string="Make Payment" colspan="1" type="object" icon="terp-dolar"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -123,9 +123,9 @@ class pos_return(osv.osv_memory):
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button icon='gtk-ok' name= "create_returns"
|
||||
string="Return goods and Exchange" type="object"/>
|
||||
string="Return with Echange" type="object"/>
|
||||
<button icon='gtk-ok' name="create_returns2"
|
||||
string="Return without Refund" type="object"/>
|
||||
string="Refund Without Exchange" type="object"/>
|
||||
</form>"""
|
||||
|
||||
result['arch'] = _moves_arch_lst
|
||||
@@ -162,6 +162,7 @@ class pos_return(osv.osv_memory):
|
||||
stock_move_obj = self.pool.get('stock.move')
|
||||
property_obj= self.pool.get("ir.property")
|
||||
uom_obj =self. pool.get('product.uom')
|
||||
statementl_obj = self.pool.get('account.bank.statement.line')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
#Todo :Need to clean the code
|
||||
if active_id:
|
||||
@@ -171,7 +172,9 @@ class pos_return(osv.osv_memory):
|
||||
for order_id in order_obj.browse(cr, uid, [active_id], context=context):
|
||||
prop_ids = property_obj.search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid, prop_ids[0]).value_reference
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
|
||||
"WHERE w.lot_stock_id=s.id AND w.id=%s ",
|
||||
(order_id.shop_id.warehouse_id.id,))
|
||||
res = cr.fetchone()
|
||||
location_id = res and res[0] or None
|
||||
stock_dest_id = val.id
|
||||
@@ -185,10 +188,13 @@ class pos_return(osv.osv_memory):
|
||||
'lines':[],
|
||||
'statement_ids':[],
|
||||
'picking_id':[]})
|
||||
account_def = property_obj.get(cr, uid, 'property_account_payable', 'res.partner', context=context)
|
||||
amount = 0.0
|
||||
for line in order_id.lines:
|
||||
if line.id:
|
||||
try:
|
||||
qty = data['return%s' %line.id]
|
||||
amount += qty * line.price_unit
|
||||
except :
|
||||
qty = line.qty
|
||||
stock_move_obj.create(cr, uid, {
|
||||
@@ -204,6 +210,15 @@ class pos_return(osv.osv_memory):
|
||||
'date_planned': date_cur
|
||||
})
|
||||
line_obj.copy(cr, uid, line.id, {'qty': -qty, 'order_id': new_order})
|
||||
statementl_obj.create(cr, uid, {
|
||||
'name': 'Refund %s'%order_id.name,
|
||||
'statement_id': order_id.statement_ids[0].statement_id.id,
|
||||
'pos_statement_id': new_order,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'account_id': order_id.partner_id and order_id.partner_id.property_account_payable \
|
||||
and order_id.partner_id.property_account_payable.id or account_def.id,
|
||||
'amount': -amount,
|
||||
})
|
||||
order_obj.write(cr,uid, [active_id,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)
|
||||
@@ -254,7 +269,9 @@ class add_product(osv.osv_memory):
|
||||
qty=data['quantity']
|
||||
prop_ids = property_obj.search(cr, uid, [('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid, prop_ids[0]).value_reference
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
|
||||
"WHERE w.lot_stock_id=s.id AND w.id=%s ",
|
||||
(order_id.shop_id.warehouse_id.id,))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = val.id
|
||||
@@ -316,7 +333,9 @@ class add_product(osv.osv_memory):
|
||||
for order_id in order_obj.browse(cr, uid, active_ids, context=context):
|
||||
prop_ids =property_obj.search(cr, uid, [('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid, prop_ids[0]).value_reference
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
|
||||
" WHERE w.lot_stock_id=s.id AND w.id=%s ",
|
||||
(order_id.shop_id.warehouse_id.id,))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = val.id
|
||||
@@ -331,13 +350,13 @@ class add_product(osv.osv_memory):
|
||||
'date':date_cur
|
||||
})
|
||||
for line in order_id.lines:
|
||||
key=('return%s') %line.id
|
||||
key= 'return%s' % line.id
|
||||
if line.id:
|
||||
if data.has_key(key):
|
||||
qty = data['return%s' %line.id]
|
||||
qty = data[key]
|
||||
lines_obj.write(cr,uid,[line.id], {
|
||||
'qty_rfd':(line.qty or 0.0) + data['return%s' %line.id],
|
||||
'qty':line.qty-(data['return%s' %line.id] or 0.0)
|
||||
'qty_rfd':(line.qty or 0.0) + data[key],
|
||||
'qty':line.qty-(data[key] or 0.0)
|
||||
})
|
||||
else:
|
||||
qty = line.qty
|
||||
@@ -349,7 +368,7 @@ class add_product(osv.osv_memory):
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'name':'%s (return)' % order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur
|
||||
})
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
<para style="terp_default_Centre_8">[[ picking.origin or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ (picking.address_id and picking.address_id.title) or '' ]] [[ (picking.address_id and and picking.address_id.name) or '' ]] </para>
|
||||
<para style="terp_default_Centre_8">[[ (picking.address_id and picking.address_id.title) or '' ]] [[ (picking.address_id and picking.address_id.name) or '' ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ formatLang(picking.min_date,date_time = True) ]]</para>
|
||||
|
||||
@@ -189,9 +189,9 @@ class survey_analysis(report_rml):
|
||||
|
||||
for ans in que.answer_choice_ids:
|
||||
rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
|
||||
cr.execute("select count(id) from survey_response_answer sra where sra.answer_id = %d" % ans.id)
|
||||
cr.execute("select count(id) from survey_response_answer sra where sra.answer_id = %s", (ans.id,))
|
||||
tot_res = cr.fetchone()[0]
|
||||
cr.execute("select count(id) ,sra.column_id from survey_response_answer sra where sra.answer_id = %d group by sra.column_id" % ans.id)
|
||||
cr.execute("select count(id) ,sra.column_id from survey_response_answer sra where sra.answer_id=%s group by sra.column_id", (ans.id,))
|
||||
calc_res = cr.dictfetchall()
|
||||
for mat_col in range(1, len(matrix_ans)):
|
||||
percantage = 0.0
|
||||
@@ -210,7 +210,7 @@ class survey_analysis(report_rml):
|
||||
rml += """</blockTable>"""
|
||||
|
||||
if que.is_comment_require:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %d and comment != ''"% que.id)
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''",(que.id,))
|
||||
tot_res = cr.fetchone()[0]
|
||||
rml += """<blockTable colWidths=" """+ str(500 - last_col) +"," + str(last_col) + """ " style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
|
||||
<td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
@@ -244,7 +244,7 @@ class survey_analysis(report_rml):
|
||||
|
||||
if que.is_comment_require:
|
||||
# if que.make_comment_field:
|
||||
# cr.execute("select count(id) from survey_response_line where question_id = %d and comment != ''"% que.id)
|
||||
# cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''", (que.id,))
|
||||
# tot_res = cr.fetchone()[0]
|
||||
# tot_avg = 0.00
|
||||
# if que.tot_resp:
|
||||
@@ -253,13 +253,13 @@ class survey_analysis(report_rml):
|
||||
# <td><para style="answer">""" + str(tot_avg) + """%</para></td>
|
||||
# <td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
# else:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %d and comment != ''"% que.id)
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''", (que.id,))
|
||||
tot_res = cr.fetchone()[0]
|
||||
rml += """<blockTable colWidths="450.0,50.0" style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
|
||||
<td><para style="answer_right">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
|
||||
elif que.type in['single_textbox']:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %d and single_text!=''" % que.id)
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %s and single_text!=''",(que.id,))
|
||||
rml += """<blockTable colWidths="400.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
@@ -270,7 +270,7 @@ class survey_analysis(report_rml):
|
||||
</blockTable>"""
|
||||
|
||||
elif que.type in['comment']:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %d and comment !=''" % que.id)
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %s and comment !=''", (que.id,))
|
||||
rml += """<blockTable colWidths="400.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
@@ -303,12 +303,12 @@ class survey_analysis(report_rml):
|
||||
rating_weight_sum = 0
|
||||
for mat_col in range(1, len(matrix_ans)):
|
||||
cr.execute("select count(sra.answer_id) from survey_response_line sr, survey_response_answer sra\
|
||||
where sr.id = sra.response_id and sra.answer_id = %d and sra.column_id ='%d'" % (ans.id,matrix_ans[mat_col][0]))
|
||||
where sr.id = sra.response_id and sra.answer_id = %s and sra.column_id ='%s'", (ans.id,matrix_ans[mat_col][0]))
|
||||
tot_res = cr.fetchone()[0]
|
||||
cr.execute("select count(sra.answer_id),sqc.rating_weight from survey_response_line sr, survey_response_answer sra ,\
|
||||
survey_question_column_heading sqc where sr.id = sra.response_id and \
|
||||
sqc.question_id = sr.question_id and sra.answer_id = %d and sqc.title ='%s'\
|
||||
group by sra.answer_id,sqc.rating_weight" % (ans.id,matrix_ans[mat_col][1]))
|
||||
sqc.question_id = sr.question_id and sra.answer_id = %s and sqc.title ='%s'\
|
||||
+ group by sra.answer_id,sqc.rating_weight", (ans.id,matrix_ans[mat_col][1]))
|
||||
col_weight = cr.fetchone()
|
||||
|
||||
if not col_weight:
|
||||
@@ -352,10 +352,10 @@ class survey_analysis(report_rml):
|
||||
rml += """<td><para style="response">""" + to_xml(tools.ustr(menu)) + """</para></td>"""
|
||||
rml += """<td><para style="response-bold">Answer Count</para></td></tr>"""
|
||||
cr.execute("select count(id), sra.answer_id from survey_response_answer sra \
|
||||
where sra.column_id='%s' group by sra.answer_id " % (column.id))
|
||||
where sra.column_id='%s' group by sra.answer_id ", (column.id,))
|
||||
res_count = cr.dictfetchall()
|
||||
cr.execute("select count(sra.id),sra.value_choice, sra.answer_id, sra.column_id from survey_response_answer sra \
|
||||
where sra.column_id='%s' group by sra.value_choice ,sra.answer_id, sra.column_id" % (column.id))
|
||||
where sra.column_id='%s' group by sra.value_choice ,sra.answer_id, sra.column_id", (column.id,))
|
||||
calc_percantage = cr.dictfetchall()
|
||||
|
||||
for ans in que.answer_choice_ids:
|
||||
@@ -393,7 +393,7 @@ class survey_analysis(report_rml):
|
||||
<td> <para style="response-bold">Answer Count</para></td>
|
||||
</tr>"""
|
||||
for ans in que.answer_choice_ids:
|
||||
cr.execute("select answer from survey_response_answer where answer_id=%d group by answer" % ans.id)
|
||||
cr.execute("select answer from survey_response_answer where answer_id=%s group by answer", (ans.id,))
|
||||
tot_res = cr.dictfetchall()
|
||||
total = 0
|
||||
for tot in tot_res:
|
||||
|
||||
@@ -108,7 +108,7 @@ class survey_question_wiz(osv.osv_memory):
|
||||
if sur_rec.state != "open" :
|
||||
raise osv.except_osv(_('Warning !'),_("You can not give answer because of survey is not open for answer"))
|
||||
cr.execute('select count(id) from survey_history where user_id=%s\
|
||||
and survey_id=%s' % (uid,survey_id))
|
||||
and survey_id=%s', (uid,survey_id))
|
||||
res = cr.fetchone()[0]
|
||||
user_limit = survey_obj.browse(cr, uid, survey_id)
|
||||
user_limit = user_limit.response_user
|
||||
@@ -401,12 +401,12 @@ class survey_question_wiz(osv.osv_memory):
|
||||
|
||||
address_id = user_obj.browse(cr, uid, uid).address_id.id
|
||||
if address_id:
|
||||
cr.execute("select email from res_partner_address where id =%d" % address_id)
|
||||
cr.execute("select email from res_partner_address where id =%s", (address_id,))
|
||||
user_email = cr.fetchone()[0]
|
||||
resp_id = survey_data.responsible_id.address_id
|
||||
|
||||
if resp_id:
|
||||
cr.execute("select email from res_partner_address where id =%d" % resp_id.id)
|
||||
cr.execute("select email from res_partner_address where id =%s", (resp_id.id,))
|
||||
resp_email = cr.fetchone()[0]
|
||||
if user_email and resp_email:
|
||||
user_name = user_obj.browse(cr, uid, uid).name
|
||||
|
||||
Reference in New Issue
Block a user