summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHIRAL BHAVSAR <hbh@odoo.com>2017-08-30 12:35:22 +0530
committerLaurent Smet <las@openerp.com>2017-08-30 09:05:22 +0200
commit52decc07fdfd811f68752cfab6be7c9c6ca09497 (patch)
treed4f78d8e5d762514c9cccb6bfedd62253e589845
parent5fb121e77384a158d8cb1f7ad6a078e7c54df8ac (diff)
[IMP] account, account_*: add cancelled state to payment
task: https://www.odoo.com/web#id=28001&view_type=form&model=project.task&menu_id= PR: #14492
-rw-r--r--addons/account/models/account_payment.py4
-rw-r--r--addons/account/views/account_payment_view.xml8
-rw-r--r--addons/account_cancel/views/account_views.xml2
-rw-r--r--addons/account_check_printing/wizard/print_prenumbered_checks.py2
4 files changed, 8 insertions, 8 deletions
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index 64e52787778..d43d767ee69 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -269,7 +269,7 @@ class account_payment(models.Model):
company_id = fields.Many2one(store=True)
name = fields.Char(readonly=True, copy=False, default="Draft Payment") # The name is attributed upon post()
- state = fields.Selection([('draft', 'Draft'), ('posted', 'Posted'), ('sent', 'Sent'), ('reconciled', 'Reconciled'), ('cancel', 'Cancelled')], readonly=True, default='draft', copy=False, string="Status")
+ state = fields.Selection([('draft', 'Draft'), ('posted', 'Posted'), ('sent', 'Sent'), ('reconciled', 'Reconciled'), ('cancelled', 'Cancelled')], readonly=True, default='draft', copy=False, string="Status")
payment_type = fields.Selection(selection_add=[('transfer', 'Internal Transfer')])
payment_reference = fields.Char(copy=False, readonly=True, help="Reference of the document used to issue this payment. Eg. check number, file name, etc.")
@@ -425,7 +425,7 @@ class account_payment(models.Model):
move.line_ids.remove_move_reconcile()
move.button_cancel()
move.unlink()
- rec.state = 'cancel'
+ rec.state = 'cancelled'
@api.multi
def unlink(self):
diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml
index 51e94a4a26d..e012baa6502 100644
--- a/addons/account/views/account_payment_view.xml
+++ b/addons/account/views/account_payment_view.xml
@@ -6,7 +6,7 @@
<field name="name">account.payment.tree</field>
<field name="model">account.payment</field>
<field name="arch" type="xml">
- <tree decoration-info="state == 'draft'" decoration-muted="state in ['reconciled', 'cancel']" edit="false">
+ <tree decoration-info="state == 'draft'" decoration-muted="state in ['reconciled', 'cancelled']" edit="false">
<field name="payment_date"/>
<field name="name"/>
<field name="journal_id"/>
@@ -25,7 +25,7 @@
<field name="name">account.supplier.payment.tree</field>
<field name="model">account.payment</field>
<field name="arch" type="xml">
- <tree decoration-info="state == 'draft'" decoration-muted="state in ['reconciled', 'cancel']" edit="false">
+ <tree decoration-info="state == 'draft'" decoration-muted="state in ['reconciled', 'cancelled']" edit="false">
<field name="payment_date"/>
<field name="name"/>
<field name="journal_id"/>
@@ -113,8 +113,8 @@
<form string="Register Payment" version="7">
<header>
<button name="post" class="oe_highlight" states="draft" string="Confirm" type="object"/>
- <button name="action_draft" states="cancel" string="Set to Draft" type="object"/>
- <field name="state" widget="statusbar" statusbar_visible="posted,reconciled"/>
+ <button name="action_draft" class="oe_highlight" states="cancelled" string="Set To Draft" type="object"/>
+ <field name="state" widget="statusbar" statusbar_visible="draft,posted,reconciled,cancelled"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
diff --git a/addons/account_cancel/views/account_views.xml b/addons/account_cancel/views/account_views.xml
index 3ee651f271d..428c6b4414f 100644
--- a/addons/account_cancel/views/account_views.xml
+++ b/addons/account_cancel/views/account_views.xml
@@ -65,7 +65,7 @@
<field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="arch" type="xml">
<xpath expr="//header/field[@name='state']" position="before">
- <button name="cancel" states="posted,sent,reconciled" string="Cancel" type="object"/>
+ <button name="cancel" attrs="{'invisible': [('state', 'in', ['draft','cancelled'])]}" string="Cancel" type="object"/>
</xpath>
</field>
</record>
diff --git a/addons/account_check_printing/wizard/print_prenumbered_checks.py b/addons/account_check_printing/wizard/print_prenumbered_checks.py
index 9f5ebcacaf7..1e2dd235bc0 100644
--- a/addons/account_check_printing/wizard/print_prenumbered_checks.py
+++ b/addons/account_check_printing/wizard/print_prenumbered_checks.py
@@ -15,7 +15,7 @@ class PrintPreNumberedChecks(models.TransientModel):
check_number = self.next_check_number
payments = self.env['account.payment'].browse(self.env.context['payment_ids'])
payments.filtered(lambda r: r.state == 'draft').post()
- payments.filtered(lambda r: r.state != 'sent').write({'state': 'sent'})
+ payments.filtered(lambda r: r.state not in ('sent', 'cancelled')).write({'state': 'sent'})
for payment in payments:
payment.check_number = check_number
check_number += 1