Skip to content

Commit

Permalink
[IMP] l10n_us_form_1099: black, isort
Browse files Browse the repository at this point in the history
  • Loading branch information
HviorForgeFlow committed Dec 31, 2019
1 parent c86c245 commit 4995e2f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 33 deletions.
9 changes: 3 additions & 6 deletions l10n_us_form_1099/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@
"name": "US Form 1099",
"version": "12.0.1.2.0",
"author": "Open Source Integrators, "
"Brian McMaster, "
"Odoo Community Association (OCA)",
"Brian McMaster, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"summary": "Manage 1099 Types and Suppliers",
"category": "Customers",
"maintainer": "Open Source Integrators",
"website": "https://github.com/OCA/l10n-usa",
"depends": [
"contacts",
"account",
],
"depends": ["contacts", "account"],
"data": [
"data/type_1099_data.xml",
"data/box_1099_misc_data.xml",
Expand Down
6 changes: 1 addition & 5 deletions l10n_us_form_1099/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,4 @@
# Copyright (C) 2019 Brian McMaster
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
type_1099,
box_1099_misc,
res_partner
)
from . import type_1099, box_1099_misc, res_partner
4 changes: 2 additions & 2 deletions l10n_us_form_1099/models/box_1099_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Box1099Misc(models.Model):
_name = 'box.1099.misc'
_description = '1099-MISC Box'
_name = "box.1099.misc"
_description = "1099-MISC Box"

name = fields.Char()
11 changes: 5 additions & 6 deletions l10n_us_form_1099/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@
class ResPartner(models.Model):
_inherit = "res.partner"

is_1099 = fields.Boolean('Is a 1099?')
type_1099_id = fields.Many2one('type.1099', string='1099 Type')
box_1099_misc_id = fields.Many2one('box.1099.misc',
string='1099-MISC Box')
is_1099 = fields.Boolean("Is a 1099?")
type_1099_id = fields.Many2one("type.1099", string="1099 Type")
box_1099_misc_id = fields.Many2one("box.1099.misc", string="1099-MISC Box")

@api.onchange('is_1099')
@api.onchange("is_1099")
def _on_change_is_1099(self):
if self.is_1099 and not self.supplier:
self.supplier = True

@api.onchange('supplier')
@api.onchange("supplier")
def _on_change_supplier(self):
if self.is_1099 and not self.supplier:
self.is_1099 = False
4 changes: 2 additions & 2 deletions l10n_us_form_1099/models/type_1099.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Type1099(models.Model):
_name = 'type.1099'
_description = '1099 Type'
_name = "type.1099"
_description = "1099 Type"

name = fields.Char()
18 changes: 9 additions & 9 deletions l10n_us_form_1099/reports/account_payment_1099_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ class AccountPayment1099Report(models.Model):
_description = "1099 Payment Statistics"
_auto = False

date = fields.Date('Payment Date', readonly=True)
amount = fields.Float('Payment Amount', readonly=True)
vendor_id = fields.Many2one('res.partner', 'Vendor', readonly=True)
type_1099 = fields.Many2one('type.1099', '1099 Type', readonly=True)
box_1099_misc = fields.Many2one('box.1099.misc', '1099-MISC Box',
readonly=True)
date = fields.Date("Payment Date", readonly=True)
amount = fields.Float("Payment Amount", readonly=True)
vendor_id = fields.Many2one("res.partner", "Vendor", readonly=True)
type_1099 = fields.Many2one("type.1099", "1099 Type", readonly=True)
box_1099_misc = fields.Many2one("box.1099.misc", "1099-MISC Box", readonly=True)

def _select(self):
return """
Expand Down Expand Up @@ -47,13 +46,14 @@ def _where(self):
@api.model_cr
def init(self):
tools.drop_view_if_exists(self._cr, self._table)
self._cr.execute("""
self._cr.execute(
"""
CREATE OR REPLACE VIEW %s AS (
%s
%s
%s
%s
)
""" % (self._table, self._select(), self._from(),
self._join(), self._where())
""",
(self._table, self._select(), self._from(), self._join(), self._where()),
)
5 changes: 2 additions & 3 deletions l10n_us_form_1099/tests/test_l10n_us_form_1099.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@


class TestL10nUsForm1099(TransactionCase):

def test_on_change_is_1099(self):
"""
Test that supplier is True if is_1099 is True
"""
partner = self.env.ref('base.res_partner_2')
partner = self.env.ref("base.res_partner_2")
partner.is_1099 = True
partner._on_change_is_1099()
self.assertTrue(partner.supplier)
Expand All @@ -20,7 +19,7 @@ def test_on_change_supplier(self):
"""
Test that is_1099 is False if supplier is False
"""
partner = self.env.ref('base.res_partner_2')
partner = self.env.ref("base.res_partner_2")
partner.supplier = False
partner._on_change_supplier()
self.assertFalse(partner.is_1099)

0 comments on commit 4995e2f

Please sign in to comment.