@@ -1298,7 +1298,7 @@ class account_tax(osv.osv):
|
||||
res.append(tax)
|
||||
return res
|
||||
|
||||
def _unit_compute(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None):
|
||||
def _unit_compute(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None, quantity=0):
|
||||
taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product, partner)
|
||||
|
||||
res = []
|
||||
@@ -1327,7 +1327,12 @@ class account_tax(osv.osv):
|
||||
data['amount'] = amount
|
||||
|
||||
elif tax.type=='fixed':
|
||||
print "her", quantity
|
||||
print "data", data
|
||||
data['amount'] = tax.amount
|
||||
data['tax_amount']=quantity
|
||||
print "DATA 2", data
|
||||
# data['amount'] = quantity
|
||||
elif tax.type=='code':
|
||||
address = address_id and self.pool.get('res.partner.address').browse(cr, uid, address_id) or None
|
||||
localdict = {'price_unit':cur_price_unit, 'address':address, 'product':product, 'partner':partner}
|
||||
@@ -1343,7 +1348,7 @@ class account_tax(osv.osv):
|
||||
if tax.child_depend:
|
||||
latest = res.pop()
|
||||
amount = amount2
|
||||
child_tax = self._unit_compute(cr, uid, tax.child_ids, amount, address_id, product, partner)
|
||||
child_tax = self._unit_compute(cr, uid, tax.child_ids, amount, address_id, product, partner, quantity)
|
||||
res.extend(child_tax)
|
||||
if tax.child_depend:
|
||||
for r in res:
|
||||
@@ -1361,6 +1366,7 @@ class account_tax(osv.osv):
|
||||
latest[name+'_code_id'] = False
|
||||
if tax.include_base_amount:
|
||||
cur_price_unit+=amount2
|
||||
print "rress final", res
|
||||
return res
|
||||
|
||||
def compute(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None):
|
||||
@@ -1373,7 +1379,8 @@ class account_tax(osv.osv):
|
||||
tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2}
|
||||
one tax for each tax id in IDS and their childs
|
||||
"""
|
||||
res = self._unit_compute(cr, uid, taxes, price_unit, address_id, product, partner)
|
||||
res = self._unit_compute(cr, uid, taxes, price_unit, address_id, product, partner, quantity)
|
||||
print "res",res
|
||||
total = 0.0
|
||||
for r in res:
|
||||
if r.get('balance',False):
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<xsl:for-each select="report/employee">
|
||||
<xsl:variable name="id" select="attribute::id"/>
|
||||
<tr>
|
||||
<td t="1"><xsl:value-of select="attribute::name"/></td>
|
||||
<td><xsl:value-of select="attribute::name"/></td>
|
||||
<xsl:for-each select="//report/days/day">
|
||||
<xsl:variable name="today" select="attribute::number" />
|
||||
<td>
|
||||
|
||||
@@ -437,23 +437,21 @@ class hr_attendance(osv.osv):
|
||||
|
||||
def _sheet(self, cursor, user, ids, name, args, context):
|
||||
sheet_obj = self.pool.get('hr_timesheet_sheet.sheet')
|
||||
|
||||
cursor.execute('SELECT a.id, COALESCE(MAX(s.id), 0) \
|
||||
cursor.execute("SELECT a.id, COALESCE(MAX(s.id), 0) \
|
||||
FROM hr_timesheet_sheet_sheet s \
|
||||
LEFT JOIN (hr_attendance a \
|
||||
LEFT JOIN hr_employee e \
|
||||
ON (a.employee_id = e.id)) \
|
||||
ON (s.date_to >= a.name \
|
||||
AND s.date_from <= a.name \
|
||||
ON (s.date_to >= to_date(to_char(a.name, 'YYYY-MM-dd'),'YYYY-MM-dd') \
|
||||
AND s.date_from <= to_date(to_char(a.name, 'YYYY-MM-dd'),'YYYY-MM-dd') \
|
||||
AND s.user_id = e.user_id) \
|
||||
WHERE a.id in (' + ','.join([str(x) for x in ids]) + ') \
|
||||
GROUP BY a.id')
|
||||
WHERE a.id in (" + ",".join([str(x) for x in ids]) + ") \
|
||||
GROUP BY a.id")
|
||||
res = dict(cursor.fetchall())
|
||||
sheet_names = {}
|
||||
for sheet_id, name in sheet_obj.name_get(cursor, user, res.values(),
|
||||
context=context):
|
||||
sheet_names[sheet_id] = name
|
||||
|
||||
for line_id in {}.fromkeys(ids):
|
||||
sheet_id = res.get(line_id, False)
|
||||
if sheet_id:
|
||||
@@ -527,11 +525,11 @@ class hr_attendance(osv.osv):
|
||||
if 'sheet_id' in context:
|
||||
ts = self.pool.get('hr_timesheet_sheet.sheet').browse(cr, uid, context['sheet_id'])
|
||||
if ts.state not in ('draft', 'new'):
|
||||
raise osv.except_osv(_('Error !'), _('You can not modify an entry in a confirmed timesheet !'))
|
||||
raise osv.except_osv(_('Error !'), _('You cannot modify an entry in a confirmed timesheet !'))
|
||||
res = super(hr_attendance,self).create(cr, uid, vals, context=context)
|
||||
if 'sheet_id' in context:
|
||||
if context['sheet_id'] != self.browse(cr, uid, res, context=context).sheet_id.id:
|
||||
raise osv.except_osv(_('UserError'), _('You can not enter an attendance ' \
|
||||
raise osv.except_osv(_('UserError'), _('You cannot enter an attendance ' \
|
||||
'date outside the current timesheet dates!'))
|
||||
return res
|
||||
|
||||
@@ -545,14 +543,14 @@ class hr_attendance(osv.osv):
|
||||
if 'sheet_id' in context:
|
||||
for attendance in self.browse(cr, uid, ids, context=context):
|
||||
if context['sheet_id'] != attendance.sheet_id.id:
|
||||
raise osv.except_osv(_('UserError'), _('You can not enter an attendance ' \
|
||||
raise osv.except_osv(_('UserError'), _('You cannot enter an attendance ' \
|
||||
'date outside the current timesheet dates!'))
|
||||
return res
|
||||
|
||||
def _check(self, cr, uid, ids):
|
||||
for att in self.browse(cr, uid, ids):
|
||||
if att.sheet_id and att.sheet_id.state not in ('draft', 'new'):
|
||||
raise osv.except_osv(_('Error !'), _('You can not modify an entry in a confirmed timesheet !'))
|
||||
raise osv.except_osv(_('Error !'), _('You cannot modify an entry in a confirmed timesheet !'))
|
||||
return True
|
||||
|
||||
hr_attendance()
|
||||
|
||||
@@ -216,6 +216,7 @@
|
||||
<field name="res_model">project.project</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
<field name="view_id" ref="view_my_project"/>
|
||||
</record>
|
||||
<menuitem
|
||||
action="open_view_my_project_open"
|
||||
|
||||
Reference in New Issue
Block a user