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') task = task_pool.browse(cr, uid, record_id, context=context) |
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') task = task_pool.browse(cr, uid, record_id, context=context) |
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_discount or 0.0 else: comp= company_disc[0] and company_disc[0].order_id.company_id and company_disc[0].order_id.company_id.company_discount or 0.0 |
|
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 value is empty @param template_language: The language used for templating @return: computed expression """ #Configure for MAKO copy_val = '' if template_language == 'mako': if model_object_field: copy_val = "${object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val += " or '''%s'''" % null_value if model_object_field: copy_val += "}" elif template_language == 'django': if model_object_field: copy_val = "{{object." + model_object_field if sub_model_object_field: copy_val += "." + sub_model_object_field if null_value: copy_val = copy_val + "|default:'''%s'''" % null_value copy_val = copy_val + "}}" return copy_val |
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: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') if ids and len(ids): ids = ids[0] else: return {} fill_inventory = self.browse(cr, uid, ids) res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res 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, compute_child=False) if fill_inventory.set_stock_zero: amount = 0 else: 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': location, 'product_id': product_id, 'product_uom': uom, 'product_qty': amount } inventory_line_obj.create(cr, uid, inventory_line) product_ids.append(product_id) |
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) return res |
|
@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.get('hr.applicant') # Select the view |
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.get('hr.applicant') # Select the view |
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.get('hr.applicant') # Select the view |
'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 = pool.get('res.partner.address') for case in case_obj.browse(cr, uid, data['ids']): partner_id = partner_obj.search(cr, uid, [('name', '=', case.partner_name or case.name)]) if partner_id: raise wizard.except_wizard(_('Warning !'),_('A partner is already existing with the same name.')) else: partner_id = partner_obj.create(cr, uid, { 'name': case.partner_name or case.name, 'user_id': case.user_id.id, 'comment': case.description, }) contact_id = contact_obj.create(cr, uid, { 'partner_id': partner_id, 'name': case.partner_name2, 'phone': case.partner_phone, 'mobile': case.partner_mobile, 'email': case.email_from }) |
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('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) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype 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 journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {} |
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('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) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype 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 journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {} |
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('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) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype 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 journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {} |
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 journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { | 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:%d)') % \ (prod.name, prod_id,)) amount_unit = prod.price_get('list_price', context)[prod_id] prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit * quantity or 1.0 result = round(amount, prec) if is_purchase: result *= -1 return { 'value': { | 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('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) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype 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 journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {} |
}} 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('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) a = prod.product_tmpl_id.property_account_expense.id if not a: a = prod.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error !'), _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (prod.name, prod.id,)) if not company_id: company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context) flag = False # Compute based on pricetype 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 journal.type == 'sale': product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context) if product_price_type_ids: pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0] # Take the company currency as the reference one if pricetype.field == 'list_price': flag = True amount_unit = prod.price_get(pricetype.field, context)[prod.id] amount = amount_unit*unit_amount or 1.0 prec = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account') amount = amount_unit*unit_amount or 1.0 result = round(amount, prec) if not flag: result *= -1 return {'value': { 'amount': result, 'general_account_id': a, }} return {} |
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({ 'cost' : move.product_id.standard_price, 'currency' : move.product_id.company_id.currency_id.id, }) return move_memory |
|
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 return res |
|
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_line_obj = self.pool.get('account.bank.statement.line') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id |
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_line_obj = self.pool.get('account.bank.statement.line') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id |
|
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_line_obj = self.pool.get('account.bank.statement.line') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id |
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_line_obj = self.pool.get('account.bank.statement.line') st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) st = st_line.statement_id |
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_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d')} if filter == 'filter_period' and fiscalyear_id: start_period = end_period = False cr.execute('SELECT p.id FROM account_fiscalyear AS f \ LEFT JOIN account_period AS p on p.fiscalyear_id=f.id \ WHERE p.id IN \ (SELECT id FROM account_period \ WHERE p.fiscalyear_id = f.id \ AND p.date_start IN \ (SELECT max(date_start) from account_period WHERE p.fiscalyear_id = f.id)\ OR p.date_stop IN \ (SELECT min(date_stop) from account_period WHERE p.fiscalyear_id = f.id)) \ AND f.id = ' + str(fiscalyear_id) + ' ') periods = [i[0] for i in cr.fetchall()] if periods: start_period = periods[0] end_period = periods[1] res['value'] = {'period_from': start_period, 'period_to': end_period, 'date_from': False, 'date_to': False} return res |
'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, 'summary':vals.get('summary','') } history.create(cr, uid, res) return result |
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_account_analytic_planning_line l on (l.id = t.planning_line_id )\ where l.planning_id=%s",(context.get('planning'),)) ids = map(lambda x: x[0], cr.fetchall()) return ids |
'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: dictionary of Open action move line window on given period and Journal/Payment Mode """ period_pool = self.pool.get('account.journal.period') data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') if context is None: context = {} journal_id = self._get_journal(cr, uid, context) period_id = self._get_period(cr, uid, context) menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id')) name = context.get('title', menu.name) result = data_pool._get_id(cr, uid, 'account_voucher', 'view_voucher_filter_new') res_id = data_pool.browse(cr, uid, result, context=context).res_id res = { 'domain':menu.action.domain, 'name': name, 'view_type': 'form', 'view_mode': 'tree,graph,form', 'res_model': 'account.voucher', 'view_id': False, '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)), 'type': 'ir.actions.act_window', 'search_view_id': res_id } return res |
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(cr, uid, [survey_req.id], new_vals, context=context) return super(hr_evaluation, self).write(cr, uid, ids, vals, context=context) |
'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_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'code': wc.code } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'code': wc.code } ) return amount |
'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_id if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.hour * wc.costs_hour account = wc.costs_hour_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name + ' (H)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'code': wc.code } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle account = wc.costs_cycle_account_id.id if value and account: amount += value analytic_line_obj.create(cr, uid, { 'name': wc_line.name+' (C)', 'amount': value, 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, 'code': wc.code } ) return amount |
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', False): return super(ir_sequence, self).get_id(cr, uid, line.sequence_id.id, test="id", context=context) return super(ir_sequence, self).get_id(cr, uid, sequence_id, test, context) |
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 == 'calendar.attendee' and state == 'delegated': attend = attendee_obj.read(cr, uid, res_id, ['ref','user_id','del_to_user_ids']) for v1, v2, attendee in attendee_ids: vals = {} ref = '%s,%d'%(model, res_id) if attend: ref = attend['ref'] del_from_user_ids = [attend['user_id'][0]] del_to_user_ids = attend['del_to_user_ids'] del_to_user_ids.append(attendee['user_id']) vals.update({ 'del_from_user_ids' : [(6, 0, del_from_user_ids)] }) attendee_obj.write(cr, uid, [res_id], {'del_to_user_ids' : [(6, 0, del_to_user_ids)]}) vals.update({ 'ref': ref, }) attendee.update(vals) attendee_obj.create(cr, uid, attendee) res = super(invite_attendee_wizard, self).create(cr, uid, {}, context=context) return res |
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') % (product.name,), 'origin': _('SCHEDULER'), 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), 'product_id': product.id, 'product_qty': -product.virtual_available, 'product_uom': product.uom_id.id, 'location_id': location_id, 'procure_method': 'make_to_order', }) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr) | 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 = proc_obj.create(cr, uid, { 'name': _('Automatic OP: %s') % (product.name,), 'origin': _('SCHEDULER'), 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), 'product_id': product.id, 'product_qty': -product.virtual_available, 'product_uom': product.uom_id.id, 'location_id': location_id, 'procure_method': 'make_to_order', }) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr) | 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 of values """ if not context: context = {} product_obj = self.pool.get('product.product') proc_obj = self.pool.get('procurement.order') warehouse_obj = self.pool.get('stock.warehouse') wf_service = netsvc.LocalService("workflow") |
'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 True else False. @param level: Depth level to find BoM lines starts from 10. @return: result: List of dictionaries containing product details. result2: List of dictionaries containing workcenter details. """ factor = factor / (bom.product_efficiency or 1.0) factor = rounding(factor, bom.product_rounding) if factor < bom.product_rounding: factor = bom.product_rounding result = [] result2 = [] phantom = False if bom.type == 'phantom' and not bom.bom_lines: newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties) if newbom: res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty, properties, addthis=True, level=level+10) result = result + res[0] result2 = result2 + res[1] phantom = True else: phantom = False if not phantom: if addthis and not bom.bom_lines: result.append( { 'name': bom.product_id.name, 'product_id': bom.product_id.id, 'product_qty': bom.product_qty * factor, 'product_uom': bom.product_uom.id, 'product_uos_qty': bom.product_uos and bom.product_uos_qty * factor or False, 'product_uos': bom.product_uos and bom.product_uos.id or False, }) if bom.routing_id: for wc_use in bom.routing_id.workcenter_lines: wc = wc_use.workcenter_id d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle) mult = (d + (m and 1.0 or 0.0)) cycle = mult * wc_use.cycle_nbr result2.append({ 'name': bom.routing_id.name, 'workcenter_id': wc.id, 'sequence': level+(wc_use.sequence or 0), 'cycle': cycle, 'hour': float(wc_use.hour_nbr*mult + ((wc.time_start or 0.0)+(wc.time_stop or 0.0)+cycle*(wc.time_cycle or 0.0)) * (wc.time_efficiency or 1.0)), }) for bom2 in bom.bom_lines: res = self._bom_explode(cr, uid, bom2, factor, properties, addthis=True, level=level+10) result = result + res[0] result2 = result2 + res[1] return result, result2 |
'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_acc_tax_template = self.pool.get('account.tax.code.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') analytic_journal_obj = self.pool.get('account.analytic.journal') obj_acc_chart_template = self.pool.get('account.chart.template') obj_acc_journal_view = self.pool.get('account.journal.view') mod_obj = self.pool.get('ir.model.data') obj_sequence = self.pool.get('ir.sequence') property_obj = self.pool.get('ir.property') fields_obj = self.pool.get('ir.model.fields') obj_tax_fp = self.pool.get('account.fiscal.position.tax') obj_ac_fp = self.pool.get('account.fiscal.position.account') |
'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 = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: print next_stage return next_stage else : return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool) |
|
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 = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: print next_stage return next_stage else : return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool) |
|
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 = next_stage.sequence if (abs(next_seq - current_seq)) >= 1: print next_stage return next_stage else : return _find_next_stage(cr, uid, stage_list, index + 1, current_seq, stage_pool) |
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 data = {} print stage_type domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id |
|
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 data = {} print stage_type domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id |
|
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 data = {} print stage_type domain = [('type', '=', stage_type),('section_ids', '=', case.section_id.id)] if case.section_id and case.section_id.stage_ids: domain.append(('id', 'in', map(lambda x: x.id, case.section_id.stage_ids))) stages = stage_pool.search(cr, uid, domain, order=order) current_seq = case.stage_id.sequence index = -1 if case.stage_id and case.stage_id.id in stages: index = stages.index(case.stage_id.id) print stages print "call" next_stage = self._find_next_stage(cr, uid, stages, index, current_seq, stage_pool, context=context) if next_stage: next_stage_id = next_stage.id data = {'stage_id': next_stage.id} if next_stage.on_change: data.update({'probability': next_stage.probability}) self.write(cr, uid, [case.id], data, context=context) return next_stage_id |
|
'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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
|
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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
|
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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
|
'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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
'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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
'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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
'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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
|
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_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') mod_obj = self.pool.get('ir.model.data') analytic_journal_obj = self.pool.get('account.analytic.journal') |
|
'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 """ if context is None: context = {} if default is None: default = {} default.update({'backlog_ids': [], 'meeting_ids': []}) return super(scrum_sprint, self).copy(cr, uid, id, default=default, context=context) |
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, 'parent_id': self.dir_id, 'res_model': self.res_model, 'res_id': self.res_id, # Datas are not set here } |
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': location, 'product_id': product_id, 'product_uom': uom, 'product_qty': amount} inventory_line_obj.create(cr, uid, inventory_line) product_ids.append(product_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: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') for fill_inventory in self.browse(cr, uid, ids): res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res |
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': location, 'product_id': product_id, 'product_uom': uom, 'product_qty': amount} inventory_line_obj.create(cr, uid, inventory_line) product_ids.append(product_id) if(len(product_ids) == 0): raise osv.except_osv(_('Message !'), _('No product in this location.')) | 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: A standard dictionary @return: """ inventory_line_obj = self.pool.get('stock.inventory.line') location_obj = self.pool.get('stock.location') product_obj = self.pool.get('product.product') stock_location_obj = self.pool.get('stock.location') for fill_inventory in self.browse(cr, uid, ids): res = {} res_location = {} if fill_inventory.recursive : location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', fill_inventory.location_id.id)]) for location in location_ids : res = location_obj._product_get(cr, uid, location) res_location[location] = res else: context.update({'compute_child': False}) res = location_obj._product_get(cr, uid, fill_inventory.location_id.id, context=context) res_location[fill_inventory.location_id.id] = res |
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 pass context for parent id ?? new_id = project_obj.copy(cr, uid, proj.id, default = { 'name': proj.name +_(' (copy)'), 'state':'open', 'parent_id':parent_id}, context=context) result.append(new_id) cr.execute('select id from project_task where project_id=%s', (proj.id,)) res = cr.fetchall() 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) if child_ids: self.duplicate_template(cr, uid, child_ids, context={'parent_id': new_id}) |
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 pass context for parent id ?? new_id = project_obj.copy(cr, uid, proj.id, default = { 'name': proj.name +_(' (copy)'), 'state':'open', 'parent_id':parent_id}, context=context) result.append(new_id) cr.execute('select id from project_task where project_id=%s', (proj.id,)) res = cr.fetchall() 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) if child_ids: self.duplicate_template(cr, uid, child_ids, context={'parent_id': new_id}) |
'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 day, ail.product_id, ai.partner_id as partner_id, ai.payment_term as payment_term, ai.period_id as period_id, u.name as uom_name, ai.currency_id as currency_id, ai.journal_id as journal_id, ai.fiscal_position as fiscal_position, ai.user_id as user_id, ai.company_id as company_id, count(ail.*) as nbr, ai.type as type, ai.state, pt.categ_id, ai.date_due as date_due, ai.address_contact_id as address_contact_id, ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ai.partner_bank_id as partner_bank_id, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity * u.factor * -1 else ail.quantity * u.factor end) as product_qty, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity*ail.price_unit * -1 else ail.quantity*ail.price_unit end) as price_total, sum(case when ai.type in ('out_refund','in_invoice') then ai.amount_total * -1 else ai.amount_total end) as price_total_tax, (case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*ail.price_unit*-1) else sum(ail.quantity*ail.price_unit) end)/(case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*u.factor*-1) else sum(ail.quantity*u.factor) end) as price_average, sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2) from account_move_line as aml left join account_invoice as a ON (a.move_id=aml.move_id) left join account_invoice_line as l ON (a.id=l.invoice_id) where a.id=ai.id)) as delay_to_pay, (case when ai.type in ('out_refund','in_invoice') then ai.residual * -1 else ai.residual end)/(select count(l.*) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) as residual from account_invoice_line as ail left join account_invoice as ai ON (ai.id=ail.invoice_id) left join product_template pt on (pt.id=ail.product_id) left join product_uom u on (u.id=ail.uos_id) group by ail.product_id, ai.date_invoice, ai.id, to_char(ai.date_invoice, 'YYYY'), to_char(ai.date_invoice, 'MM'), to_char(ai.date_invoice, 'YYYY-MM-DD'), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.address_contact_id, ai.address_invoice_id, ai.account_id, ai.partner_bank_id, ai.residual, ai.amount_total ) """) |
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 day, ail.product_id, ai.partner_id as partner_id, ai.payment_term as payment_term, ai.period_id as period_id, u.name as uom_name, ai.currency_id as currency_id, ai.journal_id as journal_id, ai.fiscal_position as fiscal_position, ai.user_id as user_id, ai.company_id as company_id, count(ail.*) as nbr, ai.type as type, ai.state, pt.categ_id, ai.date_due as date_due, ai.address_contact_id as address_contact_id, ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ai.partner_bank_id as partner_bank_id, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity * u.factor * -1 else ail.quantity * u.factor end) as product_qty, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity*ail.price_unit * -1 else ail.quantity*ail.price_unit end) as price_total, sum(case when ai.type in ('out_refund','in_invoice') then ai.amount_total * -1 else ai.amount_total end) as price_total_tax, (case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*ail.price_unit*-1) else sum(ail.quantity*ail.price_unit) end)/(case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*u.factor*-1) else sum(ail.quantity*u.factor) end) as price_average, sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2) from account_move_line as aml left join account_invoice as a ON (a.move_id=aml.move_id) left join account_invoice_line as l ON (a.id=l.invoice_id) where a.id=ai.id)) as delay_to_pay, (case when ai.type in ('out_refund','in_invoice') then ai.residual * -1 else ai.residual end)/(select count(l.*) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) as residual from account_invoice_line as ail left join account_invoice as ai ON (ai.id=ail.invoice_id) left join product_template pt on (pt.id=ail.product_id) left join product_uom u on (u.id=ail.uos_id) group by ail.product_id, ai.date_invoice, ai.id, to_char(ai.date_invoice, 'YYYY'), to_char(ai.date_invoice, 'MM'), to_char(ai.date_invoice, 'YYYY-MM-DD'), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.address_contact_id, ai.address_invoice_id, ai.account_id, ai.partner_bank_id, ai.residual, ai.amount_total ) """) |
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 day, ail.product_id, ai.partner_id as partner_id, ai.payment_term as payment_term, ai.period_id as period_id, u.name as uom_name, ai.currency_id as currency_id, ai.journal_id as journal_id, ai.fiscal_position as fiscal_position, ai.user_id as user_id, ai.company_id as company_id, count(ail.*) as nbr, ai.type as type, ai.state, pt.categ_id, ai.date_due as date_due, ai.address_contact_id as address_contact_id, ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ai.partner_bank_id as partner_bank_id, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity * u.factor * -1 else ail.quantity * u.factor end) as product_qty, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity*ail.price_unit * -1 else ail.quantity*ail.price_unit end) as price_total, sum(case when ai.type in ('out_refund','in_invoice') then ai.amount_total * -1 else ai.amount_total end) as price_total_tax, (case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*ail.price_unit*-1) else sum(ail.quantity*ail.price_unit) end)/(case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*u.factor*-1) else sum(ail.quantity*u.factor) end) as price_average, sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2) from account_move_line as aml left join account_invoice as a ON (a.move_id=aml.move_id) left join account_invoice_line as l ON (a.id=l.invoice_id) where a.id=ai.id)) as delay_to_pay, (case when ai.type in ('out_refund','in_invoice') then ai.residual * -1 else ai.residual end)/(select count(l.*) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) as residual from account_invoice_line as ail left join account_invoice as ai ON (ai.id=ail.invoice_id) left join product_template pt on (pt.id=ail.product_id) left join product_uom u on (u.id=ail.uos_id) group by ail.product_id, ai.date_invoice, ai.id, to_char(ai.date_invoice, 'YYYY'), to_char(ai.date_invoice, 'MM'), to_char(ai.date_invoice, 'YYYY-MM-DD'), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.address_contact_id, ai.address_invoice_id, ai.account_id, ai.partner_bank_id, ai.residual, ai.amount_total ) """) |
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 day, ail.product_id, ai.partner_id as partner_id, ai.payment_term as payment_term, ai.period_id as period_id, u.name as uom_name, ai.currency_id as currency_id, ai.journal_id as journal_id, ai.fiscal_position as fiscal_position, ai.user_id as user_id, ai.company_id as company_id, count(ail.*) as nbr, ai.type as type, ai.state, pt.categ_id, ai.date_due as date_due, ai.address_contact_id as address_contact_id, ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ai.partner_bank_id as partner_bank_id, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity * u.factor * -1 else ail.quantity * u.factor end) as product_qty, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity*ail.price_unit * -1 else ail.quantity*ail.price_unit end) as price_total, sum(case when ai.type in ('out_refund','in_invoice') then ai.amount_total * -1 else ai.amount_total end) as price_total_tax, (case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*ail.price_unit*-1) else sum(ail.quantity*ail.price_unit) end)/(case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*u.factor*-1) else sum(ail.quantity*u.factor) end) as price_average, sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2) from account_move_line as aml left join account_invoice as a ON (a.move_id=aml.move_id) left join account_invoice_line as l ON (a.id=l.invoice_id) where a.id=ai.id)) as delay_to_pay, (case when ai.type in ('out_refund','in_invoice') then ai.residual * -1 else ai.residual end)/(select count(l.*) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) as residual from account_invoice_line as ail left join account_invoice as ai ON (ai.id=ail.invoice_id) left join product_template pt on (pt.id=ail.product_id) left join product_uom u on (u.id=ail.uos_id) group by ail.product_id, ai.date_invoice, ai.id, to_char(ai.date_invoice, 'YYYY'), to_char(ai.date_invoice, 'MM'), to_char(ai.date_invoice, 'YYYY-MM-DD'), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.address_contact_id, ai.address_invoice_id, ai.account_id, ai.partner_bank_id, ai.residual, ai.amount_total ) """) |
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 day, ail.product_id, ai.partner_id as partner_id, ai.payment_term as payment_term, ai.period_id as period_id, u.name as uom_name, ai.currency_id as currency_id, ai.journal_id as journal_id, ai.fiscal_position as fiscal_position, ai.user_id as user_id, ai.company_id as company_id, count(ail.*) as nbr, ai.type as type, ai.state, pt.categ_id, ai.date_due as date_due, ai.address_contact_id as address_contact_id, ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ai.partner_bank_id as partner_bank_id, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity * u.factor * -1 else ail.quantity * u.factor end) as product_qty, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity*ail.price_unit * -1 else ail.quantity*ail.price_unit end) as price_total, sum(case when ai.type in ('out_refund','in_invoice') then ai.amount_total * -1 else ai.amount_total end) as price_total_tax, (case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*ail.price_unit*-1) else sum(ail.quantity*ail.price_unit) end)/(case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*u.factor*-1) else sum(ail.quantity*u.factor) end) as price_average, sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2) from account_move_line as aml left join account_invoice as a ON (a.move_id=aml.move_id) left join account_invoice_line as l ON (a.id=l.invoice_id) where a.id=ai.id)) as delay_to_pay, (case when ai.type in ('out_refund','in_invoice') then ai.residual * -1 else ai.residual end)/(select count(l.*) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) as residual from account_invoice_line as ail left join account_invoice as ai ON (ai.id=ail.invoice_id) left join product_template pt on (pt.id=ail.product_id) left join product_uom u on (u.id=ail.uos_id) group by ail.product_id, ai.date_invoice, ai.id, to_char(ai.date_invoice, 'YYYY'), to_char(ai.date_invoice, 'MM'), to_char(ai.date_invoice, 'YYYY-MM-DD'), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.address_contact_id, ai.address_invoice_id, ai.account_id, ai.partner_bank_id, ai.residual, ai.amount_total ) """) |
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 day, ail.product_id, ai.partner_id as partner_id, ai.payment_term as payment_term, ai.period_id as period_id, u.name as uom_name, ai.currency_id as currency_id, ai.journal_id as journal_id, ai.fiscal_position as fiscal_position, ai.user_id as user_id, ai.company_id as company_id, count(ail.*) as nbr, ai.type as type, ai.state, pt.categ_id, ai.date_due as date_due, ai.address_contact_id as address_contact_id, ai.address_invoice_id as address_invoice_id, ai.account_id as account_id, ai.partner_bank_id as partner_bank_id, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity * u.factor * -1 else ail.quantity * u.factor end) as product_qty, sum(case when ai.type in ('out_refund','in_invoice') then ail.quantity*ail.price_unit * -1 else ail.quantity*ail.price_unit end) as price_total, sum(case when ai.type in ('out_refund','in_invoice') then ai.amount_total * -1 else ai.amount_total end) as price_total_tax, (case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*ail.price_unit*-1) else sum(ail.quantity*ail.price_unit) end)/(case when ai.type in ('out_refund','in_invoice') then sum(ail.quantity*u.factor*-1) else sum(ail.quantity*u.factor) end) as price_average, sum((select extract(epoch from avg(date_trunc('day',aml.date_created)-date_trunc('day',l.create_date)))/(24*60*60)::decimal(16,2) from account_move_line as aml left join account_invoice as a ON (a.move_id=aml.move_id) left join account_invoice_line as l ON (a.id=l.invoice_id) where a.id=ai.id)) as delay_to_pay, (case when ai.type in ('out_refund','in_invoice') then ai.residual * -1 else ai.residual end)/(select count(l.*) from account_invoice_line as l left join account_invoice as a ON (a.id=l.invoice_id) where a.id=ai.id) as residual from account_invoice_line as ail left join account_invoice as ai ON (ai.id=ail.invoice_id) left join product_template pt on (pt.id=ail.product_id) left join product_uom u on (u.id=ail.uos_id) group by ail.product_id, ai.date_invoice, ai.id, to_char(ai.date_invoice, 'YYYY'), to_char(ai.date_invoice, 'MM'), to_char(ai.date_invoice, 'YYYY-MM-DD'), ai.partner_id, ai.payment_term, ai.period_id, u.name, ai.currency_id, ai.journal_id, ai.fiscal_position, ai.user_id, ai.company_id, ai.type, ai.state, pt.categ_id, ai.date_due, ai.address_contact_id, ai.address_invoice_id, ai.account_id, ai.partner_bank_id, ai.residual, ai.amount_total ) """) |
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.account') year_pool = db_pool.get('account.fiscalyear') |
|
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), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.category_id.id vals_line['account_id'] = acc_id res = obj.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 vals_line['product_uom_id'] = result['product_uom_id'] timeline_id = obj.create(cr, uid, vals_line, {}) # Compute based on pricetype 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, {}) vals['hr_analytic_timesheet_id'] = timeline_id return super(project_work,self).create(cr, uid, vals, *args, **kwargs) |
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), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.category_id.id vals_line['account_id'] = acc_id res = obj.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 vals_line['product_uom_id'] = result['product_uom_id'] timeline_id = obj.create(cr, uid, vals_line, {}) # Compute based on pricetype 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, {}) vals['hr_analytic_timesheet_id'] = timeline_id return super(project_work,self).create(cr, uid, vals, *args, **kwargs) |
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), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.category_id.id vals_line['account_id'] = acc_id res = obj.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 vals_line['product_uom_id'] = result['product_uom_id'] timeline_id = obj.create(cr, uid, vals_line, {}) # Compute based on pricetype 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, {}) vals['hr_analytic_timesheet_id'] = timeline_id return super(project_work,self).create(cr, uid, vals, *args, **kwargs) |
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), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.category_id.id vals_line['account_id'] = acc_id res = obj.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 vals_line['product_uom_id'] = result['product_uom_id'] timeline_id = obj.create(cr, uid, vals_line, {}) # Compute based on pricetype 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, {}) vals['hr_analytic_timesheet_id'] = timeline_id return super(project_work,self).create(cr, uid, vals, *args, **kwargs) |
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), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.category_id.id vals_line['account_id'] = acc_id res = obj.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) vals_line['general_account_id'] = result['general_account_id'] vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 vals_line['product_uom_id'] = result['product_uom_id'] timeline_id = obj.create(cr, uid, vals_line, {}) # Compute based on pricetype 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, {}) vals['hr_analytic_timesheet_id'] = timeline_id return super(project_work,self).create(cr, uid, vals, *args, **kwargs) |
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, 'amount_exist': 0, 'amount_percent': 0.0 } for f in att.browse(cr, uid, fids, context=context): res[id] = { 'amount_required': res[id]['amount_required'] + 1, 'amount_exist': res[id]['amount_exist'] + (f.state<>'draft') and 1 or 0, } if res[id]['amount_required']: res[id]['amount_percent'] = float(res[id]['amount_exist']*100) / res[id]['amount_required'] return res |
|
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 = {}.fromkeys(ids, 0.0) if not ids: return res |
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 = {}.fromkeys(ids, 0.0) if not ids: return res |
|
'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, context=context): content += (line.notes or '') l = line if line.order_id.project_id: content+="\n\n"+line.order_id.project_id.complete_name # Creating a project for task.Project is created from Procurement. proj_name = tools.ustr(procurement.name) proj_exist_id = self.pool.get('project.project').search(cr, uid, [('name','=',proj_name)], context=context) if not proj_exist_id: project_id = self.pool.get('project.project').create(cr, uid, {'name':proj_name}) else: project_id = proj_exist_id[0] self.write(cr, uid, [procurement.id], {'state':'running'}) task_id = self.pool.get('project.task').create(cr, uid, { 'name': '%s:%s' %(procurement.product_id.name or procurement.origin, procurement.name or ''), 'date_deadline': procurement.date_planned, 'planned_hours': procurement.product_qty, 'remaining_hours': procurement.product_qty, 'user_id': procurement.product_id.product_manager.id, 'notes': "b"+(l and l.order_id.note or ''), 'procurement_id': procurement.id, 'description': content, 'date_deadline': procurement.date_planned, 'state': 'draft', 'partner_id': l and l.order_id.partner_id.id or False, 'company_id': procurement.company_id.id, 'project_id': project_id, },context=context) return task_id |
|
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, context=context): content += (line.notes or '') l = line if line.order_id.project_id: content+="\n\n"+line.order_id.project_id.complete_name # Creating a project for task.Project is created from Procurement. proj_name = tools.ustr(procurement.name) proj_exist_id = self.pool.get('project.project').search(cr, uid, [('name','=',proj_name)], context=context) if not proj_exist_id: project_id = self.pool.get('project.project').create(cr, uid, {'name':proj_name}) else: project_id = proj_exist_id[0] self.write(cr, uid, [procurement.id], {'state':'running'}) task_id = self.pool.get('project.task').create(cr, uid, { 'name': '%s:%s' %(procurement.product_id.name or procurement.origin, procurement.name or ''), 'date_deadline': procurement.date_planned, 'planned_hours': procurement.product_qty, 'remaining_hours': procurement.product_qty, 'user_id': procurement.product_id.product_manager.id, 'notes': "b"+(l and l.order_id.note or ''), 'procurement_id': procurement.id, 'description': content, 'date_deadline': procurement.date_planned, 'state': 'draft', 'partner_id': l and l.order_id.partner_id.id or False, 'company_id': procurement.company_id.id, 'project_id': project_id, },context=context) return task_id |
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, context=context): content += (line.notes or '') l = line if line.order_id.project_id: content+="\n\n"+line.order_id.project_id.complete_name # Creating a project for task.Project is created from Procurement. proj_name = tools.ustr(procurement.name) proj_exist_id = self.pool.get('project.project').search(cr, uid, [('name','=',proj_name)], context=context) if not proj_exist_id: project_id = self.pool.get('project.project').create(cr, uid, {'name':proj_name}) else: project_id = proj_exist_id[0] self.write(cr, uid, [procurement.id], {'state':'running'}) task_id = self.pool.get('project.task').create(cr, uid, { 'name': '%s:%s' %(procurement.product_id.name or procurement.origin, procurement.name or ''), 'date_deadline': procurement.date_planned, 'planned_hours': procurement.product_qty, 'remaining_hours': procurement.product_qty, 'user_id': procurement.product_id.product_manager.id, 'notes': "b"+(l and l.order_id.note or ''), 'procurement_id': procurement.id, 'description': content, 'date_deadline': procurement.date_planned, 'state': 'draft', 'partner_id': l and l.order_id.partner_id.id or False, 'company_id': procurement.company_id.id, 'project_id': project_id, },context=context) return task_id |
'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, context=context): content += (line.notes or '') l = line if line.order_id.project_id: content+="\n\n"+line.order_id.project_id.complete_name # Creating a project for task.Project is created from Procurement. proj_name = tools.ustr(procurement.name) proj_exist_id = self.pool.get('project.project').search(cr, uid, [('name','=',proj_name)], context=context) if not proj_exist_id: project_id = self.pool.get('project.project').create(cr, uid, {'name':proj_name}) else: project_id = proj_exist_id[0] self.write(cr, uid, [procurement.id], {'state':'running'}) task_id = self.pool.get('project.task').create(cr, uid, { 'name': '%s:%s' %(procurement.product_id.name or procurement.origin, procurement.name or ''), 'date_deadline': procurement.date_planned, 'planned_hours': procurement.product_qty, 'remaining_hours': procurement.product_qty, 'user_id': procurement.product_id.product_manager.id, 'notes': "b"+(l and l.order_id.note or ''), 'procurement_id': procurement.id, 'description': content, 'date_deadline': procurement.date_planned, 'state': 'draft', 'partner_id': l and l.order_id.partner_id.id or False, 'company_id': procurement.company_id.id, 'project_id': project_id, },context=context) return task_id |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.