2
0

[IMP] account_spread_cost_revenue: black, isort, prettier

This commit is contained in:
Kitti U 2021-10-01 14:37:13 +07:00 committed by Andrea Stirpe
parent 22e57f872e
commit 01a2998bf2
5 changed files with 45 additions and 18 deletions

View File

@ -9,7 +9,7 @@
"author": "Onestein,Odoo Community Association (OCA)", "author": "Onestein,Odoo Community Association (OCA)",
"maintainers": ["astirpe"], "maintainers": ["astirpe"],
"license": "AGPL-3", "license": "AGPL-3",
"website": "https://github.com/OCA/account-financial-tools/", "website": "https://github.com/OCA/account-financial-tools",
"category": "Accounting & Finance", "category": "Accounting & Finance",
"depends": ["account"], "depends": ["account"],
"data": [ "data": [

View File

@ -63,10 +63,22 @@ class AccountSpread(models.Model):
compute="_compute_deprecated_accounts" compute="_compute_deprecated_accounts"
) )
is_debit_account_deprecated = fields.Boolean(compute="_compute_deprecated_accounts") is_debit_account_deprecated = fields.Boolean(compute="_compute_deprecated_accounts")
unspread_amount = fields.Float(digits="Account", compute="_compute_amounts",) unspread_amount = fields.Float(
unposted_amount = fields.Float(digits="Account", compute="_compute_amounts",) digits="Account",
posted_amount = fields.Float(digits="Account", compute="_compute_amounts",) compute="_compute_amounts",
total_amount = fields.Float(digits="Account", compute="_compute_amounts",) )
unposted_amount = fields.Float(
digits="Account",
compute="_compute_amounts",
)
posted_amount = fields.Float(
digits="Account",
compute="_compute_amounts",
)
total_amount = fields.Float(
digits="Account",
compute="_compute_amounts",
)
all_posted = fields.Boolean(compute="_compute_all_posted", store=True) all_posted = fields.Boolean(compute="_compute_all_posted", store=True)
line_ids = fields.One2many( line_ids = fields.One2many(
"account.spread.line", "spread_id", string="Spread Lines" "account.spread.line", "spread_id", string="Spread Lines"
@ -92,7 +104,9 @@ class AccountSpread(models.Model):
store=True, store=True,
) )
invoice_id = fields.Many2one( invoice_id = fields.Many2one(
related="invoice_line_id.move_id", readonly=True, store=True, related="invoice_line_id.move_id",
readonly=True,
store=True,
) )
estimated_amount = fields.Float(digits="Account") estimated_amount = fields.Float(digits="Account")
company_id = fields.Many2one( company_id = fields.Many2one(

View File

@ -178,10 +178,23 @@ class AccountSpreadTemplateAuto(models.Model):
ondelete="cascade", ondelete="cascade",
index=True, index=True,
) )
company_id = fields.Many2one(related="template_id.company_id", store=True,) company_id = fields.Many2one(
name = fields.Char(required=True, default="/",) related="template_id.company_id",
product_id = fields.Many2one(comodel_name="product.product", string="Product",) store=True,
account_id = fields.Many2one(comodel_name="account.account", string="Account",) )
analytic_account_id = fields.Many2one( name = fields.Char(
comodel_name="account.analytic.account", string="Analytic", required=True,
default="/",
)
product_id = fields.Many2one(
comodel_name="product.product",
string="Product",
)
account_id = fields.Many2one(
comodel_name="account.account",
string="Account",
)
analytic_account_id = fields.Many2one(
comodel_name="account.analytic.account",
string="Analytic",
) )

View File

@ -1,4 +1,4 @@
odoo.define("account_spread_cost_revenue.widget", function(require) { odoo.define("account_spread_cost_revenue.widget", function (require) {
"use strict"; "use strict";
var AbstractField = require("web.AbstractField"); var AbstractField = require("web.AbstractField");
@ -16,7 +16,7 @@ odoo.define("account_spread_cost_revenue.widget", function(require) {
/** /**
* @override * @override
*/ */
isSet: function() { isSet: function () {
return this.value !== "unavailable"; return this.value !== "unavailable";
}, },
@ -24,7 +24,7 @@ odoo.define("account_spread_cost_revenue.widget", function(require) {
* @override * @override
* @private * @private
*/ */
_render: function() { _render: function () {
var className = ""; var className = "";
var style = "btn fa fa-arrow-circle-right o_spread_line "; var style = "btn fa fa-arrow-circle-right o_spread_line ";
var title = ""; var title = "";
@ -45,7 +45,7 @@ odoo.define("account_spread_cost_revenue.widget", function(require) {
* @private * @private
* @param {MouseEvent} event * @param {MouseEvent} event
*/ */
_onClick: function(event) { _onClick: function (event) {
event.stopPropagation(); event.stopPropagation();
this.trigger_up("button_clicked", { this.trigger_up("button_clicked", {
attrs: { attrs: {

View File

@ -46,7 +46,8 @@ class AccountSpreadInvoiceLineLinkWizard(models.TransientModel):
store=True, store=True,
) )
spread_invoice_type_domain_ids = fields.One2many( spread_invoice_type_domain_ids = fields.One2many(
"account.spread", compute="_compute_spread_invoice_type_domain", "account.spread",
compute="_compute_spread_invoice_type_domain",
) )
spread_id = fields.Many2one( spread_id = fields.Many2one(
"account.spread", "account.spread",
@ -115,7 +116,6 @@ class AccountSpreadInvoiceLineLinkWizard(models.TransientModel):
def _inverse_spread_journal_account(self): def _inverse_spread_journal_account(self):
"""Keep this for making the fields editable""" """Keep this for making the fields editable"""
pass
@api.depends("company_id", "invoice_type") @api.depends("company_id", "invoice_type")
def _compute_spread_invoice_type_domain(self): def _compute_spread_invoice_type_domain(self):