[IMP] account, hr modules: Put lambda in _defaults

bzr revid: pso@tinyerp.com-20101104124242-djqmwoq9jzenr8cn
This commit is contained in:
pso 2010-11-04 18:12:42 +05:30
parent c29189bd87
commit 751166ef62
38 changed files with 61 additions and 61 deletions

View File

@ -1124,7 +1124,7 @@ class account_move(osv.osv):
'name': '/',
'state': 'draft',
'period_id': _get_period,
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
@ -2157,7 +2157,7 @@ class account_subscription(osv.osv):
'lines_id': fields.one2many('account.subscription.line', 'subscription_id', 'Subscription Lines')
}
_defaults = {
'date_start': time.strftime('%Y-%m-%d'),
'date_start': lambda *a: time.strftime('%Y-%m-%d'),
'period_type': 'month',
'period_total': 12,
'period_nbr': 1,

View File

@ -41,7 +41,7 @@ class account_analytic_line(osv.osv):
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
}
_order = 'date desc'

View File

@ -173,7 +173,7 @@ class account_bank_statement(osv.osv):
_defaults = {
'name': "/",
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'state': 'draft',
'balance_start': _default_balance_start,
'journal_id': _default_journal_id,
@ -473,7 +473,7 @@ class account_bank_statement_line(osv.osv):
}
_defaults = {
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'type': 'general',
}

View File

@ -233,7 +233,7 @@ class account_cash_statement(osv.osv):
}
_defaults = {
'state': 'draft',
'date': time.strftime("%Y-%m-%d %H:%M:%S"),
'date': lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
'user_id': lambda self, cr, uid, context=None: uid,
'starting_details_ids': _get_cash_open_box_lines,
'ending_details_ids': _get_default_cash_close_box_lines

View File

@ -488,7 +488,7 @@ class account_move_line(osv.osv):
'blocked': False,
'centralisation': 'normal',
'date': _get_date,
'date_created': time.strftime('%Y-%m-%d'),
'date_created': lambda *a: time.strftime('%Y-%m-%d'),
'state': 'draft',
'currency_id': _get_currency,
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),

View File

@ -86,8 +86,8 @@ class account_installer(osv.osv_memory):
return 'configurable'
_defaults = {
'date_start': time.strftime('%Y-01-01'),
'date_stop': time.strftime('%Y-12-31'),
'date_start': lambda *a: time.strftime('%Y-01-01'),
'date_stop': lambda *a: time.strftime('%Y-12-31'),
'period': 'month',
'sale_tax': 0.0,
'purchase_tax': 0.0,

View File

@ -33,8 +33,8 @@ class account_analytic_balance(osv.osv_memory):
}
_defaults = {
'date1':time.strftime('%Y-01-01'),
'date2':time.strftime('%Y-%m-%d')
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d')
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -33,8 +33,8 @@ class account_analytic_cost_ledger_journal_report(osv.osv_memory):
}
_defaults = {
'date1':time.strftime('%Y-01-01'),
'date2':time.strftime('%Y-%m-%d')
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d')
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -32,8 +32,8 @@ class account_analytic_cost_ledger(osv.osv_memory):
}
_defaults = {
'date1':time.strftime('%Y-01-01'),
'date2':time.strftime('%Y-%m-%d')
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d')
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -32,8 +32,8 @@ class account_analytic_inverted_balance(osv.osv_memory):
}
_defaults = {
'date1':time.strftime('%Y-01-01'),
'date2':time.strftime('%Y-%m-%d')
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d')
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -32,8 +32,8 @@ class account_analytic_Journal_report(osv.osv_memory):
}
_defaults = {
'date1':time.strftime('%Y-01-01'),
'date2':time.strftime('%Y-%m-%d')
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d')
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -49,8 +49,8 @@ class account_automatic_reconcile(osv.osv_memory):
return context.get('unreconciled', 0)
_defaults = {
'date1': time.strftime('%Y-01-01'),
'date2': time.strftime('%Y-%m-%d'),
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d'),
'reconciled': _get_reconciled,
'unreconciled': _get_unreconciled,
'power': 2

View File

@ -50,7 +50,7 @@ class account_invoice_refund(osv.osv_memory):
return journal and journal[0] or False
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'journal_id': _get_journal,
'filter_refund': 'modify',
}

View File

@ -119,7 +119,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
'analytic_id': fields.many2one('account.analytic.account', 'Analytic Account', domain=[('parent_id', '!=', False)]),
}
_defaults = {
'date_p': time.strftime('%Y-%m-%d'),
'date_p': lambda *a: time.strftime('%Y-%m-%d'),
'comment': 'Write-off',
}

