Skip to content

Commit

Permalink
Merge 8fac03d into 95f8221
Browse files Browse the repository at this point in the history
  • Loading branch information
USI-SHRD committed Jun 28, 2018
2 parents 95f8221 + 8fac03d commit 483e57e
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 15 deletions.
1 change: 1 addition & 0 deletions access_control_goods/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# -*- coding: utf-8 -*-
19 changes: 19 additions & 0 deletions access_control_goods/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
{
'name': "GoodERP Access Control Goods 模块",
'author': "开阖软件",
'website': "http://www.osbzr.com",
'category': 'gooderp',
'summary': 'GoodERP 商品 读写建删权限控制',
"description":
'''
该模块添加了 创建商品组,该组成员可以对商品进行增删改查,普通用户只能查看。
''',
'version': '11.11',
'application': True,
'depends': ['core'],
'data': [
'security/groups.xml',
'security/ir.model.access.csv',
],
}
11 changes: 11 additions & 0 deletions access_control_goods/security/groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!--添加创建创建商品组-->
<record id="group_operate_goods_main_data" model="res.groups">
<field name='name'>创建商品</field>
<field name='category_id' ref="core.Gooderp"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
</data>
</openerp>
3 changes: 3 additions & 0 deletions access_control_goods/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
core.access_goods,access_goods_user,core.model_goods,base.group_user,1,0,0,0
access_goods_operator,access_goods_operator,core.model_goods,access_control_goods.group_operate_goods_main_data,1,1,1,1
84 changes: 69 additions & 15 deletions finance/tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,35 @@ def test_check_trial_balance_wizard_default_get(self):
{'period_id': self.period_201512.id})
# 创建科目余额表
report.create_trial_balance()
field_list = [
"total_year_init_debit", "total_year_init_credit",
"total_initial_balance_debit", "total_initial_balance_credit",
"total_current_occurrence_debit", "total_current_occurrence_credit",
"total_ending_balance_debit", "total_ending_balance_credit",
"total_cumulative_occurrence_debit", "total_cumulative_occurrence_credit"
]
# 期间 period_201512,找到叶科目 银行存款-基本户,试算平衡
for trial in self.env['trial.balance'].search([]):
field_list = [
"total_year_init_debit", "total_year_init_credit",
"total_initial_balance_debit", "total_initial_balance_credit",
"total_current_occurrence_debit", "total_current_occurrence_credit",
"total_ending_balance_debit", "total_ending_balance_credit",
"total_cumulative_occurrence_debit", "total_cumulative_occurrence_credit"
]
if trial.subject_name_id.id == self.env.ref('finance.account_bank').id:
ctx = self.env.context.copy()
ctx['active_id'] = trial.id
ctx['active_ids'] = [trial.id]
env2 = self.env(self.env.cr, self.env.uid, ctx)
wizard_obj.with_env(env2).default_get(field_list)

# init period
# 创建科目余额表
report.create_trial_balance()
# 期间 period_201512,找到叶科目 银行存款-基本户,试算平衡
for trial in self.env['trial.balance'].search([]):
if trial.subject_name_id.id == self.env.ref('finance.account_bank').id:
ctx = self.env.context.copy()
ctx['active_id'] = trial.id
ctx['active_ids'] = [trial.id]
self.env.ref('base.main_company').start_date = '2015-12-12'
env2 = self.env(self.env.cr, self.env.uid, ctx)
wizard_obj.with_env(env2).default_get(field_list)

