rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
'total_cost': fields.function(_total_cost, string='Cost', method=True, type="float"), 'revenue': fields.float('Revenue',readonly=True),
def _total_cost(self, cr, uid, ids, field_name, arg, context={}):
if task.name.startswith(_('CHECK: ')): newname = str(task.name).replace(_('CHECK: '), '')
if task_name.startswith(_('CHECK: ')): newname = str(task_name).replace(_('CHECK: '), '')
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task...
newname = task.name or ''
newname = task_name or ''
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ res = super(project_task_delegate, self).default_get(cr, uid, fields, context=context) if context is None: context = {} record_id = context and context.get('active_id', False) or False task_pool = self.pool.get('project.task...
return '!workflow {model: %s, action: %s ref: %s}:' % (str(self.model,), str(self.action,), str(self.ref,))
return '!workflow {model: %s, action: %s, ref: %s}' % (str(self.model,), str(self.action,), str(self.ref,))
def __repr__(self): return '!workflow {model: %s, action: %s ref: %s}:' % (str(self.model,), str(self.action,), str(self.ref,))
def _check_qty(self, cr, uid, ids): lines = self.browse(cr, uid, ids) for line in lines: if line.qty <= 0: return False return True _constraints = [ (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']), ]
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: comp=res_obj.browse(cr,uid,uid).company_id.company_discou...
if (maxdate.strftime('%Y-%m-%d')>=proc.date_planned) or (proc.procure_method=='make_to_order'):
if (maxdate.strftime('%Y-%m-%d')>=proc.date_planned):
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' use_new_cursor: False or the dbname ''' if not context: context = {}
if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) or (proc.procure_method=='make_to_order'):
if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) :
def _procure_confirm(self, cr, uid, ids=None, use_new_cursor=False, context=None): ''' use_new_cursor: False or the dbname ''' if not context: context = {}
if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val += " or '''%s'''" % null_value if model_object_field:
if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val += " or '''%s'''" % null_value
def compute_pl(self, model_object_field, sub_model_object_field, null_value, template_language='mako'): """ Returns the expression based on data provided @param model_object_field: First level field @param sub_model_object_field: Second level drilled down field (M2O) @param null_value: What has to be returned if the va...
if fill_inventory.set_stock_zero: amount = 0 else: amount = stock_location_obj._product_get(cr, uid,
amount = stock_location_obj._product_get(cr, uid,
def fill_inventory(self, cr, uid, ids, context): """ To Import stock inventory according to products available in the selected locations. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context...
assert(mode in ('debit', 'credit'), 'Invalid Mode')
assert mode in ('debit', 'credit'), 'Invalid Mode'
def _centralise(self, cr, uid, move, mode, context=None): assert(mode in ('debit', 'credit'), 'Invalid Mode') #to prevent sql injection if context is None: context = {}
self.precision_get.clear_cache(cr.dbname)
def write(self, cr, uid, ids, data, *args, **argv): self.precision_get.clear_cache(cr.dbname) res = super(decimal_precision, self).write(cr, uid, ids, data, *args, **argv) for obj in self.pool.obj_list(): for colname,col in self.pool.get(obj)._columns.items(): if isinstance(col, fields.float): col.digits_change(cr) ret...
@param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks,
def on_change_survey(self, cr, uid, ids, survey_id, context=None): """ on change event of survey_id field, if note is available in selected survey then display this note in note fields.
result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter')
result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.g...
phonecall_case_obj = pool.get('hr.phonecall')
phonecall_case_obj = pool.get('crm.phonecall')
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.g...
id2 = data_obj._get_id(cr, uid, 'hr', 'hr_case_phone_tree_view') id3 = data_obj._get_id(cr, uid, 'hr', 'hr_case_phone_form_view')
id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_tree_view') id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_phone_form_view')
def _doIt(self, cr, uid, data, context): form = data['form'] pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'hr', 'view_hr_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id']) phonecall_case_obj = pool.get('hr.phonecall') job_case_obj = pool.g...
'name': case.partner_name2,
'name': case.partner_name,
def _makeOrder(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) mod_obj = pool.get('ir.model.data') result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter') res = mod_obj.read(cr, uid, result, ['res_id']) case_obj = pool.get('hr.applicant') partner_obj = pool.get('res.partner') contact_obj =...
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id,
def on_change_unit_amount(self, cr, uid, id, prod_id, quantity, company_id,
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('accou...
uom_obj = self.pool.get('product.uom')
if not journal_id or not prod_id: return {}
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('accou...
company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') if prod_id: result = 0.0 prod = product_obj.browse(cr, uid, prod_id)
analytic_journal_obj =self.pool.get('account.analytic.journal') j_id = analytic_journal_obj.browse(cr, uid, journal_id, context=context) prod = product_obj.browse(cr, uid, prod_id) if not company_id: company_id = j_id.company_id.id result = 0.0 is_purchase = False if j_id.type == 'purchase':
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('accou...
if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False pricetype=product_price_type_obj.browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id) if journal_id: journal = analytic_journal_obj.browse(cr, uid, journal_id) if jo...
amount_unit = prod.price_get('standard_price', context)[prod.id] is_purchase = True else: a = prod.product_tmpl_id.property_account_income.id if not a: a = prod.categ_id.property_account_income_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no income account defined ' \ 'for this product: "%s" (id:%...
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('accou...
}} return {}
} }
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount,company_id, unit=False, journal_id=False, context=None): if context==None: context={} uom_obj = self.pool.get('product.uom') product_obj = self.pool.get('product.product') company_obj=self.pool.get('res.company') analytic_journal_obj=self.pool.get('accou...
print "CUUULLL" print move.prodlot_id.id
def __create_partial_move_memory(self, move): print "CUUULLL" print move.prodlot_id.id move_memory = { 'product_id' : move.product_id.id, 'quantity' : move.product_qty, 'product_uom' : move.product_uom.id, 'prodlot_id' : move.prodlot_id.id, 'move_id' : move.id, } if move.picking_id.type == 'in': move_memory.update({ 'c...
print res
def __get_active_stock_moves(self, cr, uid, context=None): move_obj = self.pool.get('stock.move') if not context: context = {} res = [] for move in move_obj.browse(cr, uid, context.get('active_ids', [])): if move.state in ('done', 'cancel'): continue res.append(self.__create_partial_move_memory(move)) print res retur...
company_currency_id, st_line.amount, context=context, account=acc_cur)
company_currency_id, st_line.amount, context=context)
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement...
amount = res_currency_obj.compute(cr, uid, st.currency.id, company_currency_id, st_line.amount, context=context, account=acc_cur)
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement...
st.currency.id, amount, context=context, account=acc_cur)
st.currency.id, amount, context=context)
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement...
st_line.account_id.currency_id.id, amount, context=context, account=acc_cur)
st_line.account_id.currency_id.id, amount, context=context)
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): if context is None: context = {} res_currency_obj = self.pool.get('res.currency') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement...
amount = unit_amount * r.product_id.uom_id._compute_price(cr, uid,
amount = unit_amount * self.pool.get('product.uom')._compute_price(cr, uid,
def on_change_user_id(self, cr, uid, ids,user_id, account_id, unit_amount=0): res = {} if not (user_id): #avoid a useless call to super return res
AND f.id = ' + str(fiscalyear_id) + ' ')
AND f.id = ' + str(fiscalyear_id) + ' order by p.date_start')
def onchange_filter(self, cr, uid, ids, filter='filter_no', fiscalyear_id=False, context=None): res = {} if filter == 'filter_no': res['value'] = {'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False} if filter == 'filter_date': res['value'] = {'period_from': False, 'period_to': False, 'date_f...
'text_area':fields.text("Text area",select=True),
'text_area':fields.text("Text area"),
def write(self, cr, uid, ids, vals, context=None): result = super(Wiki,self).write(cr, uid, ids, vals, context) history = self.pool.get('wiki.wiki.history') if vals.get('text_area'): for id in ids: res = { 'minor_edit':vals.get('minor_edit', True), 'text_area':vals.get('text_area',''), 'write_uid':uid, 'wiki_id' : id, ...
context = context
context = {}
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if not context: context = context if not context.get('planning'): return super(project_task,self).search(cr, user, args, offset, limit, order, context) cr.execute(" SELECT t.id, t.name \ from project_task t \ join report_acco...
'context': "{'journal_id': %d, 'search_default_journal_id':%d, 'search_default_period_id':%d, 'partner_id':%s}" % (journal_id, journal_id, period_id, context.get('partner_id',False)),
'context': "{'search_default_journal_id':%d, 'search_default_period_id':%d, 'partner_id':%s}" % (journal_id, period_id, context.get('partner_id',False)),
def action_open_window(self, cr, uid, ids, context=None): """ This function Open action move line window on given period and Journal/Payment Mode @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: account move journal’s ID or list of IDs @return: di...
email_from = getattr(obj, 'email_from', False)
email_from = getattr(obj, 'email_from', False) x_headers = {}
def action_send(self, cr, uid, ids, context=None): """ This sends an email to ALL the addresses of the selected partners. """
newdate = newdate -(delay and relativedelta(days=delay) or datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )
if delay: newdate = (newdate - (delay and relativedelta(days=delay))) else: newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
def create_order(self, cr, uid, ids, context): """ To Create a purchase orders .
'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Evaluation Type'),
'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Evaluation Form'),
def write(self, cr, uid, ids, vals, context=None): if 'date' in vals: new_vals = {'date_deadline': vals.get('date')} obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview') for evalutation in self.browse(cr, uid, ids, context=context): for survey_req in evalutation.survey_request_ids: obj_hr_eval_iterview.write...
'code': wc.code
'ref': wc.code
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_...
'code': wc.code
'ref': wc.code, 'product_id': production.product_id.id
def _costs_generate(self, cr, uid, production): """ Calculates total costs at the end of the production. @param production: Id of production order. @return: Calculated amount. """ amount = 0.0 analytic_line_obj = self.pool.get('account.analytic.line') for wc_line in production.workcenter_lines: wc = wc_line.workcenter_...
res_id = model_pool.message_new(cr, uid, msg, context)fetchmail/fetchmail.py
res_id = model_pool.message_new(cr, uid, msg, context)
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_update is not define in model %s' % (model_pool._name))
def get_id(self, cr, uid, sequence_id, test='id', context={}):
def get_id(self, cr, uid, sequence_id, test='id', context={}): if test not in ('id=%s', 'code=%s'): raise ValueError('invalid test')
def get_id(self, cr, uid, sequence_id, test='id', context={}): cr.execute('select id from ir_sequence where '+test+'=%s and active=%s', (sequence_id, True,)) res = cr.dictfetchone() if res: for line in self.browse(cr, uid, res['id'], context=context).fiscal_ids: if line.fiscalyear_id.id==context.get('fiscalyear_id', Fa...
attendee_obj.write(cr, uid, [res_id], {'del_to_user_ids' : [(6, 0, del_to_user_ids)]})
attendee_obj.write(cr, uid, [res_id], {'state':'delegated','del_to_user_ids' : [(6, 0, del_to_user_ids)]})
def create(self, cr, uid, vals, context={}): attendee_ids = vals.get('attendee_ids',False) model = context.get('model', False) res_id = context.get('active_id', False) state = context.get('state', False) attendee_obj = self.pool.get('calendar.attendee') if attendee_ids and model and res_id: attend = False if model == ...
if product.virtual_available >= 0.0: continue newdate = datetime.today() if product.supply_method == 'buy': location_id = warehouse.lot_input_id.id elif product.supply_method == 'produce': location_id = warehouse.lot_stock_id.id else: continue proc_id = proc_obj.create(cr, uid, { 'name': _('Automatic OP: %s') % (produ...
if (product.active == True) and (product.purchase_ok == True): if product.virtual_available >= 0.0: continue newdate = datetime.today() if product.supply_method == 'buy': location_id = warehouse.lot_input_id.id elif product.supply_method == 'produce': location_id = warehouse.lot_stock_id.id else: continue proc_id = pr...
def create_automatic_op(self, cr, uid, context=None): """ Create procurement of virtual stock < 0 @param self: The object pointer @param cr: The current row, from the database cursor, @param uid: The current user ID for security checks @param context: A standard dictionary for contextual values @return: Dictionary o...
'name': bom.routing_id.name,
'name': tools.ustr(wc_use.name) + ' - ' + tools.ustr(bom.product_id.name),
def _bom_explode(self, cr, uid, bom, factor, properties=[], addthis=False, level=0): """ Finds Products and Workcenters for related BoM for manufacturing order. @param bom: BoM of particular product. @param factor: Factor of product UoM. @param properties: A List of properties Ids. @param addthis: If BoM found then Tru...
'name': vals_bnk['name'] + ' Journal',
'name': vals_bnk['name'] + _(' Journal'),
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_acc_tax_code = self.pool.get('account.tax.code') obj_acc_template = self.pool.get('account.account.template') obj_ac...
'name': fields.char('Auction date', size=64, required=True),
'name': fields.char('Auction Name', size=64, required=True),
def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] reads = self.read(cr, uid, ids, ['name', 'auction1'], context) name = [(r['id'],'['+r['auction1']+'] '+ r['name']) for r in reads] return name
logger.debug("No namespace: %s ( for prop: %s)",ns, prop)
logger.debug('No namespace: %s ("%s")',ns, prop)
def get_dav_eprop(self, cr, ns, prop): if not self.DAV_M_NS: return None if self.DAV_M_NS.has_key(ns): prefix = self.DAV_M_NS[ns] else: logger.debug("No namespace: %s ( for prop: %s)",ns, prop) return None
print "cul" print index
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = n...
print next_stage
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = n...
return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool)
return self._find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool)
def _find_next_stage(self, cr, uid, stage_list, index, current_seq, stage_pool, context=None): if index + 1 == len(stage_list): return False print "cul" print index next_stage_id = stage_list[index + 1] next_stage = stage_pool.browse(cr, uid, next_stage_id, context=context) if not next_stage: return False next_seq = n...
print case
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): print case next_stage = False da...
print stage_type
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): print case next_stage = False da...
print stages print "call"
def stage_change(self, cr, uid, ids, context=None, order='sequence'): if not context: context = {} stage_pool = self.pool.get('crm.case.stage') stage_type = context and context.get('stage_type','') current_seq = False next_stage_id = False for case in self.browse(cr, uid, ids, context): print case next_stage = False da...
'prefix': 'BAN/',
'prefix': 'BNK/%(year)s/',
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
seq_prefix = "CSH/"
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
seq_prefix = "BAN/"
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
seq_prefix = "CHK/"
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
'name': _(vals_bnk['name']),
'name': _(vals_bnk['name'] + ' ' + 'Journal'),
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
'prefix': seq_prefix,
'prefix': _((vals_bnk['name'][:3].upper()) + '/%(year)s/'),
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
vals_journal['code']= _(vals_bnk['name'][:3])
vals_journal['code']= _(vals_bnk['name'][:3]).upper()
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
'prefix': '%(year)s/',
'prefix': 'SAJ/%(year)s/',
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
'prefix': '%(year)s/',
'prefix': 'EXJ/%(year)s/',
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
seq_id_sale_refund = seq_id seq_id_purchase_refund = seq_id
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
seq_id_sale_refund = seq_id_sale seq_id_purchase_refund = seq_id_purchase
def generate_configurable_chart(self, cr, uid, ids, context=None): obj_acc = self.pool.get('account.account') obj_acc_tax = self.pool.get('account.tax') obj_journal = self.pool.get('account.journal') obj_sequence = self.pool.get('ir.sequence') obj_acc_template = self.pool.get('account.account.template') obj_fiscal_posi...
'Membership amount', digites=(16, 2),
'Membership amount', digits=(16, 2),
def _get_partners(self, cr, uid, ids, context={}): ids2 = ids while ids2: ids2 = self.search(cr, uid, [('associate_member','in',ids2)], context=context) ids+=ids2 return ids
return super(scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
return super(project_scrum_sprint, self).copy(cr, uid, id, default=default, context=context)
def copy(self, cr, uid, id, default=None, context=None): """Overrides orm copy method @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: List of case’s IDs @param context: A standard dictionary for contextual values ""...
fnode.set_data(cr, data, fil)
if data is not None: fnode.set_data(cr, data, fil)
def create_child(self, cr, path, data): """ API function to create a child file object and node Return the node_* created """ dirobj = self.context._dirobj uid = self.context.uid ctx = self.context.context.copy() ctx.update(self.dctx) fil_obj=dirobj.pool.get('ir.attachment') val = { 'name': path, 'datas_fname': path, '...
product_ids = [] for location in res_location.keys(): res = res_location[location] for product_id in res.keys(): prod = product_obj.browse(cr, uid, [product_id])[0] uom = prod.uom_id.id context.update({'uom': uom}) amount = stock_location_obj._product_get(cr, uid, location, [product_id], context=context)[product_id]
if(amount): line_ids=inventory_line_obj.search(cr, uid, [('inventory_id', '=', context['active_ids']), ('location_id', '=', location), ('product_id', '=', product_id), ('product_uom', '=', uom), ('product_qty', '=', amount)]) if not len(line_ids): inventory_line = {'inventory_id': context['active_ids'][0], 'location_id...
def fill_inventory(self, cr, uid, ids, context): """ To fill stock inventory according to products available in the selected locations.. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context...
if(amount): line_ids=inventory_line_obj.search(cr, uid, [('inventory_id', '=', context['active_ids']), ('location_id', '=', location), ('product_id', '=', product_id), ('product_uom', '=', uom), ('product_qty', '=', amount)]) if not len(line_ids): inventory_line = {'inventory_id': context['active_ids'][0], 'location_id...
if(len(product_ids) == 0): raise osv.except_osv(_('Message !'), _('No product in this location.'))
def fill_inventory(self, cr, uid, ids, context): """ To fill stock inventory according to products available in the selected locations.. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: the ID or list of IDs if we want more than one @param context...
return False
md = self.pool.get('ir.model.data') res = md.get_object_reference(cr, uid, 'product', 'cat0') or False return res and res[1] or False
def _default_category(self, cr, uid, context={}): if 'categ_id' in context and context['categ_id']: return context['categ_id'] return False
def _get_categ(self, cursor, user, context={}): md = self.pool.get('ir.model.data') return md._get_id(cr, uid, 'product', 'cat0') or False
def _get_categ(self, cursor, user, context={}): md = self.pool.get('ir.model.data') return md._get_id(cr, uid, 'product', 'cat0') or False
'categ_id': _get_categ,
def _get_categ(self, cursor, user, context={}): md = self.pool.get('ir.model.data') return md._get_id(cr, uid, 'product', 'cat0') or False
'order_policy': 'manual',
def _get_order(self, cr, uid, ids, context=None): if context is None: context = {} result = {} for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context): result[line.order_id.id] = True return result.keys()
for (tasks_id,) in res: task_obj.copy(cr, uid, tasks_id, default = { 'project_id': new_id, 'active':True}, context=context) child_ids = self.search(cr, uid, [('parent_id','=', proj.id)], context=context)
child_ids = self.search(cr, uid, [('parent_id','=', proj.category_id.id)], context=context) parent_id = self.read(cr, uid, new_id, ['category_id'])['category_id'][0]
def duplicate_template(self, cr, uid, ids, context={}): project_obj = self.pool.get('project.project') data_obj = self.pool.get('ir.model.data') task_obj = self.pool.get('project.task') result = [] for proj in self.browse(cr, uid, ids, context=context): parent_id = context.get('parent_id',False) # check me where to pas...
self.duplicate_template(cr, uid, child_ids, context={'parent_id': new_id})
self.duplicate_template(cr, uid, child_ids, context={'parent_id': parent_id})
def duplicate_template(self, cr, uid, ids, context={}): project_obj = self.pool.get('project.project') data_obj = self.pool.get('ir.model.data') task_obj = self.pool.get('project.task') result = [] for proj in self.browse(cr, uid, ids, context=context): parent_id = context.get('parent_id',False) # check me where to pas...
'type': fields.many2one('project.task.type', 'Stage'),
'type': fields.many2one('project.task.type', 'Stage',),
def _check_dates(self, cr, uid, ids, context={}): task = self.read(cr, uid, ids[0],['date_start', 'date_end']) if task['date_start'] and task['date_end']: if task['date_start'] > task['date_end']: return False return True
res.update({'reply_to': case.section_id.reply_to})
res.update({'reply_to': case.section_id and case.section_id.reply_to or False})
def default_get(self, cr, uid, fields, context=None): """ This function gets default values """ if not context: context = {}
if not inv.line_ids: raise osv.except_osv(_('Error !'), _('You can not validate a voucher without lines !'))
def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: terms = term_pool.compute(cr, uid, term_id, amount) return terms return False
end) as price_total,
end) / cr.rate as price_total,
def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as da...
end) as price_total_tax,
end)/(select count(l.id) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) /cr.rate as price_total_tax,
def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as da...
end) as price_average,
end) / cr.rate as price_average, cr.rate as currency_rate,
def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as da...
end)/(select count(l.*) from account_invoice_line as l
end)/(select count(l.id) from account_invoice_line as l
def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as da...
where a.id=ai.id) as residual
where a.id=ai.id) / cr.rate as residual
def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as da...
left join product_uom u on (u.id=ail.uos_id)
left join product_uom u on (u.id=ail.uos_id), res_currency_rate cr where cr.id in (select id from res_currency_rate cr2 where (cr2.currency_id = ai.currency_id) and ((ai.date_invoice is not null and cr.name <= ai.date_invoice) or (ai.date_invoice is null and cr.name <= NOW())) limit 1)
def init(self, cr): tools.drop_view_if_exists(cr, 'account_invoice_report') cr.execute(""" create or replace view account_invoice_report as ( select min(ail.id) as id, ai.date_invoice as date, to_char(ai.date_invoice, 'YYYY') as year, to_char(ai.date_invoice, 'MM') as month, to_char(ai.date_invoice, 'YYYY-MM-DD') as da...
print 'XXXXXXXX : ', cal_list, len(cal_list)
def get_data(self,form): cr, uid = self.cr, self.uid db_pool = pooler.get_pool(self.cr.dbname) #Getting Profit or Loss Balance from profit and Loss report result_pl=self.obj_pl.get_data(form) self.res_pl=self.obj_pl.final_result() type_pool = db_pool.get('account.account.type') account_pool = db_pool.get('account.acc...
obj = self.pool.get('hr.analytic.timesheet')
obj_timesheet = self.pool.get('hr.analytic.timesheet') task_obj = self.pool.get('project.task')
def create(self, cr, uid, vals, *args, **kwargs): obj = self.pool.get('hr.analytic.timesheet') vals_line = {} obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), too...
obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id'])
obj_task = task_obj.browse(cr, uid, vals['task_id'])
def create(self, cr, uid, vals, *args, **kwargs): obj = self.pool.get('hr.analytic.timesheet') vals_line = {} obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), too...
res = obj.on_change_account_id(cr, uid, False, acc_id)
res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id)
def create(self, cr, uid, vals, *args, **kwargs): obj = self.pool.get('hr.analytic.timesheet') vals_line = {} obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), too...
timeline_id = obj.create(cr, uid, vals_line, {})
amount = vals_line['unit_amount'] prod_id = vals_line['product_id'] unit = False timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=kwargs['context'])
def create(self, cr, uid, vals, *args, **kwargs): obj = self.pool.get('hr.analytic.timesheet') vals_line = {} obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), too...
amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context) vals_line['amount'] = (-1) * vals['hours']* (unit_amount or 0.0) obj.write(cr, uid,[timeline_id], vals_line, {})
amount_unit=obj_timesheet.on_change_unit_amount(cr, uid, timeline_id, prod_id, amount, unit, context=kwargs['context']) vals_line['amount'] = (-1) * vals['hours']* (amount_unit['value']['amount'] or 0.0) obj_timesheet.write(cr, uid,[timeline_id], vals_line, {})
def create(self, cr, uid, vals, *args, **kwargs): obj = self.pool.get('hr.analytic.timesheet') vals_line = {} obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), too...
task = self.pool.get('project.task.work').browse(cr, uid, ids)[0]
obj = self.pool.get('hr.analytic.timesheet') timesheet_obj = self.pool.get('hr.analytic.timesheet') task = self.pool.get('project.task.work').browse(cr, uid, ids, context=context)[0]
def write(self, cr, uid, ids, vals, context=None): vals_line = {}
list_avail_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, [])
list_avail_ids = timesheet_obj.search(cr, uid, [], context=context)
def write(self, cr, uid, ids, vals, context=None): vals_line = {}
obj = self.pool.get('hr.analytic.timesheet')
def write(self, cr, uid, ids, vals, context=None): vals_line = {}
amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context) vals_line['amount'] = (-1) * vals['hours'] * (amount_unit or 0.0) obj.write(cr, uid, [line_id], vals_line, {})
unit = False amount_unit=obj.on_change_unit_amount(cr, uid, line_id, vals_line['product_id'], vals_line['unit_amount'], unit, context=context) vals_line['amount'] = (-1) * vals['hours'] * (amount_unit['value']['amount'] or 0.0) obj.write(cr, uid, [line_id], vals_line, context=context)
def write(self, cr, uid, ids, vals, context=None): vals_line = {}
'date': fields.date('Date', readonly=True),
def _amount_all(self, cr, uid, ids, field_name, arg, context): res = {} for id in ids: print context dir, type = id.split(' ') att = self.pool.get('ir.attachment') fids = att.search(cr, uid, [('parent_id','child_of',[int(dir)]),('change_type_id','=',int(type))], context=context) res[id] = { 'amount_required': 0, 'amoun...
date_values = [from_date, to_date]
where.append(tuple([from_date])) where.append(tuple([to_date]))
def get_product_available(self, cr, uid, ids, context=None): """ Finds whether product is available or not in particular warehouse. @return: Dictionary of values """ if context is None: context = {} states = context.get('states',[]) what = context.get('what',()) if not ids: ids = self.search(cr, uid, []) res = {}.fromk...
where = [tuple(location_ids),tuple(location_ids),tuple(ids),tuple(states)]
def get_product_available(self, cr, uid, ids, context=None): """ Finds whether product is available or not in particular warehouse. @return: Dictionary of values """ if context is None: context = {} states = context.get('states',[]) what = context.get('what',()) if not ids: ids = self.search(cr, uid, []) res = {}.fromk...
'partner_id': fields.many2one('res.partner', 'Partner'),
'partner_id': fields.many2one('res.partner', 'Partner', select=1),
def _get_move_lines(self, cr, uid, ids, context=None): result = [] for move in self.pool.get('account.move').browse(cr, uid, ids, context=context): for line in move.line_id: result.append(line.id) return result
sale_ids = sline.search(cr, uid, [('procurement_id','=',procurement.id)], context)
def action_produce_assign_service(self, cr, uid, ids, context={}): for procurement in self.browse(cr, uid, ids): sline = self.pool.get('sale.order.line') sale_ids = sline.search(cr, uid, [('procurement_id','=',procurement.id)], context) content = '' l = None project_id = None for line in sline.browse(cr, uid, sale_ids,...
proj_name = tools.ustr(procurement.name)
proj_name = tools.ustr(so_ref)
def action_produce_assign_service(self, cr, uid, ids, context={}): for procurement in self.browse(cr, uid, ids): sline = self.pool.get('sale.order.line') sale_ids = sline.search(cr, uid, [('procurement_id','=',procurement.id)], context) content = '' l = None project_id = None for line in sline.browse(cr, uid, sale_ids,...
project_id = self.pool.get('project.project').create(cr, uid, {'name':proj_name})
project_id = self.pool.get('project.project').create(cr, uid, {'name':proj_name,'category_id':analytic_account_id, 'partner_id':partner_id})
def action_produce_assign_service(self, cr, uid, ids, context={}): for procurement in self.browse(cr, uid, ids): sline = self.pool.get('sale.order.line') sale_ids = sline.search(cr, uid, [('procurement_id','=',procurement.id)], context) content = '' l = None project_id = None for line in sline.browse(cr, uid, sale_ids,...
'name': '%s:%s' %(procurement.product_id.name or procurement.origin, procurement.name or ''),
'name': '%s:%s' % name_task,
def action_produce_assign_service(self, cr, uid, ids, context={}): for procurement in self.browse(cr, uid, ids): sline = self.pool.get('sale.order.line') sale_ids = sline.search(cr, uid, [('procurement_id','=',procurement.id)], context) content = '' l = None project_id = None for line in sline.browse(cr, uid, sale_ids,...