-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] fieldservice_isp_account: black, isort, prettier
- Loading branch information
Showing
12 changed files
with
425 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
|
||
<record id="field_service_travel_time" model="product.template"> | ||
<field name="name">FSM Travel Time</field> | ||
<field name="categ_id" ref="product.product_category_all"/> | ||
<field name="categ_id" ref="product.product_category_all" /> | ||
<field name="type">service</field> | ||
<field name="uom_id" ref="uom.product_uom_hour"/> | ||
<field name="uom_po_id" ref="uom.product_uom_hour"/> | ||
<field name="uom_id" ref="uom.product_uom_hour" /> | ||
<field name="uom_po_id" ref="uom.product_uom_hour" /> | ||
<field name="description_sale">Travel time for Field Service | ||
Employees | ||
</field> | ||
</record> | ||
|
||
<record id="field_service_regular_time" model="product.template"> | ||
<field name="name">FSM Regular Time</field> | ||
<field name="categ_id" ref="product.product_category_all"/> | ||
<field name="categ_id" ref="product.product_category_all" /> | ||
<field name="type">service</field> | ||
<field name="uom_id" ref="uom.product_uom_hour"/> | ||
<field name="uom_po_id" ref="uom.product_uom_hour"/> | ||
<field name="uom_id" ref="uom.product_uom_hour" /> | ||
<field name="uom_po_id" ref="uom.product_uom_hour" /> | ||
<field name="description_sale">Regular time for Field Service | ||
Employees | ||
</field> | ||
</record> | ||
|
||
<record id="field_service_overtime" model="product.template"> | ||
<field name="name">FSM Overtime</field> | ||
<field name="categ_id" ref="product.product_category_all"/> | ||
<field name="categ_id" ref="product.product_category_all" /> | ||
<field name="type">service</field> | ||
<field name="uom_id" ref="uom.product_uom_hour"/> | ||
<field name="uom_po_id" ref="uom.product_uom_hour"/> | ||
<field name="uom_id" ref="uom.product_uom_hour" /> | ||
<field name="uom_po_id" ref="uom.product_uom_hour" /> | ||
<field name="description_sale">Overtime for Field Service Employees | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,39 @@ | ||
# Copyright (C) 2018 - TODAY, Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, models, _ | ||
from odoo import _, api, models | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class AccountInvoiceLine(models.Model): | ||
_inherit = "account.invoice.line" | ||
|
||
@api.onchange('product_id', 'quantity') | ||
@api.onchange("product_id", "quantity") | ||
def onchange_product_id(self): | ||
for line in self: | ||
if line.fsm_order_id: | ||
partner = line.fsm_order_id.person_id and\ | ||
line.fsm_order_id.person_id.partner_id or False | ||
partner = ( | ||
line.fsm_order_id.person_id | ||
and line.fsm_order_id.person_id.partner_id | ||
or False | ||
) | ||
if not partner: | ||
raise ValidationError( | ||
_("Please set the field service worker.")) | ||
raise ValidationError(_("Please set the field service worker.")) | ||
fpos = partner.property_account_position_id | ||
tmpl = line.product_id.product_tmpl_id | ||
if line.product_id: | ||
accounts = tmpl.get_product_accounts() | ||
supinfo = self.env['product.supplierinfo'].search( | ||
[('name', '=', partner.id), | ||
('product_tmpl_id', '=', tmpl.id), | ||
('min_qty', '<=', line.quantity)], | ||
order='min_qty DESC') | ||
line.price_unit = \ | ||
supinfo = self.env["product.supplierinfo"].search( | ||
[ | ||
("name", "=", partner.id), | ||
("product_tmpl_id", "=", tmpl.id), | ||
("min_qty", "<=", line.quantity), | ||
], | ||
order="min_qty DESC", | ||
) | ||
line.price_unit = ( | ||
supinfo and supinfo[0].price or tmpl.standard_price | ||
line.account_id = accounts.get('expense', False) | ||
line.invoice_line_tax_ids = fpos.\ | ||
map_tax(tmpl.supplier_taxes_id) | ||
) | ||
line.account_id = accounts.get("expense", False) | ||
line.invoice_line_tax_ids = fpos.map_tax(tmpl.supplier_taxes_id) | ||
line.name = line.product_id.name |
Oops, something went wrong.