[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
This commit is contained in:
committed by
Laurent Smet
parent
5fb121e773
commit
52decc07fd
@@ -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):
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user