View File

@ -40,7 +40,7 @@ class account_aged_trial_balance(osv.osv_memory):
}
_defaults = {
'period_length': 30,
'date_from': time.strftime('%Y-%m-%d'),
'date_from': lambda *a: time.strftime('%Y-%m-%d'),
'direction_selection': 'past',
}

View File

@ -35,8 +35,8 @@ class account_crossovered_analytic(osv.osv_memory):
'empty_line': fields.boolean('Dont show empty lines'),
}
_defaults = {
'date1': time.strftime('%Y-01-01'),
'date2': time.strftime('%Y-%m-%d'),
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d'),
}
def print_report(self, cr, uid, ids, context=None):

View File

@ -31,8 +31,8 @@ class account_budget_analytic(osv.osv_memory):
'date_to': fields.date('End of period', required=True),
}
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-%m-%d'),
'date_from': lambda *a: time.strftime('%Y-01-01'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'),
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -31,8 +31,8 @@ class account_budget_crossvered_report(osv.osv_memory):
'date_to': fields.date('End of period', required=True),
}
_defaults = {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-%m-%d'),
'date_from': lambda *a: time.strftime('%Y-01-01'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'),
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -33,8 +33,8 @@ class account_budget_crossvered_summary_report(osv.osv_memory):
'date_to': fields.date('End of period', required=True),
}
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-%m-%d'),
'date_from': lambda *a: time.strftime('%Y-01-01'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'),
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -32,8 +32,8 @@ class account_budget_report(osv.osv_memory):
'date_to': fields.date('End of period', required=True),
}
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-%m-%d'),
'date_from': lambda *a: time.strftime('%Y-01-01'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'),
}
def check_report(self, cr, uid, ids, context=None):

View File

@ -37,7 +37,7 @@ class account_coda(osv.osv):
'company_id': fields.many2one('res.company', 'Company', readonly=True)
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'user_id': lambda self,cr,uid,context: uid,
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.coda', context=c),
}

View File

@ -64,7 +64,7 @@ class account_followup_print(osv.osv_memory):
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'followup_id': _get_followup,
}
account_followup_print()

View File

@ -100,7 +100,7 @@ class payment_order(osv.osv):
'user_id': lambda self,cr,uid,context: uid,
'state': 'draft',
'date_prefered': 'due',
'date_created': time.strftime('%Y-%m-%d'),
'date_created': lambda *a: time.strftime('%Y-%m-%d'),
'reference': lambda self,cr,uid,context: self.pool.get('ir.sequence').get(cr, uid, 'payment.order'),
}

View File

@ -42,7 +42,7 @@ class payment_order_create(osv.osv_memory):
'entries': fields.many2many('account.move.line', 'line_pay_rel', 'pay_id', 'line_id', 'Entries')
}
_defaults = {
'duedate': time.strftime('%Y-%m-%d'),
'duedate': lambda *a: time.strftime('%Y-%m-%d'),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):

View File

@ -202,7 +202,7 @@ class account_voucher(osv.osv):
'state': 'draft',
'pay_now': 'pay_later',
'name': '',
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
'tax_id': _get_tax,
}

View File

@ -130,7 +130,7 @@ class account_statement_from_invoice(osv.osv_memory):
'line_ids': fields.many2many('account.move.line', 'account_move_line_relation', 'move_id', 'line_id', 'Invoices'),
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
}
def search_invoices(self, cr, uid, ids, context=None):

View File

@ -149,7 +149,7 @@ class account_analytic_account(osv.osv):
'user_id': lambda self, cr, uid, ctx: uid,
'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
'contact_id': lambda self, cr, uid, ctx: ctx.get('contact_id', False),
'date_start': time.strftime('%Y-%m-%d')
'date_start': lambda *a: time.strftime('%Y-%m-%d')
}
def check_recursion(self, cr, uid, ids, parent=None):
@ -212,7 +212,7 @@ class account_analytic_line(osv.osv):
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
'amount': 0.00
}

View File

