Skip to content

Commit

Permalink
Merge pull request osbzr#1362 from floraXiao/master
Browse files Browse the repository at this point in the history
[ADD]其他收入单、其他支出单增加外币金额 osbzr#1359
  • Loading branch information
GoodERPJeff authored Jul 6, 2017
2 parents 6163eff + cbd5595 commit bc4e294
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions money/models/other_money_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def _compute_total_amount(self):
ondelete='restrict',
copy=False,
help=u'其他收支单审核时生成的对应凭证')
currency_amount = fields.Float(u'外币金额',
digits=dp.get_precision('Amount'))

@api.onchange('date')
def onchange_date(self):
Expand Down Expand Up @@ -228,6 +230,7 @@ def other_get_create_voucher_line(self, vouch_obj, init_obj):
if not line.category_id.account_id:
raise UserError(u'请配置%s的会计科目' % (line.category_id.name))

rate_silent = self.env['res.currency'].get_rate_silent(self.date, self.bank_id.currency_id.id)
vals.update({'vouch_obj_id': vouch_obj.id, 'name': self.name, 'note': line.note or '',
'credit_auxiliary_id': line.auxiliary_id.id,
'amount': abs(line.amount + line.tax_amount),
Expand All @@ -236,6 +239,9 @@ def other_get_create_voucher_line(self, vouch_obj, init_obj):
'partner_credit': self.partner_id.id, 'partner_debit': '',
'sell_tax_amount': line.tax_amount or 0,
'init_obj': init_obj,
'currency_id': self.bank_id.currency_id.id,
'currency_amount': self.currency_amount,
'rate_silent': rate_silent,
})
# 贷方行
if not init_obj:
Expand Down Expand Up @@ -266,6 +272,9 @@ def other_get_create_voucher_line(self, vouch_obj, init_obj):
'partner_id': vals.get('partner_debit', ''),
'auxiliary_id': vals.get('debit_auxiliary_id', False),
'init_obj': vals.get('init_obj', False),
'currency_id': vals.get('currency_id', False),
'currency_amount': vals.get('currency_amount'),
'rate_silent': vals.get('rate_silent'),
})

def other_pay_create_voucher_line(self, vouch_obj):
Expand All @@ -279,13 +288,17 @@ def other_pay_create_voucher_line(self, vouch_obj):
if not line.category_id.account_id:
raise UserError(u'请配置%s的会计科目' % (line.category_id.name))

rate_silent = self.env['res.currency'].get_rate_silent(self.date, self.bank_id.currency_id.id)
vals.update({'vouch_obj_id': vouch_obj.id, 'name': self.name, 'note': line.note or '',
'debit_auxiliary_id': line.auxiliary_id.id,
'amount': abs(line.amount + line.tax_amount),
'credit_account_id': self.bank_id.account_id.id,
'debit_account_id': line.category_id.account_id.id, 'partner_credit': '',
'partner_debit': self.partner_id.id,
'buy_tax_amount': line.tax_amount or 0,
'currency_id': self.bank_id.currency_id.id,
'currency_amount': self.currency_amount,
'rate_silent': rate_silent,
})
# 借方行
self.env['voucher.line'].create({
Expand Down Expand Up @@ -316,6 +329,9 @@ def other_pay_create_voucher_line(self, vouch_obj):
'voucher_id': vals.get('vouch_obj_id'),
'auxiliary_id': vals.get('credit_auxiliary_id', False),
'init_obj': vals.get('init_obj', False),
'currency_id': vals.get('currency_id', False),
'currency_amount': vals.get('currency_amount'),
'rate_silent': vals.get('rate_silent'),
})


Expand Down
3 changes: 2 additions & 1 deletion money/models/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def _set_init_balance(self):
'tax_rate': 0,
'tax_amount': 0,
})],
'state': 'draft'
'state': 'draft',
'currency_amount': self.currency_amount,
})
# 审核 其他收入单
other_money_init.other_money_done()
Expand Down
3 changes: 3 additions & 0 deletions money/views/other_money_order_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
</group>
<group>
<field name="total_amount"/>
<field name='currency_amount'
groups='finance.group_multi_currency'
/>
</group>
</group>
<field name="note" placeholder="备注"/>
Expand Down

0 comments on commit bc4e294

Please sign in to comment.