# -*- coding: utf-8 -*-
from odooClient import ODOO
# from datetime import datetime,timedelta

odoo230 = ODOO('http://192.168.1.230:8069', timeout=600)
odoo230.login('cic_oa', 'admin', 'cic_admin')
cic_tools = odoo230.env['cic_tools.cic_finance']

res = cic_tools.get_declaration_data('91320214MA1NYKMBXK', '2019-07-01',
                                     '2019-09-30')

# res = self.env['cic_tools.cic_finance'].get_declaration_data('91320214MA1NYKMBXK','2019-07-01','2019-09-30')

# 资产负债表
zcfzb = res.get('资产负债表')


def get_value():
    # dqjkqmye_value = zcfzb.get('line33CurrentEnd')
    # dqjkncye_value = zcfzb.get('line33CurrentBegin')
    if cell.tagname[-4:] == ncye:
        BeginOREnd = 'CurrentBegin'
    if cell.tagname[-4:] == qmye:
        BeginOREnd = 'CurrentEnd'
    value = zcfzb.get('line' + cell.line_num + BeginOREnd)
    return value


get_value()

# # 利润表
Beispiel #2
0
# -*- coding: utf-8 -*-

from odooClient import ODOO
c0 = ODOO('http://192.168.1.240:8069')
c0.login('test', 'admin', 'admin')

shenbaosheetcell = c0.env['cic_taxsb.shenbaosheet.cell']  # 单元格
shenbaosheet = c0.env['cic_taxsb.shenbaosheet']  # 表
shenbaosheetwizard = c0.env['create.shenbaosheet.wizard']  # 创建表

#############财务报表-企业会计制度-江苏
# xml
xml_id = shenbaosheet.create({
    'name': '财务报表-企业会计准则2017-江苏',
    'description': '财务报表-企业会计准则2017-江苏',
    'dqbm': '32',
    'tagname': 'jsxgs_year_cwbb_ybqy_2017xxVO'
})

# forms
sbbinfo_id = shenbaosheet.create({
    'parent_id': xml_id,
    'name': '申报信息表',
    'description': '申报信息表',
    'dqbm': '32',
    'tagname': 'sbbinfo'
})
zcfzb_id = shenbaosheet.create({
    'parent_id': xml_id,
    'name': '资产负债表',
    'description': '资产负债表',
Beispiel #3
0
# -*- coding: utf-8 -*-

# 生成所有的报文结构,对比是否正确

import os
from odooClient import ODOO

c0 = ODOO('http://192.168.1.230:8069')
c0.login('cic_oa', 'admin', 'cic_admin')

shenbaosheetcell = c0.env['cic_taxsb.shenbaosheet.cell']  # 单元格
shenbaosheet = c0.env['cic_taxsb.shenbaosheet']  # 表
shenbaosheetwizard = c0.env['create.shenbaosheet.wizard']  # 创建表

# sheet_id
for root, dirs, files in os.walk(
        'D:\git_jst\project\odoo_jsonrpc_client\sb\js\申报提交XML报文'):
    for file_name in files:
        file_name_no_extend, extension_name = os.path.splitext(file_name)
        shenbaosheet.search([('name', '=', file_name_no_extend)])

shenbaosheetwizard.create({
    'dqbm': '32',
    'sheet_id': 108,
    'account_id': 100,
    'startdate': '2019-09-01',
    'enddate': '2019-09-30'
})
Beispiel #4
0
def create_xml_obj(full_filename):
    # 客户端输入文件名自动创建xml结构的对象,xml--forms--lines--cells。之后在服务端调用创建表向导即可。

    c0 = ODOO('http://192.168.1.230:8069')
    c0.login('cic_oa', 'admin', 'cic_admin')
    shenbaosheetcell = c0.env['cic_taxsb.shenbaosheet.cell']  # 单元格
    shenbaosheet = c0.env['cic_taxsb.shenbaosheet']  # 表

    xml_dir = os.path.join(
        os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
        '申报提交XML报文')
    file_name = full_filename
    file_name_no_extend, extension_name = os.path.splitext(file_name)
    xml_abspath = os.path.join(xml_dir, file_name)
    with open(xml_abspath, 'r', encoding='utf-8') as f:
        xml = f.read()

    xml_dict = xml_to_dict(xml)
    # {'jsxgs_zzs_ybnsrxxVO':{'sbbinfo':{'sbzlbh':'10101',...},'jsxgs_zzs_ybnsr_sbb':{'sbbGridlbVO':[{'ewbhxh':'1',...},...]},'jsxgs_zzs_ybnsr_scqy15':None,...}}
    # print(list(xml_dict.keys())[0]) #   xml_dict.keys():dict_keys(['jsxgs_zzs_ybnsrxxVO'])
    xml_name = list(xml_dict.keys())[0]  # jsxgs_zzs_ybnsrxxVO
    forms_name = list(list(
        xml_dict.values())[0].keys())  # ['sbbinfo', 'jsxgs_zzs_ybnsr_sbb',...]
    # xml 创建xml
    xml_id = shenbaosheet.create({
        'name': file_name_no_extend,
        'description': file_name_no_extend,
        'dqbm': '32',
        'tagname': xml_name
    })
    # forms
    for form_name in forms_name:  # ['sbbinfo', 'jsxgs_zzs_ybnsr_sbb',...]
        # 创建表
        form_id = shenbaosheet.create({
            'parent_id': xml_id,
            'name': form_name,
            'description': form_name,
            'dqbm': '32',
            'tagname': form_name
        })
        # 非空表 有两种情况    1.字典的value是列表     2.字典
        if xml_dict[xml_name][form_name]:
            # xml--form--line--cell   1.字典的value是列表  {'sbbGridlbVO':[{'ewbhxh':'1',...},...]}
            if isinstance(
                    list(xml_dict[xml_name][form_name].values())[0], list):
                # 创建行
                line_name = list(xml_dict[xml_name][form_name].keys())[0]
                line_id = shenbaosheet.create({
                    'parent_id': form_id,
                    'name': line_name,
                    'description': line_name,
                    'dqbm': '32',
                    'tagname': line_name
                })
                # 创建单元格 [{'ewbhxh':'1',...},...]
                for cell_dict in xml_dict[xml_name][form_name][line_name]:
                    cell_line_num = int(cell_dict['ewbhxh'])
                    cell_name_list = list(cell_dict.keys())
                    # ['ewbhxh', 'yybjsffjsqbz', 'yybjs']
                    for cell_name in cell_name_list:
                        if cell_name != 'ewbhxh':
                            shenbaosheetcell.create({
                                'sheet_id': form_id,
                                'line': cell_line_num,
                                'tagname': cell_name
                            })
            # xml--form--cell   2.字典 ps:直接else就可以,只是让逻辑更清晰   {'sbzlbh':'10101',...}
            if isinstance(xml_dict[xml_name][form_name], dict):
                # 创建单元格
                cell_name_list = list(xml_dict[xml_name][form_name].keys())
                for cell_name in cell_name_list:
                    shenbaosheetcell.create({
                        'sheet_id': form_id,
                        'tagname': cell_name
                    })