@ -31,8 +31,8 @@ class hr_attendance_bymonth(osv.osv_memory):
'year': fields.integer('Year', required=True)
}
_defaults = {
'month': time.gmtime()[1],
'year': time.gmtime()[0],
'month': lambda *a: time.gmtime()[1],
'year': lambda *a: time.gmtime()[0],
}
def print_report(self, cr, uid, ids, context=None):

View File

@ -30,8 +30,8 @@ class hr_attendance_byweek(osv.osv_memory):
'end_date': fields.date('Ending Date', required=True)
}
_defaults = {
'init_date': time.strftime('%Y-%m-%d'),
'end_date': time.strftime('%Y-%m-%d'),
'init_date': lambda *a: time.strftime('%Y-%m-%d'),
'end_date': lambda *a: time.strftime('%Y-%m-%d'),
}
def print_report(self, cr, uid, ids, context=None):

View File

@ -33,8 +33,8 @@ class hr_attendance_error(osv.osv_memory):
'max_delay': fields.integer('Max. Delay (Min)', required=True)
}
_defaults = {
'init_date': time.strftime('%Y-%m-%d'),
'end_date': time.strftime('%Y-%m-%d'),
'init_date': lambda *a: time.strftime('%Y-%m-%d'),
'end_date': lambda *a: time.strftime('%Y-%m-%d'),
'max_delay': 120,
}

View File

@ -111,7 +111,7 @@ class hr_contract(osv.osv):
'notes': fields.text('Notes'),
}
_defaults = {
'date_start': time.strftime("%Y-%m-%d"),
'date_start': lambda *a: time.strftime("%Y-%m-%d"),
}
hr_contract()

View File

@ -90,7 +90,7 @@ class hr_expense_expense(osv.osv):
\nIf the admin accepts it, the state is \'Accepted\'.\n If an invoice is made for the expense request, the state is \'Invoiced\'.\n If the expense is paid to user, the state is \'Reimbursed\'.'),
}
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'date': lambda *a: time.strftime('%Y-%m-%d'),
'state': 'draft',
'employee_id': _employee_get,
'user_id': lambda cr, uid, id, c={}: id,
@ -241,7 +241,7 @@ class hr_expense_line(osv.osv):
}
_defaults = {
'unit_quantity': 1,
'date_value': time.strftime('%Y-%m-%d'),
'date_value': lambda *a: time.strftime('%Y-%m-%d'),
}
_order = "sequence, date_value desc"

View File

@ -34,7 +34,7 @@ class hr_holidays_summary_dept(osv.osv_memory):
}
_defaults = {
'date_from': time.strftime('%Y-%m-01'),
'date_from': lambda *a: time.strftime('%Y-%m-01'),
'holiday_type': 'Validated'
}

View File

@ -33,7 +33,7 @@ class hr_holidays_summary_employee(osv.osv_memory):
}
_defaults = {
'date_from': time.strftime('%Y-%m-01'),
'date_from': lambda *a: time.strftime('%Y-%m-01'),
'holiday_type': 'Validated',
}

View File

@ -43,8 +43,8 @@ class hr_payroll_employees_detail(osv.osv_memory):
_defaults = {
# 'fiscalyear_id':_get_fiscalyear,
'date_from':time.strftime('%Y-01-01'),
'date_to':time.strftime('%Y-%m-%d'),
'date_from': lambda *a: time.strftime('%Y-01-01'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'),
}

View File

@ -44,8 +44,8 @@ class hr_payroll_year_salary(osv.osv_memory):
_defaults = {
# 'fiscalyear_id':_get_fiscalyear,
'date_from':time.strftime('%Y-01-01'),
'date_to':time.strftime('%Y-%m-%d'),
'date_from': lambda *a: time.strftime('%Y-01-01'),
'date_to': lambda *a: time.strftime('%Y-%m-%d'),
'salary_on': 'current_month'
}

View File

@ -45,8 +45,8 @@ class analytical_timesheet_employee(osv.osv_memory):
return emp_id and emp_id[0] or False
_defaults = {
'month': datetime.date.today().month,
'year': datetime.date.today().year,
'month': lambda *a: datetime.date.today().month,
'year': lambda *a: datetime.date.today().year,
'employee_id': _get_user
}

View File

@ -34,8 +34,8 @@ class analytical_timesheet_employees(osv.osv_memory):
}
_defaults = {
'month': datetime.date.today().month,
'year': datetime.date.today().year,
'month': lambda *a: datetime.date.today().month,
'year': lambda *a: datetime.date.today().year,
}
def print_report(self, cr, uid, ids, context=None):