if de.strftime('%Y-%m-%d') > fy.date_stop:
de = datetime.strptime(fy.date_stop, '%Y-%m-%d')
- context_today = fields.date.context_today(cr,uid,context=context)
+ context_today = fields.date.context_today(self,cr,uid,context=context)
period_obj.create(cr, uid, {
'name': ds.strftime('%m/%Y'),
'code': ds.strftime('%m/%Y'),
def finds(self, cr, uid, dt=None, exception=True, context=None):
if context is None: context = {}
if not dt:
- dt = fields.date.context_today(cr,uid,context=context)
+ dt = fields.date.context_today(self,cr,uid,context=context)
args = [('date_start', '<=' ,dt), ('date_stop', '>=', dt)]
if context.get('company_id', False):
args.append(('company_id', '=', context['company_id']))
def find(self, cr, uid, dt=None, context=None):
if context is None: context = {}
if not dt:
- dt = fields.date.context_today(cr,uid,context=context)
+ dt = fields.date.context_today(self,cr,uid,context=context)
#CHECKME: shouldn't we check the state of the period?
args = [('date_start', '<=' ,dt), ('date_stop', '>=', dt)]
if context.get('company_id', False):
'ref': entry['name'],
'period_id': period_id,
'journal_id': model.journal_id.id,
- 'date': context.get('date', fields.date.context_today(cr,uid,context=context))
+ 'date': context.get('date', fields.date.context_today(self,cr,uid,context=context))
})
move_ids.append(move_id)
for line in model.lines_id:
'account_id': line.account_id.id,
'move_id': move_id,
'partner_id': line.partner_id.id,
- 'date': context.get('date', fields.date.context_today(cr,uid,context=context)),
+ 'date': context.get('date', fields.date.context_today(self,cr,uid,context=context)),
'date_maturity': date_maturity
})
account_move_line_obj.create(cr, uid, val, context=ctx)
}
_defaults = {
'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'),
- 'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(cr,uid,context=context)),
+ 'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(self,cr,uid,context=context)),
'type': 'general',
}
ctx = context.copy()
ctx.update({'lang': inv.partner_id.lang})
if not inv.date_invoice:
- self.write(cr, uid, [inv.id], {'date_invoice': fields.date.context_today(cr,uid,context=context)}, context=ctx)
+ self.write(cr, uid, [inv.id], {'date_invoice': fields.date.context_today(self,cr,uid,context=context)}, context=ctx)
company_currency = inv.company_id.currency_id.id
# create the analytical lines
# one move line per invoice line
'name' : codafilename,
'coda_data': codafile,
'coda_creation_date' : coda_statement['date'],
- 'date': fields.date.context_today(cr, uid, context=context),
+ 'date': fields.date.context_today(self, cr, uid, context=context),
'user_id': uid,
})
context.update({'coda_id': coda_id})
self.write(cr, uid, [partner.id], {
'partner_latitude': result[0],
'partner_longitude': result[1],
- 'date_localization': fields.date.context_today(cr,uid,context=context)
+ 'date_localization': fields.date.context_today(self,cr,uid,context=context)
}, context=context)
return True
res_partner()
partners = self.pool.get('res.partner').browse(cr, uid, [partner_assigned_id], context=context)
user_id = partners[0] and partners[0].user_id.id or False
return {'value':
- {'date_assign': fields.date.context_today(cr,uid,context=context),
+ {'date_assign': fields.date.context_today(self,cr,uid,context=context),
'user_id' : user_id}
}
if partner.user_id:
for lead_id in ids:
self.allocate_salesman(cr, uid, [lead_id], [partner.user_id.id], context=context)
- self.write(cr, uid, [lead.id], {'date_assign': fields.date.context_today(cr,uid,context=context), 'partner_assigned_id': partner_id}, context=context)
+ self.write(cr, uid, [lead.id], {'date_assign': fields.date.context_today(self,cr,uid,context=context), 'partner_assigned_id': partner_id}, context=context)
return res
'product_id': _getEmployeeProduct,
'general_account_id': _getGeneralAccount,
'journal_id': _getAnalyticJournal,
- 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(cr,uid,context=ctx)),
+ 'date': lambda self, cr, uid, ctx: ctx.get('date', fields.date.context_today(self,cr,uid,context=ctx)),
'user_id': lambda obj, cr, uid, ctx: ctx.get('user_id', uid),
}
def on_change_account_id(self, cr, uid, ids, account_id):
'name': 'Refund %s'%order_id.name,
'statement_id': order_id.statement_ids[0].statement_id.id,
'pos_statement_id': new_order,
- 'date': fields.date.context_today(cr, uid, context=context),
+ 'date': fields.date.context_today(self, cr, uid, context=context),
'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,
'total_free': fields.function(_get_total_free, string='Total Free'),
}
_defaults = {
- 'date_from': lambda self,cr,uid,ctx: fields.date.context_today(cr,uid,timestamp=(datetime.now()+relativedelta(day=1)),context=ctx),
- 'date_to': lambda self,cr,uid,ctx: fields.date.context_today(cr,uid,timestamp=(datetime.now()+relativedelta(months=1, day=1, days=-1)),context=ctx),
+ 'date_from': lambda self,cr,uid,ctx: fields.date.context_today(self,cr,uid,timestamp=(datetime.now()+relativedelta(day=1)),context=ctx),
+ 'date_to': lambda self,cr,uid,ctx: fields.date.context_today(self,cr,uid,timestamp=(datetime.now()+relativedelta(months=1, day=1, days=-1)),context=ctx),
'user_id': lambda self, cr, uid, c: uid,
'state': 'draft',
'business_days': 20,
return {'value':{'partner_address_id': supplier_address['default'], 'pricelist_id': pricelist, 'fiscal_position': fiscal_position}}
def wkf_approve_order(self, cr, uid, ids, context=None):
- self.write(cr, uid, ids, {'state': 'approved', 'date_approve': fields.date.context_today(cr,uid,context=context)})
+ self.write(cr, uid, ids, {'state': 'approved', 'date_approve': fields.date.context_today(self,cr,uid,context=context)})
return True
#TODO: implement messages system
if not o.order_line:
raise osv.except_osv(_('Error !'),_('You cannot confirm a sale order which has no line.'))
if (o.order_policy == 'manual'):
- self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': fields.date.context_today(cr, uid, context=context)})
+ self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
else:
- self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(cr, uid, context=context)})
+ self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
message = _("The quotation '%s' has been converted to a sales order.") % (o.name,)
self.log(cr, uid, o.id, message)
'partner_invoice_id': partner_addr['invoice'],
'partner_order_id': partner_addr['contact'],
'partner_shipping_id': partner_addr['delivery'],
- 'date_order': fields.date.context_today(cr,uid,context=context),
+ 'date_order': fields.date.context_today(self,cr,uid,context=context),
'fiscal_position': fpos,
}
if partner.id: