Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class NebizImportManufOrders(models.Model):
- _inherit = 'mrp.production'
- _name = 'mrp.production'
- erp7_id = fields.Integer("ERP7 ID", default=0)
- def get_rows_fromdb(self):
- db_vals = self.env['db.config'].get_db_config()
- if db_vals:
- table = 'mrp_production'
- limit = 9999
- import psycopg2
- conn = psycopg2.connect(database=db_vals['db_name'], user=db_vals['user'], password=db_vals['password'],
- host=db_vals['host'], port=db_vals['port'])
- if conn:
- cur = conn.cursor()
- # if limit is None:
- # limit = 999999
- cur.execute("select row_to_json(%s) from %s limit %r;" % (table, table, limit))
- rows = cur.fetchall()
- cur.close()
- return rows
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement