bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def action_move_line_create(self, cr, uid, ids, *args): journal_pool = self.pool.get('account.journal') sequence_pool = self.pool.get('ir.sequence') move_pool = self.pool.get('account.move') move_line_pool = self.pool.get('account.move.line') analytic_pool = self.pool.get('account.analytic.line') currency_pool = self.pool.get('res.currency') invoice_pool = self.pool.get('account.invoice') for inv in self.browse(cr, uid, ids): if inv.move_id: continue
def action_move_line_create(self, cr, uid, ids, *args): journal_pool = self.pool.get('account.journal') sequence_pool = self.pool.get('ir.sequence') move_pool = self.pool.get('account.move') move_line_pool = self.pool.get('account.move.line') analytic_pool = self.pool.get('account.analytic.line') currency_pool = self.pool.get('res.currency') invoice_pool = self.pool.get('account.invoice') for inv in self.browse(cr, uid, ids): if inv.move_id: continue
470,600
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' }
deffields_view_get(self,cr,uid,view_id=None,view_type='form',context=None,toolbar=False,submenu=False):"""Returnsviewsandfieldsforcurrentmodelwhereviewwilldependon{view_type}.@paramcr:Adatabasecursor@paramuser:IDoftheusercurrentlyloggedin@paramview_id:listoffields,whichrequiredtoreadsignatures@paramview_type:definesaviewtype.itcanbeoneof(form,tree,graph,calender,gantt,search,mdx)@paramcontext:contextarguments,likelang,timezone@paramtoolbar:containsalistofreports,wizards,andlinksrelatedtocurrentmodel@return:Returnsadictthatcontainsdefinitionforfields,views,andtoolbars"""data_pool=self.pool.get('ir.model.data')journal_pool=self.pool.get('account.journal')voucher_type={'sale':'view_sale_receipt_form','purchase':'view_purchase_receipt_form','payment':'view_vendor_payment_form','receipt':'view_vendor_receipt_form'}
470,601
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' }
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' }
470,602
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' }
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' }
470,603
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' }
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """ Returns views and fields for current model where view will depend on {view_type}. @param cr: A database cursor @param user: ID of the user currently logged in @param view_id: list of fields, which required to read signatures @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx) @param context: context arguments, like lang, time zone @param toolbar: contains a list of reports, wizards, and links related to current model @return: Returns a dict that contains definition for fields, views, and toolbars """ data_pool = self.pool.get('ir.model.data') journal_pool = self.pool.get('account.journal') voucher_type = { 'sale':'view_sale_receipt_form', 'purchase':'view_purchase_receipt_form', 'payment':'view_vendor_payment_form', 'receipt':'view_vendor_receipt_form' }
470,604
def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', noupdate=False): '''Import csv file : quote: " delimiter: , encoding: utf-8''' if not idref: idref={} logger = logging.getLogger('init') model = ('.'.join(fname.split('.')[:-1]).split('-'))[0] #remove folder path from model head, model = os.path.split(model) pool = pooler.get_pool(cr.dbname) input = cStringIO.StringIO(csvcontent) #FIXME reader = csv.reader(input, quotechar='"', delimiter=',') fields = reader.next() fname_partial = "" if config.get('import_partial'): fname_partial = module + '/'+ fname if not os.path.isfile(config.get('import_partial')): pickle.dump({}, file(config.get('import_partial'),'w+')) else: data = pickle.load(file(config.get('import_partial'))) if fname_partial in data: if not data[fname_partial]: return else: for i in range(data[fname_partial]): reader.next() if not (mode == 'init' or 'id' in fields): logger.error("Import specification does not contain 'id' and we are in init mode, Cannot continue.") return uid = 1 datas = [] for line in reader: if (not line) or not reduce(lambda x,y: x or y, line) : continue try: datas.append(map(lambda x: misc.ustr(x), line)) except: logger.error("Cannot import the line: %s", line) pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial) if config.get('import_partial'): data = pickle.load(file(config.get('import_partial'))) data[fname_partial] = 0 pickle.dump(data, file(config.get('import_partial'),'wb')) cr.commit()
def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', noupdate=False): '''Import csv file : quote: " delimiter: , encoding: utf-8''' if not idref: idref={} logger = logging.getLogger('init') model = ('.'.join(fname.split('.')[:-1]).split('-'))[0] #remove folder path from model head, model = os.path.split(model) pool = pooler.get_pool(cr.dbname) input = cStringIO.StringIO(csvcontent) #FIXME reader = csv.reader(input, quotechar='"', delimiter=',') fields = reader.next() fname_partial = "" if config.get('import_partial'): fname_partial = module + '/'+ fname if not os.path.isfile(config.get('import_partial')): pickle.dump({}, file(config.get('import_partial'),'w+')) else: data = pickle.load(file(config.get('import_partial'))) if fname_partial in data: if not data[fname_partial]: return else: for i in range(data[fname_partial]): reader.next() if not (mode == 'init' or 'id' in fields): logger.error("Import specification does not contain 'id' and we are in init mode, Cannot continue.") return uid = 1 datas = [] for line in reader: if (not line) or not reduce(lambda x,y: x or y, line) : continue try: datas.append(map(lambda x: misc.ustr(x), line)) except: logger.error("Cannot import the line: %s", line) result, rows, warning_msg, dummy = pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial) if result < 0: raise except_orm(_('Module loading failed'), _('Loading %s/%s failed:\n %s') % (module, fname, warning_msg)) if config.get('import_partial'): data = pickle.load(file(config.get('import_partial'))) data[fname_partial] = 0 pickle.dump(data, file(config.get('import_partial'),'wb')) cr.commit()
470,605
def _create_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.phonecall') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') partner_ids = [] partner_id = False contact_id = False for case in case_obj.browse(cr, uid, data['ids']): if data['form']['action'] == 'create': 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.name, 'phone': case.phone, 'mobile': case.mobile, 'email': case.email_from })
def _create_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.phonecall') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') partner_ids = [] partner_id = False contact_id = False for case in case_obj.browse(cr, uid, data['ids']): if data['form']['action'] == 'create': partner_id = partner_obj.create(cr, uid, { 'name': case.partner_contact 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.name, 'phone': case.phone, 'mobile': case.mobile, 'email': case.email_from })
470,606
def _create_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.phonecall') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') partner_ids = [] partner_id = False contact_id = False for case in case_obj.browse(cr, uid, data['ids']): if data['form']['action'] == 'create': 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.name, 'phone': case.phone, 'mobile': case.mobile, 'email': case.email_from })
def _create_partner(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) case_obj = pool.get('crm.phonecall') partner_obj = pool.get('res.partner') contact_obj = pool.get('res.partner.address') partner_ids = [] partner_id = False contact_id = False for case in case_obj.browse(cr, uid, data['ids']): if data['form']['action'] == 'create': 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.name, 'phone': case.partner_phone, 'mobile': case.partner_mobile, 'email': case.email_from })
470,607
def action_invoice(self, cr, uid, ids, context=None): """Create a invoice of order """ inv_ref = self.pool.get('account.invoice') inv_line_ref = self.pool.get('account.invoice.line') product_obj = self.pool.get('product.product') inv_ids = []
def action_invoice(self, cr, uid, ids, context=None): """Create a invoice of order """ inv_ref = self.pool.get('account.invoice') inv_line_ref = self.pool.get('account.invoice.line') product_obj = self.pool.get('product.product') inv_ids = []
470,608
def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type)
def _rec_convert(ids): if field_obj == table: return ids return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type)
470,609
def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] res = [] for r in self.browse(cr, uid, ids): funct = r.function_id and (", " + r.function_id.name) or "" res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, [r.contact_id.id])[0][1] + funct )) return res
def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] res = [] for r in self.browse(cr, uid, ids): funct = r.function_id and (", " + r.function_id.name) or "" res.append((r.id, self.pool.get('res.partner.contact').name_get(cr, uid, [r.contact_id.id])[0][1] + funct)) return res
470,610
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): job_ids = [] for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
470,611
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0] == 'address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
470,612
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' elif arg[0] == 'contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
470,613
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): for arg in args: if arg[0]=='address_id': self._order = 'sequence_partner' if arg[0]=='contact_id': self._order = 'sequence_contact' return super(res_partner_job,self).search(cr, user, args, offset, limit, order, context, count)
470,614
def rounding(f, r): if not r: return f return round(f / r) * r
def rounding(f, r): if not r: return f return round(f / r) * r
470,615
def _production_date(self, cr, uid, ids, prop, unknow_none, context={}): """ Finds production planned date. @param prop: Name of field. @param unknow_none: @return: Dictionary of values. """ result = {} for prod in self.browse(cr, uid, ids, context=context): result[prod.id] = prod.date_planned[:10] return result
def _production_date(self, cr, uid, ids, prop, unknow_none, context={}): """ Finds production planned date. @param prop: Name of field. @param unknow_none: @return: Dictionary of values. """ result = {} for prod in self.browse(cr, uid, ids, context=context): result[prod.id] = prod.date_planned[:10] return result
470,616
def _check_dates(self, cr, uid, ids, context=None): 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
def _check_dates(self, cr, uid, ids, context=None): 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
470,617
def _is_template(self, cr, uid, ids, field_name, arg, context=None): res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = True if task.project_id: if task.project_id.active == False or task.project_id.state == 'template': res[task.id] = False return res
def _is_template(self, cr, uid, ids, field_name, arg, context=None): res = {} for task in self.browse(cr, uid, ids, context=context): res[task.id] = True if task.project_id: if task.project_id.active == False or task.project_id.state == 'template': res[task.id] = False return res
470,618
def get_childs(self, uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get childs: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True)
def get_childs(self, uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get childs: %s' % uri) cr, uid, pool, dbname, uri2 = self.get_cr(uri, allow_last=True)
470,619
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = self.pool.get('ir.model.access') if (res['type'] == 'search') and access_pool.check_groups(cr, uid, "project_gtd.group_project_getting"): tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[])) search_extended ='''<newline/><group col="%d" expand="%d" string="%s">''' % (len(tt)+7,1,_('Getting Things Done')) search_extended += '''<filter domain="[('timebox_id','=', False)]" context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Undefined Timebox" string="%s"/>''' % (_('Inbox'),) search_extended += '''<filter context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Getting things done" string="%s"/>''' % (_('GTD'),) search_extended += '''<separator orientation="vertical"/>''' for time in tt: if time.icon: icon = time.icon else : icon="" search_extended += '''<filter domain="[('timebox_id','=', ''' + str(time.id) + ''')]" icon="''' + icon + '''" string="''' + time.name + '''" context="{'gtd_visible':True, 'user_invisible': True}"/>''' search_extended += ''' <separator orientation="vertical"/> <field name="context_id" select="1" widget="selection"/> </group> </search> ''' if search_extended: res['arch'] = unicode(res['arch'], 'utf8').replace('</search>', search_extended) attrs_sel = self.pool.get('project.gtd.context').name_search(cr, uid, '', [], context=context) context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id']) context_id_info['context_id']['selection'] = attrs_sel res['fields'].update(context_id_info) return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = self.pool.get('ir.model.access') if (res['type'] == 'search') and access_pool.check_groups(cr, uid, "project_gtd.group_project_getting"): tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[]), context=context) search_extended ='''<newline/><group col="%d" expand="%d" string="%s">''' % (len(tt)+7,1,_('Getting Things Done')) search_extended += '''<filter domain="[('timebox_id','=', False)]" context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Undefined Timebox" string="%s"/>''' % (_('Inbox'),) search_extended += '''<filter context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Getting things done" string="%s"/>''' % (_('GTD'),) search_extended += '''<separator orientation="vertical"/>''' for time in tt: if time.icon: icon = time.icon else : icon="" search_extended += '''<filter domain="[('timebox_id','=', ''' + str(time.id) + ''')]" icon="''' + icon + '''" string="''' + time.name + '''" context="{'gtd_visible':True, 'user_invisible': True}"/>''' search_extended += ''' <separator orientation="vertical"/> <field name="context_id" select="1" widget="selection"/> </group> </search> ''' if search_extended: res['arch'] = unicode(res['arch'], 'utf8').replace('</search>', search_extended) attrs_sel = self.pool.get('project.gtd.context').name_search(cr, uid, '', [], context=context) context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id']) context_id_info['context_id']['selection'] = attrs_sel res['fields'].update(context_id_info) return res
470,620
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = self.pool.get('ir.model.access') if (res['type'] == 'search') and access_pool.check_groups(cr, uid, "project_gtd.group_project_getting"): tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[])) search_extended ='''<newline/><group col="%d" expand="%d" string="%s">''' % (len(tt)+7,1,_('Getting Things Done')) search_extended += '''<filter domain="[('timebox_id','=', False)]" context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Undefined Timebox" string="%s"/>''' % (_('Inbox'),) search_extended += '''<filter context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Getting things done" string="%s"/>''' % (_('GTD'),) search_extended += '''<separator orientation="vertical"/>''' for time in tt: if time.icon: icon = time.icon else : icon="" search_extended += '''<filter domain="[('timebox_id','=', ''' + str(time.id) + ''')]" icon="''' + icon + '''" string="''' + time.name + '''" context="{'gtd_visible':True, 'user_invisible': True}"/>''' search_extended += ''' <separator orientation="vertical"/> <field name="context_id" select="1" widget="selection"/> </group> </search> ''' if search_extended: res['arch'] = unicode(res['arch'], 'utf8').replace('</search>', search_extended) attrs_sel = self.pool.get('project.gtd.context').name_search(cr, uid, '', [], context=context) context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id']) context_id_info['context_id']['selection'] = attrs_sel res['fields'].update(context_id_info) return res
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(project_task,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) search_extended = False timebox_obj = self.pool.get('project.gtd.timebox') access_pool = self.pool.get('ir.model.access') if (res['type'] == 'search') and access_pool.check_groups(cr, uid, "project_gtd.group_project_getting"): tt = timebox_obj.browse(cr, uid, timebox_obj.search(cr,uid,[])) search_extended ='''<newline/><group col="%d" expand="%d" string="%s">''' % (len(tt)+7,1,_('Getting Things Done')) search_extended += '''<filter domain="[('timebox_id','=', False)]" context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Undefined Timebox" string="%s"/>''' % (_('Inbox'),) search_extended += '''<filter context="{'set_editable':True,'set_visible':True,'gtd_visible':True,'user_invisible':True}" icon="gtk-new" help="Getting things done" string="%s"/>''' % (_('GTD'),) search_extended += '''<separator orientation="vertical"/>''' for time in tt: if time.icon: icon = time.icon else : icon="" search_extended += '''<filter domain="[('timebox_id','=', ''' + str(time.id) + ''')]" icon="''' + icon + '''" string="''' + time.name + '''" context="{'gtd_visible':True, 'user_invisible': True}"/>''' search_extended += ''' <separator orientation="vertical"/> <field name="context_id" select="1" widget="selection"/> </group> </search> ''' if search_extended: res['arch'] = unicode(res['arch'], 'utf8').replace('</search>', search_extended) attrs_sel = self.pool.get('project.gtd.context').name_search(cr, uid, '', [], context=context) context_id_info = self.pool.get('project.task').fields_get(cr, uid, ['context_id'], context=context) context_id_info['context_id']['selection'] = attrs_sel res['fields'].update(context_id_info) return res
470,621
def _sum_credit(self, period_id, journal_id): self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0
def _sum_credit(self, period_id, journal_id): self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id=%s and state<>\'draft\'', (period_id, journal_id)) return self.cr.fetchone()[0] or 0.0
470,622
def open_wiki_page(self, cr, uid, ids, context):
def open_wiki_page(self, cr, uid, ids, context):
470,623
def copy_data(self, cr, uid, id, default=None, context=None):
def copy_data(self, cr, uid, id, default=None, context=None):
470,624
def create_history(self, cr, uid, ids, vals, context=None): history_id = False history = self.pool.get('wiki.wiki.history') if vals.get('text_area'): res = { 'minor_edit': vals.get('minor_edit', True), 'text_area': vals.get('text_area', ''), 'write_uid': uid, 'wiki_id': ids[0], 'summary':vals.get('summary', '') } history_id = history.create(cr, uid, res) return history_id
def create_history(self, cr, uid, ids, vals, context=None): history_id = False history = self.pool.get('wiki.wiki.history') if vals.get('text_area'): res = { 'minor_edit': vals.get('minor_edit', True), 'text_area': vals.get('text_area', ''), 'write_uid': uid, 'wiki_id': ids[0], 'summary':vals.get('summary', '') } history_id = history.create(cr, uid, res) return history_id
470,625
def create(self, cr, uid, vals, context=None):
def create(self, cr, uid, vals, context=None):
470,626
def write(self, cr, uid, ids, vals, context=None):
def write(self, cr, uid, ids, vals, context=None):
470,627
def set_context(self, objects, data, ids, report_type=None): new_ids = ids obj_move = self.pool.get('account.move.line') self.sortby = data['form'].get('sortby', 'sort_date') self.query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context',{})) self.init_query = obj_move._query_get(cr, uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) self.init_balance = data['form']['initial_balance'] self.display_account = data['form']['display_account'] self.target_move = data['form'].get('target_move', 'all') ctx = self.context.copy() ctx['fiscalyear'] = data['form']['fiscalyear_id'] if data['form']['filter'] == 'filter_period': ctx['periods'] = data['form']['periods'] elif data['form']['filter'] == 'filter_date': ctx['date_from'] = data['form']['date_from'] ctx['date_to'] = data['form']['date_to'] ctx['state'] = data['form']['target_move'] self.context.update(ctx) if (data['model'] == 'ir.ui.menu'): new_ids = [data['form']['chart_account_id']] objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) return super(general_ledger, self).set_context(objects, data, new_ids, report_type=report_type)
def set_context(self, objects, data, ids, report_type=None): new_ids = ids obj_move = self.pool.get('account.move.line') self.sortby = data['form'].get('sortby', 'sort_date') self.query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context',{})) self.init_query = obj_move._query_get(self.cr, self.uid, obj='l', context=data['form'].get('used_context_initial_bal', {})) self.init_balance = data['form']['initial_balance'] self.display_account = data['form']['display_account'] self.target_move = data['form'].get('target_move', 'all') ctx = self.context.copy() ctx['fiscalyear'] = data['form']['fiscalyear_id'] if data['form']['filter'] == 'filter_period': ctx['periods'] = data['form']['periods'] elif data['form']['filter'] == 'filter_date': ctx['date_from'] = data['form']['date_from'] ctx['date_to'] = data['form']['date_to'] ctx['state'] = data['form']['target_move'] self.context.update(ctx) if (data['model'] == 'ir.ui.menu'): new_ids = [data['form']['chart_account_id']] objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) return super(general_ledger, self).set_context(objects, data, new_ids, report_type=report_type)
470,628
def _sheet(self, cursor, user, ids, name, args, context): sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') cursor.execute("SELECT a.id, COALESCE(MAX(s.id), 0) \ FROM hr_timesheet_sheet_sheet s \ LEFT JOIN (hr_attendance a \ LEFT JOIN hr_employee e \ ON (a.employee_id = e.id)) \ ON (s.date_to >= date_trunc('day',a.name) \ AND s.date_from <= a.name \ AND s.user_id = e.user_id) \ WHERE a.id in (" + ",".join([str(x) for x in ids]) + ") \ GROUP BY a.id") res = dict(cursor.fetchall()) sheet_names = {} for sheet_id, name in sheet_obj.name_get(cursor, user, res.values(), context=context): sheet_names[sheet_id] = name for line_id in {}.fromkeys(ids): sheet_id = res.get(line_id, False) if sheet_id: res[line_id] = (sheet_id, sheet_names[sheet_id]) else: res[line_id] = False return res
def _sheet(self, cursor, user, ids, name, args, context): sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') cursor.execute("SELECT a.id, COALESCE(MAX(s.id), 0) \ FROM hr_timesheet_sheet_sheet s \ LEFT JOIN (hr_attendance a \ LEFT JOIN hr_employee e \ ON (a.employee_id = e.id)) \ ON (s.date_to >= date_trunc('day',a.name) \ AND s.date_from <= a.name \ AND s.user_id = r.user_id) \ WHERE a.id in (" + ",".join([str(x) for x in ids]) + ") \ GROUP BY a.id") res = dict(cursor.fetchall()) sheet_names = {} for sheet_id, name in sheet_obj.name_get(cursor, user, res.values(), context=context): sheet_names[sheet_id] = name for line_id in {}.fromkeys(ids): sheet_id = res.get(line_id, False) if sheet_id: res[line_id] = (sheet_id, sheet_names[sheet_id]) else: res[line_id] = False return res
470,629
def createInstance(cls, pool, module, cr): parent_names = getattr(cls, '_inherit', None) if parent_names: if isinstance(parent_names, (str, unicode)): name = cls._name or parent_names parent_names = [parent_names] else: name = cls._name if not name: raise TypeError('_name is mandatory in case of multiple inheritance')
def createInstance(cls, pool, module, cr): parent_names = getattr(cls, '_inherit', None) if parent_names: if isinstance(parent_names, (str, unicode)): name = cls._name or parent_names parent_names = [parent_names] else: name = cls._name if not name: raise TypeError('_name is mandatory in case of multiple inheritance')
470,630
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate)
def _get_conversion_rate(self, cr, uid, from_currency, to_currency, context=None): if context is None: context = {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate)
470,631
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate)
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate)
470,632
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) rate = to_currency.rate/from_currency.rate if account and (account.currency_mode=='average') and account.currency_id: q = self.pool.get('account.move.line')._query_get(cr, uid, context=context) cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \ 'where l.currency_id=%s and l.account_id=%s and '+q, (account.currency_id.id,account.id,)) tot1,tot2 = cr.fetchone() if tot2 and not account_invert: rate = float(tot1)/float(tot2) elif tot1 and account_invert: rate = float(tot2)/float(tot1) if to_currency_id==from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate)
def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None, account=None, account_invert=False): if context is None: context = {} if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: date = context.get('date', time.strftime('%Y-%m-%d')) if from_currency['rate'] == 0: currency_symbol = from_currency.symbol else: currency_symbol = to_currency.symbol raise osv.except_osv(_('Error'), _('No rate found \n' \ 'for the currency: %s \n' \ 'at the date: %s') % (currency_symbol, date)) return to_currency.rate/from_currency.rate def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context=None): if not from_currency_id: from_currency_id = to_currency_id if not to_currency_id: to_currency_id = from_currency_id xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if to_currency_id == from_currency_id: if round: return self.round(cr, uid, to_currency, from_amount) else: return from_amount else: if round: return self.round(cr, uid, to_currency, from_amount * rate) else: return (from_amount * rate)
470,633
def _get_in_visible_answer_type(self,cr, uid, context={}): return context.get('in_visible_answer_type', False)
def _get_in_visible_answer_type(self,cr, uid, context={}): return context.get('in_visible_answer_type', False)
470,634
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
470,635
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
470,636
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
470,637
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
470,638
def compute_refund(self, cr, uid, ids, mode, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param ids: the account invoice refund’s ID or list of IDs
defcompute_refund(self,cr,uid,ids,mode,context=None):"""@paramcr:thecurrentrow,fromthedatabasecursor,@paramuid:thecurrentuser’sIDforsecuritychecks,@paramids:theaccountinvoicerefund’sIDorlistofIDs
470,639
def action_traceability(self, cr, uid, ids, context={}): """ It traces the information of a product @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: A dictionary of values """
def action_traceability(self, cr, uid, ids, context={}): """ It traces the information of a product @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: A dictionary of values """
470,640
def action_ship_create(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") picking_id = False company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = False for line in order.order_line: proc_id = False date_planned = datetime.now() + relativedelta(days=line.delay or 0.0) date_planned = (date_planned - timedelta(days=company.security_lead)).strftime('%Y-%m-%d %H:%M:%S')
def if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) action_ship_create(self, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) cr, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) uid, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) ids, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) *args): if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) wf_service if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) netsvc.LocalService("workflow") if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) picking_id if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) False if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) company if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) self.pool.get('res.users').browse(cr, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) uid, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) uid).company_id if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) for if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) order if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) in if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) self.browse(cr, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) uid, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) ids, if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) context={}): if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) proc_ids if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) [] if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) output_id if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) order.shop_id.warehouse_id.lot_output_id.id if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) picking_id if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) False if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) for if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) line if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) in if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) order.order_line: if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) proc_id if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) False if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) date_planned if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) datetime.now() if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) + if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) relativedelta(days=line.delay if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) or if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) 0.0) if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) date_planned if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) = if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) (date_planned if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) - if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) timedelta(days=company.security_lead)).strftime('%Y-%m-%d if line.state == 'exception': for pick in order.picking_ids: for moves in pick.move_lines: if moves.state == 'cancel': move_obj.write(cr, uid, [move_id], {'product_qty': moves.product_qty}) proc_obj.write(cr, uid, [proc_id], {'product_qty': moves.product_qty, 'product_uos_qty': moves.product_qty}) %H:%M:%S')
470,641
def action_ship_create(self, cr, uid, ids, *args): wf_service = netsvc.LocalService("workflow") picking_id = False company = self.pool.get('res.users').browse(cr, uid, uid).company_id for order in self.browse(cr, uid, ids, context={}): proc_ids = [] output_id = order.shop_id.warehouse_id.lot_output_id.id picking_id = False for line in order.order_line: proc_id = False date_planned = datetime.now() + relativedelta(days=line.delay or 0.0) date_planned = (date_planned - timedelta(days=company.security_lead)).strftime('%Y-%m-%d %H:%M:%S')
defval['shipped'] = False action_ship_create(self,val['shipped'] = False cr,val['shipped'] = False uid,val['shipped'] = False ids,val['shipped'] = False *args):val['shipped'] = False wf_serviceval['shipped'] = False =val['shipped'] = False netsvc.LocalService("workflow")val['shipped'] = False picking_idval['shipped'] = False =val['shipped'] = False Falseval['shipped'] = False companyval['shipped'] = False =val['shipped'] = False self.pool.get('res.users').browse(cr,val['shipped'] = False uid,val['shipped'] = False uid).company_idval['shipped'] = False forval['shipped'] = False orderval['shipped'] = False inval['shipped'] = False self.browse(cr,val['shipped'] = False uid,val['shipped'] = False ids,val['shipped'] = False context={}):val['shipped'] = False proc_idsval['shipped'] = False =val['shipped'] = False []val['shipped'] = False output_idval['shipped'] = False =val['shipped'] = False order.shop_id.warehouse_id.lot_output_id.idval['shipped'] = False picking_idval['shipped'] = False =val['shipped'] = False Falseval['shipped'] = False forval['shipped'] = False lineval['shipped'] = False inval['shipped'] = False order.order_line:val['shipped'] = False proc_idval['shipped'] = False =val['shipped'] = False Falseval['shipped'] = False date_plannedval['shipped'] = False =val['shipped'] = False datetime.now()val['shipped'] = False +val['shipped'] = False relativedelta(days=line.delayval['shipped'] = False orval['shipped'] = False 0.0)val['shipped'] = False date_plannedval['shipped'] = False =val['shipped'] = False (date_plannedval['shipped'] = False -val['shipped'] = False timedelta(days=company.security_lead)).strftime('%Y-%m-%dval['shipped'] = False %H:%M:%S')
470,642
def do_check(self, cr, uid, action, obj, context={}): """ @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 context: A standard dictionary for contextual values""" ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context)
def do_check(self, cr, uid, action, obj, context={}): """ @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 context: A standard dictionary for contextual values""" ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context)
470,643
def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field]) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = data.get(map_field)[1] elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field]).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent
def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field].encode('utf8')) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = data.get(map_field)[1] elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field]).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent
470,644
def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field]) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = data.get(map_field)[1] elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field]).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent
def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field]) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = (data.get(map_field)[1]).encode('utf8') elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field]).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent
470,645
def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field]) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = data.get(map_field)[1] elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field]).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent
def create_ics(self, cr, uid, datas, name, ical, context=None): if not datas: model = context.get('model', None) war_str = "No data available" + (model and " for " + model) or "" raise osv.except_osv(_('Warning !'), _(war_str)) for data in datas: vevent = ical.add(name) for field in self.__attribute__.keys(): map_field = self.ical_get(field, 'field') map_type = self.ical_get(field, 'type') if map_field in data.keys(): if field == 'uid': model = context.get('model', None) if not model: continue uidval = openobjectid2uid(cr, data[map_field], model) model_obj = self.pool.get(model) r_ids = [] if model_obj._columns.get('recurrent_uid', None): cr.execute('select id from %s where recurrent_uid=%s' % (model_obj._table, data[map_field])) r_ids = map(lambda x: x[0], cr.fetchall()) if r_ids: rdata = self.pool.get(model).read(cr, uid, r_ids) rcal = self.export_cal(cr, uid, rdata, context=context) for revents in rcal.contents['vevent']: ical.contents['vevent'].append(revents) if data.get('recurrent_uid', None): uidval = openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: model = self.__attribute__[field].get('object', False) attendee_obj = self.pool.get('basic.calendar.attendee') vevent = attendee_obj.export_cal(cr, uid, model, \ data[map_field], vevent, context=context) elif field == 'valarm' and data[map_field]: model = self.__attribute__[field].get('object', False) alarm_obj = self.pool.get('basic.calendar.alarm') vevent = alarm_obj.export_cal(cr, uid, model, \ data[map_field][0], vevent, context=context) elif data[map_field]: if map_type in ("char", "text"): vevent.add(field).value = str(data[map_field]) elif map_type in ('datetime', 'date') and data[map_field]: if field in ('exdate'): vevent.add(field).value = [parser.parse(data[map_field])] else: vevent.add(field).value = parser.parse(data[map_field]) elif map_type == "timedelta": vevent.add(field).value = timedelta(hours=data[map_field]) elif map_type == "many2one": vevent.add(field).value = data.get(map_field)[1] elif map_type in ("float", "integer"): vevent.add(field).value = str(data.get(map_field)) elif map_type == "selection": if not self.ical_get(field, 'mapping'): vevent.add(field).value = (data[map_field].encode('utf8')).upper() else: for key1, val1 in self.ical_get(field, 'mapping').items(): if val1 == data[map_field]: vevent.add(field).value = key1 return vevent
470,646
def _get_objects(self, empty_acc): if self.read_data: return self.read_data self.empty_acc = empty_acc self.read_data = [] self.get_children(self.ids)
def_get_objects(self,empty_acc):ifself.read_data:returnself.read_dataself.empty_acc=empty_accself.read_data=[]self.get_children(self.ids)
470,647
def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id]
def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id]
470,648
def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id]
def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id]
470,649
def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id]
def _move_sum(self, account_id, date1, date2, option): if account_id not in self.acc_data_dict: account_analytic_obj = self.pool.get('account.analytic.account') ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])]) self.acc_data_dict[account_id] = ids else: ids = self.acc_data_dict[account_id]
470,650
def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0
def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0
470,651
def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0
def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0
470,652
def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0
def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0
470,653
def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0
def _sum_all(self, accounts, date1, date2, option): ids = map(lambda x: x['id'], accounts) if not len(ids): return 0.0
470,654
def case_close(self, cr, uid, ids, *args): """Closes Case @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 Ids @param *args: Tuple Value for additional Params """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache self.__history(cr, uid, cases, _('Close')) self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}) # # We use the cache of cases to keep the old case state # self._action(cr, uid, cases, 'done') return True
def case_close(self, cr, uid, ids, *args): """Closes Case @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 Ids @param *args: Tuple Value for additional Params """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache self.__history(cr, uid, cases, _('Close')) self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'probability' : 100.0}) # # We use the cache of cases to keep the old case state # self._action(cr, uid, cases, 'done') return True
470,655
def case_cancel(self, cr, uid, ids, *args): """Cancels Case @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 Ids @param *args: Tuple Value for additional Params """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache self.__history(cr, uid, cases, _('Cancel')) self.write(cr, uid, ids, {'state': 'cancel', 'active': True}) self._action(cr, uid, cases, 'cancel') return True
def case_cancel(self, cr, uid, ids, *args): """Cancels Case @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 Ids @param *args: Tuple Value for additional Params """ cases = self.browse(cr, uid, ids) cases[0].state # to fill the browse record cache self.__history(cr, uid, cases, _('Cancel')) self.write(cr, uid, ids, {'state': 'cancel', 'active': True, 'probability' : 0.0}) self._action(cr, uid, cases, 'cancel') return True
470,656
def _note_get(self, cursor, user, ids, name, arg, context=None): """ Gives case History Description @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 History’s IDs @param context: A standard dictionary for contextual values """ res = {} for hist in self.browse(cursor, user, ids, context or {}): res[hist.id] = (hist.email or '/') + ' (' + str(hist.date) + ')\n' res[hist.id] += (hist.description or '') return res
def _note_get(self, cursor, user, ids, name, arg, context=None): """ Gives case History Description @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 History’s IDs @param context: A standard dictionary for contextual values """ res = {} for hist in self.browse(cursor, user, ids, context or {}): res[hist.id] = (hist.email or '/') + ' (' + str(hist.date) + ')\n' res[hist.id] += (hist.description or '') return res
470,657
def get_ftp_login(cr, uid, ormobj): ftp = get_plain_ftp() user = ormobj.pool.get('res.users').read(cr, uid, uid) ftp.login(user.get('login',''), user.get('password','')) ftp.cwd("/" + cr.dbname) return ftp
def get_ftp_login(cr, uid, ormobj): ftp = get_plain_ftp() user = ormobj.pool.get('res.users').read(cr, uid, uid) ftp.login(user.get('login',''), user.get('login','')) ftp.cwd("/" + cr.dbname) return ftp
470,658
def ffp(data, ndata): if len(data)+ len(ndata) > limit: raise IndexError('Data over the limit') data.append(ndata)
def ffp(data, ndata): if len(data)+ len(ndata) > limit: raise IndexError('Data over the limit') data.append(ndata)
470,659
def _get_group(self,cr, uid, context=None): ids = self.pool.get('res.groups').search(cr, uid, [('name','=','Employee')], context=context) return ids or False
def _get_group(self,cr, uid, context=None): ids = self.pool.get('res.groups').search(cr, uid, [('name','=','Employee')], context=context) return ids or False
470,660
def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') task = self.pool.get('project.task') backlog_id = self.pool.get('scrum.product.backlog') ids_task = []
def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') task = self.pool.get('project.task') backlog_id = self.pool.get('scrum.product.backlog') ids_task = []
470,661
def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') task = self.pool.get('project.task') backlog_id = self.pool.get('scrum.product.backlog') ids_task = []
def do_create(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') task = self.pool.get('project.task') backlog_id = self.pool.get('scrum.product.backlog') ids_task = []
470,662
def setFont(self, node): from reportlab.pdfbase import pdfmetrics fname = node.get('name') #TODO : other fonts should be supported if fname not in pdfmetrics.standardFonts: fname = self.canvas._fontname return self.canvas.setFont(fname, utils.unit_get(node.get('size')))
def setFont(self, node): fname = node.get('name') #TODO : other fonts should be supported if fname not in pdfmetrics.standardFonts: fname = self.canvas._fontname return self.canvas.setFont(fname, utils.unit_get(node.get('size')))
470,663
def setFont(self, node): from reportlab.pdfbase import pdfmetrics fname = node.get('name') #TODO : other fonts should be supported if fname not in pdfmetrics.standardFonts: fname = self.canvas._fontname return self.canvas.setFont(fname, utils.unit_get(node.get('size')))
def setFont(self, node): from reportlab.pdfbase import pdfmetrics fname = node.get('name') #TODO : other fonts should be supportedreturn self.canvas.setFont(fname, utils.unit_get(node.get('size')))
470,664
def _currency(self, cursor, user, ids, name, args, context=None): res = {} res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') default_currency = res_users_obj.browse(cursor, user, user, context=context).company_id.currency_id for statement in self.browse(cursor, user, ids, context=context): currency = statement.journal_id.currency if not currency: currency = default_currency res[statement.id] = currency.id currency_names = {} for currency_id, currency_name in res_currency_obj.name_get(cursor, user, [x for x in res.values()], context=context): currency_names[currency_id] = currency_name for statement_id in res.keys(): currency_id = res[statement_id] res[statement_id] = (currency_id, currency_names[currency_id]) return res
def _currency(self, cursor, user, ids, name, args, context=None): res = {} res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') default_currency = res_users_obj.browse(cursor, user, user, context=context).company_id.currency_id for statement in self.browse(cursor, user, ids, context=context): currency = statement.journal_id.currency if not currency: currency = default_currency res[statement.id] = currency.id currency_names = {} for currency_id, currency_name in res_currency_obj.name_get(cursor, user, [x for x in res.values()], context=context): currency_names[currency_id] = currency_name for statement_id in res.keys(): currency_id = res[statement_id] res[statement_id] = (currency_id, currency_names[currency_id]) return res
470,665
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: fnode = nodes.node_file(None, None, nctx, fbro) if not bin_size: data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '') else: result[fbro.id] = fnode.get_data_len(cr, fbro)
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: if not fbro.parent_id: cr.execute("select db_datas from ir_attachment where id = %s" ,(fbro.id,)) res = cr.fetchone() datas = res[0] or '' size = len(datas) else: fnode = nodes.node_file(None, None, nctx, fbro) datas = fnode.get_data(cr, fbro) datas = base64.encodestring(datas or '') size = fnode.get_data_len(cr, fbro) if not bin_size: data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '') else: result[fbro.id] = fnode.get_data_len(cr, fbro)
470,666
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: fnode = nodes.node_file(None, None, nctx, fbro) if not bin_size: data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '') else: result[fbro.id] = fnode.get_data_len(cr, fbro)
def _data_get(self, cr, uid, ids, name, arg, context=None): if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) # nctx will /not/ inherit the caller's context. Most of # it would be useless, anyway (like active_id, active_model, # bin_size etc.) result = {} bin_size = context.get('bin_size', False) for fbro in fbrl: fnode = nodes.node_file(None, None, nctx, fbro) if not bin_size: data = fnode.get_data(cr, fbro) result[fbro.id] = base64.encodestring(data or '') else: result[fbro.id] = fnode.get_data_len(cr, fbro)
470,667
def _check_date_start(self, cr, uid, task, date_end, context={}): """ Check And Compute date_end of task if change in date_start < older time. """ resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') calendar_id = task.project_id.resource_calendar_id and task.project_id.resource_calendar_id.id or False hours = task.planned_hours / task.occupation_rate resource_id = resource_obj.search(cr, uid, [('user_id', '=', task.user_id.id)], context=context) if resource_id: resource = resource_obj.browse(cr, uid, resource_id[0], context=context) if resource.calendar_id.id: calendar_id = resource.calendar_id and resource.calendar_id.id or False hours = task.planned_hours / (float(task.occupation_rate) * resource.time_efficiency) work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, date_end, hours or 0.0, resource_id or False) dt_start = work_times[0][0].strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [task.id], {'date_start' : dt_start,'date_end' : date_end.strftime('%Y-%m-%d %H:%M:%S')})
def _check_date_start(self, cr, uid, task, date_end, context={}): """ Check And Compute date_end of task if change in date_start < older time. """ resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') calendar_id = task.project_id.resource_calendar_id and task.project_id.resource_calendar_id.id or False hours = task.planned_hours / task.occupation_rate resource_id = resource_obj.search(cr, uid, [('user_id', '=', task.user_id.id)], context=context) if resource_id: resource = resource_obj.browse(cr, uid, resource_id[0], context=context) if resource.calendar_id.id: calendar_id = resource.calendar_id and resource.calendar_id.id or False hours = task.planned_hours / (float(task.occupation_rate) * resource.time_efficiency) work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, date_end, hours or 0.0, resource_id and resource_id[0] or False) dt_start = work_times[0][0].strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [task.id], {'date_start' : dt_start,'date_end' : date_end.strftime('%Y-%m-%d %H:%M:%S')})
470,668
def _check_date_end(self, cr, uid, task, date_start, context={}): """ Check And Compute date_end of task if change in date_end > older time. """ resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') calendar_id = task.project_id.resource_calendar_id and task.project_id.resource_calendar_id.id or False hours = task.planned_hours / task.occupation_rate resource_id = resource_obj.search(cr,uid,[('user_id', '=', task.user_id.id)], context=context) if resource_id: resource = resource_obj.browse(cr, uid, resource_id[0], context=context) if resource.calendar_id.id: calendar_id = resource.calendar_id and resource.calendar_id.id or False hours = task.planned_hours / (float(task.occupation_rate) * resource.time_efficiency) work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, date_start, hours or 0.0, resource.id or False) dt_end = work_times[-1][1].strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [task.id], {'date_start': date_start.strftime('%Y-%m-%d %H:%M:%S'),'date_end' : dt_end}, context=context)
def _check_date_end(self, cr, uid, task, date_start, context={}): """ Check And Compute date_end of task if change in date_end > older time. """ resource_calendar_obj = self.pool.get('resource.calendar') resource_obj = self.pool.get('resource.resource') calendar_id = task.project_id.resource_calendar_id and task.project_id.resource_calendar_id.id or False hours = task.planned_hours / task.occupation_rate resource_id = resource_obj.search(cr,uid,[('user_id', '=', task.user_id.id)], context=context) if resource_id: resource = resource_obj.browse(cr, uid, resource_id[0], context=context) if resource.calendar_id.id: calendar_id = resource.calendar_id and resource.calendar_id.id or False hours = task.planned_hours / (float(task.occupation_rate) * resource.time_efficiency) work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, date_start, hours or 0.0, resource_id and resource_id[0] or False) dt_end = work_times[-1][1].strftime('%Y-%m-%d %H:%M:%S') self.write(cr, uid, [task.id], {'date_start': date_start.strftime('%Y-%m-%d %H:%M:%S'),'date_end' : dt_end}, context=context)
470,669
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: raise osv.except_osv(_('No Partner!'), _('You have to select a partner in the purchase form !\nPlease set one partner before choosing a product.')) if not product: return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} prod= self.pool.get('product.product').browse(cr, uid, product) lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] context={'lang':lang} context['partner_id'] = partner_id
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: raise osv.except_osv(_('No Partner!'), _('You have to select a partner in the purchase form !\nPlease set one partner before choosing a product.')) if not product: return {'value': {'price_unit': 0.0, 'name': '', 'product_qty': 1.0, 'date_planned': False, 'notes': '', 'product_uom' : False}, 'domain':{'product_uom':[]}} prod= self.pool.get('product.product').browse(cr, uid, product) lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] context={'lang':lang} context['partner_id'] = partner_id
470,670
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: raise osv.except_osv(_('No Partner!'), _('You have to select a partner in the purchase form !\nPlease set one partner before choosing a product.')) if not product: return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} prod= self.pool.get('product.product').browse(cr, uid, product) lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] context={'lang':lang} context['partner_id'] = partner_id
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: raise osv.except_osv(_('No Partner!'), _('You have to select a partner in the purchase form !\nPlease set one partner before choosing a product.')) if not product: return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} prod= self.pool.get('product.product').browse(cr, uid, product) lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] context={'lang':lang} context['partner_id'] = partner_id
470,671
def process_ir_set(self, node): if not self.mode == 'init': return False _, fields = node.items()[0] res = {} for fieldname, expression in fields.items(): if isinstance(expression, Eval): value = eval(expression.expression, self.eval_context) else: value = expression res[fieldname] = value self.pool.get('ir.model.data').ir_set(self.cr, self.uid, res['key'], res['key2'], \ res['name'], res['models'], res['value'], replace=res.get('replace',True), \ isobject=res.get('isobject', False), meta=res.get('meta',None))
def process_ir_set(self, node): if not self.mode == 'init': return False _, fields = node.items()[0] res = {} for fieldname, expression in fields.items(): if is_eval(expression): value = eval(expression.expression, self.eval_context) else: value = expression res[fieldname] = value self.pool.get('ir.model.data').ir_set(self.cr, self.uid, res['key'], res['key2'], \ res['name'], res['models'], res['value'], replace=res.get('replace',True), \ isobject=res.get('isobject', False), meta=res.get('meta',None))
470,672
def change_price(self, cr, uid, ids, context): """ @summary: Changes the Standard Price of Product. And creates an account move accordingly. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: """ rec_id = context and context.get('active_id', False) prod_obj = self.pool.get('product.template') location_obj = self.pool.get('stock.location') lot_obj = self.pool.get('stock.report.prodlots') move_obj = self.pool.get('account.move') move_line_obj = self.pool.get('account.move.line') res = self.read(cr, uid, ids[0], ['new_price']) new_price = res.get('new_price',[]) data = prod_obj.browse(cr, uid, rec_id) diff = data.standard_price - new_price prod_obj.write(cr, uid, rec_id, {'standard_price': new_price}) loc_ids = location_obj.search(cr, uid, [('account_id','<>',False),('usage','=','internal')]) lot_ids = lot_obj.search(cr, uid, [('location_id', 'in', loc_ids),('product_id','=',rec_id)]) qty = 0 debit = 0.0 credit = 0.0 stock_input_acc = data.property_stock_account_input.id or data.categ_id.property_stock_account_input_categ.id stock_output_acc = data.property_stock_account_output.id or data.categ_id.property_stock_account_output_categ.id for lots in lot_obj.browse(cr, uid, lot_ids): qty += lots.name
def change_price(self, cr, uid, ids, context): """ @summary: Changes the Standard Price of Product. And creates an account move accordingly. @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param ids: List of IDs selected @param context: A standard dictionary @return: """ rec_id = context and context.get('active_id', False) prod_obj = self.pool.get('product.template') location_obj = self.pool.get('stock.location') lot_obj = self.pool.get('stock.report.prodlots') move_obj = self.pool.get('account.move') move_line_obj = self.pool.get('account.move.line') res = self.read(cr, uid, ids[0], ['new_price']) new_price = res.get('new_price',[]) data = prod_obj.browse(cr, uid, rec_id) diff = data.standard_price - new_price prod_obj.write(cr, uid, rec_id, {'standard_price': new_price}) loc_ids = location_obj.search(cr, uid, [('account_id','<>',False),('usage','=','internal')]) lot_ids = lot_obj.search(cr, uid, [('location_id', 'in', loc_ids),('product_id','=',rec_id)]) qty = 0 debit = 0.0 credit = 0.0 stock_input_acc = data.property_stock_account_input.id or data.categ_id.property_stock_account_input_categ.id stock_output_acc = data.property_stock_account_output.id or data.categ_id.property_stock_account_output_categ.id for lots in lot_obj.browse(cr, uid, lot_ids): qty += lots.name
470,673
def start_server(root_path, port, netport, addons_path): os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --xmlrpc-port=%s --netrpc-port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path))
def start_server(root_path, port, netport, addons_path): os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --xmlrpc-port=%s --netrpc-port=%s --addons-path=%s' %(root_path, str(port),str(netport),addons_path))
470,674
def _get_data(self, cr, uid, ids, field_names, arg, context=None): if context is None: context = {} """ @param cr: the current row, from the database cursor, @param uid: the current users ID for security checks, @param ids: List of case and section Datas IDs @param context: A standard dictionary for contextual values """
def _get_data(self, cr, uid, ids, field_names, arg, context=None): if context is None: context = {} """ @param cr: the current row, from the database cursor, @param uid: the current users ID for security checks, @param ids: List of case and section Datas IDs @param context: A standard dictionary for contextual values """
470,675
def selection_field(in_field): col_obj = self.pool.get(in_field.keys()[0]) if f[i] in col_obj._columns.keys(): return col_obj._columns[f[i]] elif f[i] in col_obj._inherits.keys(): selection_field(col_obj._inherits) else: return False
def selection_field(in_field): col_obj = self.pool.get(in_field.keys()[0]) if f[i] in col_obj._columns.keys(): return col_obj._columns[f[i]] elif f[i] in col_obj._inherits.keys(): selection_field(col_obj._inherits) else: return False
470,676
def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1])
def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value try: return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1])
470,677
def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1])
def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1])
470,678
def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1])
def ustr(value): """This method is similar to the builtin `str` method, except it will return Unicode string. @param value: the value to convert @rtype: unicode @return: unicode string """ if isinstance(value, unicode): return value if hasattr(value, '__unicode__'): return unicode(value) if not isinstance(value, str): value = str(value) try: # first try utf-8 return unicode(value, 'utf-8') except: pass try: # then extened iso-8858 return unicode(value, 'iso-8859-15') except: pass # else use default system locale from locale import getlocale return unicode(value, getlocale()[1])
470,679
def _get_v( self, cr, uid, ids,*a): """ Changed the Validation state of order @return: State """
def _get_v( self, cr, uid, ids,*a): """ Changed the Validation state of order @return: State """
470,680
def _product_value(self, cr, uid, ids, field_names, arg, context=None): """Computes stock value (real and virtual) for a product, as well as stock qty (real and virtual). @param field_names: Name of field @return: Dictionary of values """ prod_id = context and context.get('product_id', False)
def _product_value(self, cr, uid, ids, field_names, arg, context=None): """Computes stock value (real and virtual) for a product, as well as stock qty (real and virtual). @param field_names: Name of field @return: Dictionary of values """ prod_id = context and context.get('product_id', False)
470,681
def _membership_state(self, cr, uid, ids, name, args, context=None): res = {} for id in ids: res[id] = 'none' today = time.strftime('%Y-%m-%d') for id in ids: partner_data = self.browse(cr,uid,id) if partner_data.membership_cancel and today > partner_data.membership_cancel: res[id] = 'canceled' continue if partner_data.membership_stop and today > partner_data.membership_stop: res[id] = 'old' continue s = 4 if partner_data.member_lines: for mline in partner_data.member_lines: if mline.date_from <= today and mline.date_to >= today: if mline.account_invoice_line and mline.account_invoice_line.invoice_id: mstate = mline.account_invoice_line.invoice_id.state if mstate == 'paid': s = 0 break elif mstate == 'open' and s!=0: s = 1 elif mstate == 'cancel' and s!=0 and s!=1: s = 2 elif (mstate == 'draft' or mstate == 'proforma') and s!=0 and s!=1: s = 3 if s==4: for mline in partner_data.member_lines: if mline.date_from < today and mline.date_to < today and mline.date_from<=mline.date_to and (mline.account_invoice_line and mline.account_invoice_line.invoice_id.state) == 'paid': s = 5 else: s = 6 if s==0: res[id] = 'paid' elif s==1: res[id] = 'invoiced' elif s==2: res[id] = 'canceled' elif s==3: res[id] = 'waiting' elif s==5: res[id] = 'old' elif s==6: res[id] = 'none' if partner_data.free_member and s!=0: res[id] = 'free' if partner_data.associate_member: res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context) res[id] = res_state[partner_data.associate_member.id] return res
def _membership_state(self, cr, uid, ids, name, args, context=None): res = {} for id in ids: res[id] = 'none' today = time.strftime('%Y-%m-%d') for id in ids: partner_data = self.browse(cr,uid,id) if partner_data.membership_cancel and today > partner_data.membership_cancel: res[id] = 'canceled' continue if partner_data.membership_stop and today > partner_data.membership_stop: res[id] = 'old' continue s = 4 if partner_data.member_lines: for mline in partner_data.member_lines: if mline.date_to >= today: if mline.account_invoice_line and mline.account_invoice_line.invoice_id: mstate = mline.account_invoice_line.invoice_id.state if mstate == 'paid': s = 0 break elif mstate == 'open' and s!=0: s = 1 elif mstate == 'cancel' and s!=0 and s!=1: s = 2 elif (mstate == 'draft' or mstate == 'proforma') and s!=0 and s!=1: s = 3 if s==4: for mline in partner_data.member_lines: if mline.date_from < today and mline.date_to < today and mline.date_from<=mline.date_to and (mline.account_invoice_line and mline.account_invoice_line.invoice_id.state) == 'paid': s = 5 else: s = 6 if s==0: res[id] = 'paid' elif s==1: res[id] = 'invoiced' elif s==2: res[id] = 'canceled' elif s==3: res[id] = 'waiting' elif s==5: res[id] = 'old' elif s==6: res[id] = 'none' if partner_data.free_member and s!=0: res[id] = 'free' if partner_data.associate_member: res_state = self._membership_state(cr, uid, [partner_data.associate_member.id], name, args, context) res[id] = res_state[partner_data.associate_member.id] return res
470,682
def view_init(self, cr , uid , fields_list, context=None): obj_inv = self.pool.get('account.invoice') if context is None: context = {} state = obj_inv.browse(cr, uid, context['active_id']).state if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) pass
def view_init(self, cr , uid , fields_list, context=None): obj_inv = self.pool.get('account.invoice') if context is None: context = {} state = obj_inv.browse(cr, uid, context['active_id']).state if obj_inv.browse(cr, uid, context['active_id']).state != 'draft': raise osv.except_osv(_('Error'), _('You can only change currency for Draft Invoice !')) pass
470,683
def send_head(self): """Common code for GET and HEAD commands.
def send_head(self): """Common code for GET and HEAD commands.
470,684
def send_head(self): """Common code for GET and HEAD commands.
def send_head(self): """Common code for GET and HEAD commands.
470,685
def send_head(self): """Common code for GET and HEAD commands.
def send_head(self): """Common code for GET and HEAD commands.
470,686
def _product_value(self, cr, uid, ids, field_names, arg, context=None): """Computes stock value (real and virtual) for a product, as well as stock qty (real and virtual). @param field_names: Name of field @return: Dictionary of values """ prod_id = context and context.get('product_id', False)
def _product_value(self, cr, uid, ids, field_names, arg, context=None): """Computes stock value (real and virtual) for a product, as well as stock qty (real and virtual). @param field_names: Name of field @return: Dictionary of values """ prod_id = context and context.get('product_id', False)
470,687
def product_detail(self, cr, uid, id, field, context={}): res = {} res[id] = {} final_value = 0.0 field_to_read = 'virtual_available' if field == 'stock_real_value': field_to_read = 'qty_available' cr.execute('select distinct product_id from stock_move where (location_id=%s) or (location_dest_id=%s)', (id, id)) result = cr.dictfetchall() if result: # Choose the right filed standard_price to read # Take the user company price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) for r in result: c = (context or {}).copy() c['location'] = id product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read], context=c) # Compute the amount_unit in right currency context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id amount_unit=self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']] final_value += (product[field_to_read] * amount_unit) return final_value
def product_detail(self, cr, uid, id, field, context={}): res = {} res[id] = {} final_value = 0.0 field_to_read = 'virtual_available' if field == 'stock_real_value': field_to_read = 'qty_available' cr.execute('select distinct product_id from stock_move where (location_id=%s) or (location_dest_id=%s)', (id, id)) result = cr.dictfetchall() if result: # Choose the right filed standard_price to read # Take the user company price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) for r in result: c = (context or {}).copy() c['location'] = id product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read], context=c) # Compute the amount_unit in right currency context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id amount_unit=self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']] final_value += (product[field_to_read] * amount_unit) return final_value
470,688
def product_detail(self, cr, uid, id, field, context={}): res = {} res[id] = {} final_value = 0.0 field_to_read = 'virtual_available' if field == 'stock_real_value': field_to_read = 'qty_available' cr.execute('select distinct product_id from stock_move where (location_id=%s) or (location_dest_id=%s)', (id, id)) result = cr.dictfetchall() if result: # Choose the right filed standard_price to read # Take the user company price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) for r in result: c = (context or {}).copy() c['location'] = id product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read], context=c) # Compute the amount_unit in right currency context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id amount_unit=self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']] final_value += (product[field_to_read] * amount_unit) return final_value
def product_detail(self, cr, uid, id, field, context={}): res = {} res[id] = {} final_value = 0.0 field_to_read = 'virtual_available' if field == 'stock_real_value': field_to_read = 'qty_available' cr.execute('select distinct product_id from stock_move where (location_id=%s) or (location_dest_id=%s)', (id, id)) result = cr.dictfetchall() if result: # Choose the right filed standard_price to read # Take the user company price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) for r in result: c = (context or {}).copy() c['location'] = id product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read], context=c) # Compute the amount_unit in right currency context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id amount_unit=self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']] final_value += (product[field_to_read] * amount_unit) return final_value
470,689
def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, [])
def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, [])
470,690
def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, [])
def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, [])
470,691
def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, [])
def _product_get_report(self, cr, uid, ids, product_ids=False, context=None, recursive=False): if context is None: context = {} product_obj = self.pool.get('product.product') # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id if not product_ids: product_ids = product_obj.search(cr, uid, [])
470,692
def get_currency_id(self, cursor, user, picking): return False
def get_currency_id(self, cr, uid, picking): return False
470,693
def _get_payment_term(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id return partner.property_payment_term and partner.property_payment_term.id or False
def _get_payment_term(self, cr, uid, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id return partner.property_payment_term and partner.property_payment_term.id or False
470,694
def _get_address_invoice(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id
def _get_address_invoice(self, cr, uid, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id
470,695
def _get_address_invoice(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id
def _get_address_invoice(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') partner = picking.address_id.partner_id
470,696
def _get_comment_invoice(self, cursor, user, picking): '''Return comment string for invoice''' return picking.note or ''
def _get_comment_invoice(self, cr, uid, picking): '''Return comment string for invoice''' return picking.note or ''
470,697
def _get_price_unit_invoice(self, cursor, user, move_line, type): '''Return the price unit for the move line''' if type in ('in_invoice', 'in_refund'): # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=move_line.company_id.currency_id.id amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id] return amount_unit else: return move_line.product_id.list_price
def _get_price_unit_invoice(self, cr, uid, move_line, type, context=None): '''Return the price unit for the move line''' if type in ('in_invoice', 'in_refund'): # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=move_line.company_id.currency_id.id amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id] return amount_unit else: return move_line.product_id.list_price
470,698
def _get_price_unit_invoice(self, cursor, user, move_line, type): '''Return the price unit for the move line''' if type in ('in_invoice', 'in_refund'): # Take the user company and pricetype price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id) context['currency_id']=move_line.company_id.currency_id.id amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id] return amount_unit else: return move_line.product_id.list_price
def _get_price_unit_invoice(self, cursor, user, move_line, type): '''Return the price unit for the move line''' if type in ('in_invoice', 'in_refund'): # Take the user company and pricetype price_type_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.property_valuation_price_type.id pricetype = self.pool.get('product.price.type').browse(cr, uid, price_type_id) context['currency_id'] = move_line.company_id.currency_id.id amount_unit = move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id] return amount_unit else: return move_line.product_id.list_price
470,699