def test_check_trial_balance_wizard_default_get_diff_exists(self):
''' 测试 试算平衡 向导 default_get diff exists '''
wizard_obj = self.env['check.trial.balance.wizard']
Expand All @@ -168,22 +181,35 @@ def test_check_trial_balance_wizard_default_get_diff_exists(self):
self.env.ref('finance.voucher_line_12_credit').credit = 1000002
# 创建科目余额表
report.create_trial_balance()
field_list = [
"total_year_init_debit", "total_year_init_credit",
"total_initial_balance_debit", "total_initial_balance_credit",
"total_current_occurrence_debit", "total_current_occurrence_credit",
"total_ending_balance_debit", "total_ending_balance_credit",
"total_cumulative_occurrence_debit", "total_cumulative_occurrence_credit"
]
# 期间 period_201512,找到叶科目 银行存款-基本户,试算平衡
for trial in self.env['trial.balance'].search([]):
field_list = [
"total_year_init_debit", "total_year_init_credit",
"total_initial_balance_debit", "total_initial_balance_credit",
"total_current_occurrence_debit", "total_current_occurrence_credit",
"total_ending_balance_debit", "total_ending_balance_credit",
"total_cumulative_occurrence_debit", "total_cumulative_occurrence_credit"
]
if trial.subject_name_id.id == self.env.ref('finance.account_bank').id:
ctx = self.env.context.copy()
ctx['active_id'] = trial.id
ctx['active_ids'] = [trial.id]
env2 = self.env(self.env.cr, self.env.uid, ctx)
wizard_obj.with_env(env2).default_get(field_list)

# init period
# 创建科目余额表
report.create_trial_balance()
# 期间 period_201512,找到叶科目 银行存款-基本户,试算平衡
for trial in self.env['trial.balance'].search([]):
if trial.subject_name_id.id == self.env.ref('finance.account_bank').id:
ctx = self.env.context.copy()
ctx['active_id'] = trial.id
ctx['active_ids'] = [trial.id]
self.env.ref('base.main_company').start_date = '2015-12-12'
env2 = self.env(self.env.cr, self.env.uid, ctx)
wizard_obj.with_env(env2).default_get(field_list)

def test_check_trial_balance(self):
''' 测试 试算平衡 check_trial_balance '''
report = self.env['create.trial.balance.wizard'].create(
Expand All @@ -195,6 +221,17 @@ def test_check_trial_balance(self):
if trial.subject_name_id.id == self.env.ref('finance.account_bank').id:
if trial.period_id == self.period_201512:
trial.check_trial_balance(self.period_201512)

def test_check_trial_balance_init_period(self):
''' 测试 试算平衡 check_trial_balance init period '''
report = self.env['create.trial.balance.wizard'].create(
{'period_id': self.period_201512.id})
# 创建科目余额表
report.create_trial_balance()
# 期间 period_201512,找到叶科目 银行存款-基本户,试算平衡
for trial in self.env['trial.balance'].search([]):
if trial.subject_name_id.id == self.env.ref('finance.account_bank').id:
self.env.ref('base.main_company').start_date = '2015-12-12'
if trial.period_id == trial.period_id.get_init_period():
trial.check_trial_balance(trial.period_id.get_init_period())

Expand All @@ -215,8 +252,25 @@ def test_check_trial_balance_diff_exists(self):
if trial.period_id == self.period_201512:
with self.assertRaises(UserError):
trial.check_trial_balance(self.period_201512)

def test_check_trial_balance_diff_exists_init_period(self):
''' 测试 试算平衡 check_trial_balance diff exists init period '''
report = self.env['create.trial.balance.wizard'].create(
{'period_id': self.period_201512.id})
# 修改当期 一个凭证行的贷方金额,使贷方金额不等于借方金额
self.env.ref('finance.voucher_12_2_credit').credit = 4999
# 修改上期 一个凭证行的贷方金额,使贷方金额不等于借方金额
self.env.ref('finance.voucher_12').voucher_id = '201511'
self.env.ref('finance.voucher_line_12_credit').credit = 1000002
# 创建科目余额表
report.create_trial_balance()
# 期间 period_201512,init_period 试算平衡
for trial in self.env['trial.balance'].search([]):
if trial.subject_name_id.id == self.env.ref('finance.account_bank').id:
self.env.ref('base.main_company').start_date = '2015-12-12'
if trial.period_id == trial.period_id.get_init_period():
trial.check_trial_balance(trial.period_id.get_init_period())
with self.assertRaises(UserError):
trial.check_trial_balance(trial.period_id.get_init_period())

def test_vouchers_summary(self):
''' 测试总账和明细账'''
Expand Down

0 comments on commit 483e57e

Please sign in to comment.