def __init__(self, cursor, uid, name, context): super(PartnersLedgerWebkit, self).__init__(cursor, uid, name, context=context) self.pool = pooler.get_pool(self.cr.dbname) self.cursor = self.cr company = self.pool.get('res.users').browse(self.cr, uid, uid, context=context).company_id header_report_name = ' - '.join( (_('PARTNER LEDGER'), company.name, company.currency_id.name)) footer_date_time = self.formatLang(str(datetime.today()), date_time=True) self.localcontext.update({ 'cr': cursor, 'uid': uid, 'report_name': _('Partner Ledger'), 'display_account_raw': self._get_display_account_raw, 'filter_form': self._get_filter, 'target_move': self._get_target_move, 'initial_balance': self._get_initial_balance, 'amount_currency': self._get_amount_currency, 'display_partner_account': self._get_display_partner_account, 'display_target_move': self._get_display_target_move, 'additional_args': [ ('--header-font-name', 'Helvetica'), ('--footer-font-name', 'Helvetica'), ('--header-font-size', '10'), ('--footer-font-size', '6'), ('--header-left', header_report_name), ('--header-spacing', '2'), ('--footer-left', footer_date_time), ('--footer-right', ' '.join( (_('Page'), '[page]', _('of'), '[topage]'))), ('--footer-line', ), ], })
def migrate(cr, version): if not version: return pool = pooler.get_pool(cr.dbname) pto = pool['product.template'] cr.execute( 'ALTER TABLE "account_cutoff_line" RENAME "after_cutoff_days" ' 'TO "prepaid_days"') cr.execute( "UPDATE payment_line SET communication = communication2, " "communication2 = null " "FROM payment_order " "WHERE payment_line.order_id = payment_order.id " "AND payment_order.state in ('draft', 'open') " "AND payment_line.state = 'normal' " "AND communication2 is not null")
def migrate_lead_time(cr): pool = pooler.get_pool(cr.dbname) lead_time_obj = pool['stock.buffer.profile.lead.time'] cr.execute(""" SELECT old_lead_time, old_lead_time_factor FROM stock_buffer_profile WHERE old_lead_time IS NOT NULL AND old_lead_time_factor IS NOT NULL GROUP by old_lead_time, old_lead_time_factor""") for lead_time, lead_time_factor in cr.fetchall(): lt_id = lead_time_obj.create(cr, SUPERUSER_ID, { 'name': lead_time, 'factor': lead_time_factor }) cr.execute(""" UPDATE stock_buffer_profile SET lead_time_id = %s WHERE old_lead_time_factor = %s AND old_lead_time = '%s'""" % (lt_id, lead_time_factor, lead_time))
def migrate_variability(cr): pool = pooler.get_pool(cr.dbname) variability_obj = pool['stock.buffer.profile.variability'] cr.execute(""" SELECT old_variability, old_variability_factor FROM stock_buffer_profile WHERE old_variability IS NOT NULL AND old_variability_factor IS NOT NULL GROUP by old_variability, old_variability_factor""") for variability, variability_factor in cr.fetchall(): var_id = variability_obj.create(cr, SUPERUSER_ID, { 'name': variability, 'factor': variability_factor }) cr.execute(""" UPDATE stock_buffer_profile SET variability_id = %s WHERE old_variability_factor = %s AND old_variability = '%s'""" % (var_id, variability_factor, variability))
def __init__(self, cursor, uid, name, context=None): """Constructor, refer to :class:`openerp.report.report_sxw.rml_parse`""" super(AccountAgedOpenInvoicesWebkit, self).__init__(cursor, uid, name, context=context) self.pool = pooler.get_pool(self.cr.dbname) self.cursor = self.cr company = self.pool.get('res.users').browse(self.cr, uid, uid, context=context).company_id header_report_name = ' - '.join((_('Aged Open Invoices'), company.currency_id.name)) footer_date_time = self.formatLang(str(datetime.today()), date_time=True) self.localcontext.update({ 'cr': cursor, 'uid': uid, 'company': company, 'ranges': self._get_ranges(), 'ranges_titles': self._get_ranges_titles(), 'report_name': _('Aged Open Invoices'), 'additional_args': [ ('--header-font-name', 'Helvetica'), ('--footer-font-name', 'Helvetica'), ('--header-font-size', '10'), ('--footer-font-size', '6'), ('--header-left', header_report_name), ('--header-spacing', '2'), ('--footer-left', footer_date_time), ('--footer-right', ' '.join((_('Page'), '[page]', _('of'), '[topage]'))), ('--footer-line',), ], })
def run_cron_ddmrp(cr): pool = pooler.get_pool(cr.dbname) pool['stock.warehouse.orderpoint'].cron_ddmrp(cr, SUPERUSER_ID, automatic=True)