parent
f26cd1dbeb
commit
9f90bf5b85
|
@ -782,7 +782,7 @@ class account_move_line(osv.osv):
|
|||
context['journal_id'] = vals['journal_id']
|
||||
if 'period_id' in vals and 'period_id' not in context:
|
||||
context['period_id'] = vals['period_id']
|
||||
if 'journal_id' not in context and 'move_id' in vals:
|
||||
if ('journal_id' not in context) and ('move_id' in vals) and vals['move_id']:
|
||||
m = self.pool.get('account.move').browse(cr, uid, vals['move_id'])
|
||||
context['journal_id'] = m.journal_id.id
|
||||
context['period_id'] = m.period_id.id
|
||||
|
|
|
@ -837,7 +837,7 @@ class account_invoice(osv.osv):
|
|||
'ref':invoice.number,
|
||||
}
|
||||
|
||||
name = invoice.invoice_line[0].name
|
||||
name = invoice.invoice_line and invoice.invoice_line[0].name or invoice.number
|
||||
l1['name'] = name
|
||||
l2['name'] = name
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<field name="model">payment.type</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Payment type">
|
||||
<form string="Payment Type">
|
||||
<field name="name" select="1"/>
|
||||
<field name="code"/>
|
||||
<newline/>
|
||||
|
@ -57,7 +57,7 @@
|
|||
<field name="model">payment.mode</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Payment mode">
|
||||
<tree string="Payment Mode">
|
||||
<field name="name"/>
|
||||
<field name="journal"/>
|
||||
</tree>
|
||||
|
@ -68,7 +68,7 @@
|
|||
<field name="model">payment.mode</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Payment mode">
|
||||
<form string="Payment Mode">
|
||||
<field name="name" select="1"/>
|
||||
<field name="type"/>
|
||||
<field name="journal"/>
|
||||
|
@ -77,7 +77,7 @@
|
|||
</field>
|
||||
</record>
|
||||
<record id="action_payment_mode_form" model="ir.actions.act_window">
|
||||
<field name="name">Payment mode</field>
|
||||
<field name="name">Payment Mode</field>
|
||||
<field name="res_model">payment.mode</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
|
|
|
@ -84,11 +84,27 @@ hr_timesheet_group()
|
|||
class hr_employee_category(osv.osv):
|
||||
_name = "hr.employee.category"
|
||||
_description = "Employee Category"
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char("Category", size=64, required=True),
|
||||
'parent_id': fields.many2one('hr.employee.category', 'Parent category', select=True),
|
||||
'child_ids': fields.one2many('hr.employee.category', 'parent_id', 'Childs Categories')
|
||||
}
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
level = 100
|
||||
while len(ids):
|
||||
cr.execute('select distinct parent_id from hr_employee_category where id in ('+','.join(map(str,ids))+')')
|
||||
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
|
||||
if not level:
|
||||
return False
|
||||
level -= 1
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_recursion, 'Error ! You cannot create recursive Categories.', ['parent_id'])
|
||||
]
|
||||
|
||||
hr_employee_category()
|
||||
|
||||
class hr_employee(osv.osv):
|
||||
|
@ -123,6 +139,20 @@ class hr_employee(osv.osv):
|
|||
'active' : lambda *a: True,
|
||||
}
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
level = 100
|
||||
while len(ids):
|
||||
cr.execute('select distinct parent_id from hr_employee where id in ('+','.join(map(str,ids))+')')
|
||||
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
|
||||
if not level:
|
||||
return False
|
||||
level -= 1
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_recursion, 'Error ! You cannot create recursive Hierarchy of Employees.', ['parent_id'])
|
||||
]
|
||||
|
||||
hr_employee()
|
||||
|
||||
class hr_timesheet(osv.osv):
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<field name="account_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="amount_unit"/>
|
||||
<field name="note"/>
|
||||
<!-- <field name="note"/>-->
|
||||
</tree>
|
||||
</field>
|
||||
<field name="state" select="1"/>
|
||||
|
|
Loading…
Reference in New Issue