[IMP] account_banking_mandate: black, isort, etc...

This commit is contained in:
Alexis de Lattre
2020-12-24 01:04:56 +01:00
committed by Stefan Rijnhart
parent 49ee4bd41a
commit bd2d666e59
6 changed files with 36 additions and 17 deletions

View File

@@ -64,7 +64,8 @@ class AccountBankingMandate(models.Model):
string="Unique Mandate Reference", tracking=10, copy=False
)
signature_date = fields.Date(
string="Date of Signature of the Mandate", tracking=50,
string="Date of Signature of the Mandate",
tracking=50,
)
scan = fields.Binary(string="Scan of the Mandate")
last_debit_date = fields.Date(string="Date of the Last Debit", readonly=True)
@@ -135,10 +136,7 @@ class AccountBankingMandate(models.Model):
def _check_dates(self):
today = fields.Date.context_today(self)
for mandate in self:
if (
mandate.signature_date
and mandate.signature_date > today
):
if mandate.signature_date and mandate.signature_date > today:
raise ValidationError(
_("The date of signature of mandate '%s' " "is in the future!")
% mandate.unique_mandate_reference

View File

@@ -10,7 +10,9 @@ class AccountMoveLine(models.Model):
_inherit = "account.move.line"
mandate_id = fields.Many2one(
"account.banking.mandate", string="Direct Debit Mandate", ondelete="restrict",
"account.banking.mandate",
string="Direct Debit Mandate",
ondelete="restrict",
check_company=True,
)

View File

@@ -230,8 +230,10 @@ class TestInvoiceMandate(TransactionCase):
bank_journal = self.env["account.journal"].search(
[
("type", "=", "bank"),
('company_id', '=', self.company.id),
], limit=1)
("company_id", "=", self.company.id),
],
limit=1,
)
self.mode_inbound_acme.variable_journal_ids = bank_journal
self.mode_inbound_acme.payment_method_id.mandate_required = True
self.mode_inbound_acme.payment_order_ok = True
@@ -284,9 +286,10 @@ class TestInvoiceMandate(TransactionCase):
"move_type": "out_invoice",
"company_id": self.company.id,
"journal_id": self.env["account.journal"]
.search([
("type", "=", "sale"),
('company_id', '=', self.company.id)], limit=1)
.search(
[("type", "=", "sale"), ("company_id", "=", self.company.id)],
limit=1,
)
.id,
"invoice_line_ids": invoice_vals,
}

View File

@@ -37,7 +37,11 @@
confirm="You should set a mandate back to draft only if you cancelled it by mistake. Do you want to continue?"
invisible="context.get('mandate_bank_partner_view')"
/>
<field name="state" widget="statusbar" statusbar_visible="draft,valid,expired"/>
<field
name="state"
widget="statusbar"
statusbar_visible="draft,valid,expired"
/>
</header>
<sheet>
<div class="oe_button_box" name="button_box" />
@@ -64,15 +68,17 @@
invisible="context.get('mandate_bank_partner_view')"
readonly="True"
/>
<field name="signature_date"
options="{'datepicker': {'warn_future': true}}"/>
<field
name="signature_date"
options="{'datepicker': {'warn_future': true}}"
/>
<field name="scan" />
<field name="last_debit_date" />
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity"/>
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
@@ -148,11 +154,14 @@
groups="account_payment_order.group_account_payment"
attrs="{'invisible': ['|', ('id', '=', False), ('state', '!=', 'cancel')]}"
/>
<field name="state" widget="badge"
<field
name="state"
widget="badge"
decoration-info="state == 'draft'"
decoration-success="state == 'valid'"
decoration-muted="state == 'cancel'"
decoration-warning="state == 'expired'"/>
decoration-warning="state == 'expired'"
/>
</tree>
</field>
</record>

View File

@@ -0,0 +1 @@
../../../../account_banking_mandate

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)