Skip to content

Commit

Permalink
[FIX]“采购销售费用”从core移动到money_order下
Browse files Browse the repository at this point in the history
  • Loading branch information
USI-SHRD committed Mar 30, 2016
1 parent 6a2a267 commit 3330608
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
11 changes: 0 additions & 11 deletions core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,3 @@ class bank_account(models.Model):
_name = 'bank.account'
name = fields.Char(u'名称')
balance = fields.Float(u'余额', readonly=True)

class cost_line(models.Model):
_name = 'cost.line'
_description = u"采购销售费用"

buy_id = fields.Many2one('buy.receipt', u'入库单号')
sell_id = fields.Many2one('sell.delivery', u'出库单号')
partner_id = fields.Many2one('partner', u'供应商')
category_id = fields.Many2one('core.category', u'类别', domain="[('type', '=', 'other_pay')]")
amount = fields.Float(u'金额')
note = fields.Char(u'备注')
18 changes: 11 additions & 7 deletions money/money_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ def money_order_done(self):

# 更新源单的未核销金额、已核销金额
for source in self.source_ids:
if source.to_reconcile < source.this_reconcile:
if abs(source.to_reconcile) < source.this_reconcile:
raise except_orm(u'错误', u'本次核销金额不能大于未核销金额')
source.name.to_reconcile = source.to_reconcile - source.this_reconcile
source.name.reconciled = source.reconciled + source.this_reconcile

self.state = 'done'
return True

Expand All @@ -149,10 +148,6 @@ def money_order_draft(self):
else:
self.partner_id.receivable += total

# 更新源单的未核销金额、已核销金额
for source in self.source_ids:
source.name.to_reconcile = source.to_reconcile + source.this_reconcile
source.name.reconciled = source.reconciled - source.this_reconcile
self.state = 'draft'
return True

Expand Down Expand Up @@ -404,3 +399,12 @@ class advance_payment(models.Model):
reconciled = fields.Float(string=u'已核销金额')
to_reconcile = fields.Float(string=u'未核销金额')
this_reconcile = fields.Float(string=u'本次核销金额')

class cost_line(models.Model):
_name = 'cost.line'
_description = u"采购销售费用"

partner_id = fields.Many2one('partner', u'供应商')
category_id = fields.Many2one('core.category', u'类别', domain="[('type', '=', 'other_pay')]")
amount = fields.Float(u'金额')
note = fields.Char(u'备注')

0 comments on commit 3330608

Please sign in to comment.