From 33306081705473206a16ae7cc9a9378735a0b91e Mon Sep 17 00:00:00 2001 From: Judy Date: Wed, 30 Mar 2016 14:13:26 +0800 Subject: [PATCH] =?UTF-8?q?[FIX]=E2=80=9C=E9=87=87=E8=B4=AD=E9=94=80?= =?UTF-8?q?=E5=94=AE=E8=B4=B9=E7=94=A8=E2=80=9D=E4=BB=8Ecore=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0money=5Forder=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.py | 11 ----------- money/money_order.py | 18 +++++++++++------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/core/core.py b/core/core.py index f83a417df..203b25aea 100644 --- a/core/core.py +++ b/core/core.py @@ -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'备注') diff --git a/money/money_order.py b/money/money_order.py index 6556e818a..26afad0fa 100644 --- a/money/money_order.py +++ b/money/money_order.py @@ -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 @@ -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 @@ -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'备注')