Пример #1
0
def export_invoice(session, model_name, record_id):
    invoice = session.browse(model_name, record_id)
    backend_id = invoice.backend_id.id
    env = get_environment(session, model_name, backend_id)
    invoice_exporter = env.get_connector_unit(BotsAccountInvoiceExport)
    res = invoice_exporter.run(record_id)
    return res
Пример #2
0
def export_invoice(session, model_name, record_id):
    invoice = session.browse(model_name, record_id)
    backend_id = invoice.backend_id.id
    env = get_environment(session, model_name, backend_id)
    invoice_exporter = env.get_connector_unit(BotsAccountInvoiceExport)
    res = invoice_exporter.run(record_id)
    return res
Пример #3
0
def export_picking_crossdock(session, model_name, record_id):
    picking = session.browse(model_name, record_id)
    if picking.state == 'done' and session.search(model_name, [('backorder_id', '=', picking.openerp_id.id)]):
        # We are an auto-created back order completed - ignore this export
        return "Not exporting crossdock for auto-created done picking backorder %s" % (picking.name,)
    backend_id = picking.backend_id.id
    env = get_environment(session, model_name, backend_id)
    picking_exporter = env.get_connector_unit(BotsPickingExport)
    res = picking_exporter.run_crossdock(record_id)
    return res
Пример #4
0
def export_picking_crossdock(session, model_name, record_id):
    picking = session.browse(model_name, record_id)
    if picking.state == 'done' and session.search(
            model_name, [('backorder_id', '=', picking.openerp_id.id)]):
        # We are an auto-created back order completed - ignore this export
        return "Not exporting crossdock for auto-created done picking backorder %s" % (
            picking.name, )
    backend_id = picking.backend_id.id
    env = get_environment(session, model_name, backend_id)
    picking_exporter = env.get_connector_unit(BotsPickingExport)
    res = picking_exporter.run_crossdock(record_id)
    return res
Пример #5
0
 def import_sales(self, cr, uid, ids, new_cr=True, context=None):
     """ Import sale order from backend """
     if not hasattr(ids, '__iter__'):
         ids = [ids]
     backends = self.browse(cr, uid, ids, context=context)
     for backend in backends:
         if backend.feat_sale_imp:
             session = ConnectorSession(cr, uid, context=context)
             env = get_environment(session, 'bots.backend', backend.id)
             backend_adapter = BotsCRUDAdapter(env)
             FILENAME = r'^sale_.*\.json$'
             for file_id in backend_adapter._search(FILENAME):
                 import_sale_order.delay(session, 'bots.sale.order', file_id, backend.id, new_cr=new_cr)
     return True
Пример #6
0
def import_sale_order(session, model_name, file_id, backend_id, new_cr=True):
    env = get_environment(session, model_name, backend_id)
    sale_importer = env.get_connector_unit(BotsSaleOrderImport)
    res = sale_importer.run(file_id, backend_id, new_cr=new_cr)
    return res
Пример #7
0
def export_stock_levels(session, model_name, backend_id, new_cr=True):
    env = get_environment(session, model_name, backend_id)
    backend_exporter = env.get_connector_unit(BotsBackendExport)
    backend_exporter.export_stock_levels(backend_id, new_cr=new_cr)
    return True
Пример #8
0
def import_sale_order(session, model_name, file_id, backend_id, new_cr=True):
    env = get_environment(session, model_name, backend_id)
    sale_importer = env.get_connector_unit(BotsSaleOrderImport)
    res = sale_importer.run(file_id, backend_id, new_cr=new_cr)
    return res