From 963e16f7e9dc6c1d7918eb8029bb2339d91a4c72 Mon Sep 17 00:00:00 2001 From: brian10048 Date: Tue, 26 Nov 2019 16:59:14 -0500 Subject: [PATCH 01/44] [IMP] fieldservice_account: Simplify module - This change removes most of the invoicing logic from fieldservice_account and puts it into its own module --- fieldservice_account_analytic/README.rst | 121 +++++ fieldservice_account_analytic/__init__.py | 4 + fieldservice_account_analytic/__manifest__.py | 25 + .../data/ir_rule.xml | 28 ++ .../models/account_invoice_line.py | 21 + .../models/analytic_account.py | 28 ++ .../models/fsm_location.py | 11 + .../readme/CONFIGURE.rst | 4 + .../readme/CONTRIBUTORS.rst | 3 + .../readme/CREDITS.rst | 3 + .../readme/DESCRIPTION.rst | 2 + .../readme/INSTALL.rst | 1 + .../readme/USAGE.rst | 1 + .../security/ir.model.access.csv | 5 + .../static/description/icon.png | Bin 0 -> 17808 bytes .../static/description/index.html | 460 ++++++++++++++++++ .../views/fsm_location.xml | 20 + 17 files changed, 737 insertions(+) create mode 100644 fieldservice_account_analytic/README.rst create mode 100644 fieldservice_account_analytic/__init__.py create mode 100644 fieldservice_account_analytic/__manifest__.py create mode 100644 fieldservice_account_analytic/data/ir_rule.xml create mode 100644 fieldservice_account_analytic/models/account_invoice_line.py create mode 100644 fieldservice_account_analytic/models/analytic_account.py create mode 100644 fieldservice_account_analytic/models/fsm_location.py create mode 100644 fieldservice_account_analytic/readme/CONFIGURE.rst create mode 100644 fieldservice_account_analytic/readme/CONTRIBUTORS.rst create mode 100644 fieldservice_account_analytic/readme/CREDITS.rst create mode 100644 fieldservice_account_analytic/readme/DESCRIPTION.rst create mode 100644 fieldservice_account_analytic/readme/INSTALL.rst create mode 100644 fieldservice_account_analytic/readme/USAGE.rst create mode 100644 fieldservice_account_analytic/security/ir.model.access.csv create mode 100644 fieldservice_account_analytic/static/description/icon.png create mode 100644 fieldservice_account_analytic/static/description/index.html create mode 100644 fieldservice_account_analytic/views/fsm_location.xml diff --git a/fieldservice_account_analytic/README.rst b/fieldservice_account_analytic/README.rst new file mode 100644 index 0000000000..278e295c55 --- /dev/null +++ b/fieldservice_account_analytic/README.rst @@ -0,0 +1,121 @@ +========================== +Field Service - Accounting +========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github + :target: https://github.com/OCA/field-service/tree/12.0/fieldservice_account + :alt: OCA/field-service +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_account + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/264/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the ability to track employee time and contractor +costs for Field Service Orders. It also adds functionality to create +a customer invoice and a vendor bill when a Field Service Order is +completed. + +**Table of contents** + +.. contents:: + :local: + +Installation +============ + +No special installation instructions + +Configuration +============= + +To configure this module, you need to: + +* Go to Field Service > Master Data > Locations +* Create or select a location and set their analytic account + +Usage +===== + +To use the module: + +On a field service order, open the "Accounting" tab. Depending on +whether the logged in user or an employee or not, they will see +either a place to enter timesheet records or contractor costs. + +The total cost of the order is calculated based on the entries in +the employee timesheet entries and contractor costs. + +When an order is completed, a customer invoice will be generated for +the employee time and the contractor costs. A vendor bill will be +created for the contractor costs. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Open Source Integrators + +Contributors +~~~~~~~~~~~~ + +* Michael Allen +* Serpent Consulting Services Pvt. Ltd. + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Open Source Integrators + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-osimallen| image:: https://github.com/osimallen.png?size=40px + :target: https://github.com/osimallen + :alt: osimallen + +Current `maintainer `__: + +|maintainer-osimallen| + +This module is part of the `OCA/field-service `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fieldservice_account_analytic/__init__.py b/fieldservice_account_analytic/__init__.py new file mode 100644 index 0000000000..66ca882fcc --- /dev/null +++ b/fieldservice_account_analytic/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2018 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py new file mode 100644 index 0000000000..88cbae6efc --- /dev/null +++ b/fieldservice_account_analytic/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright (C) 2018 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Field Service - Analytic Accounting', + 'summary': """Track analytic accounts on Field Service locations + and orders""", + 'version': '12.0.2.0.1', + 'category': 'Field Service', + 'author': 'Open Source Integrators, Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/field-service', + 'depends': [ + 'fieldservice_account', + 'analytic', + 'product', + ], + 'data': [ + 'data/ir_rule.xml', + 'security/ir.model.access.csv', + 'views/fsm_location.xml', + ], + 'license': 'AGPL-3', + 'development_status': 'Beta', + 'maintainers': ['osimallen'], +} diff --git a/fieldservice_account_analytic/data/ir_rule.xml b/fieldservice_account_analytic/data/ir_rule.xml new file mode 100644 index 0000000000..622bca4ee7 --- /dev/null +++ b/fieldservice_account_analytic/data/ir_rule.xml @@ -0,0 +1,28 @@ + + + + + account.analytic.line.fsm.manager + + + [(1, '=', 1)] + + + + + + + + + account.analytic.line.fsm.dispatcher + + + [(1, '=', 1)] + + + + + + + + diff --git a/fieldservice_account_analytic/models/account_invoice_line.py b/fieldservice_account_analytic/models/account_invoice_line.py new file mode 100644 index 0000000000..ca90dab2b1 --- /dev/null +++ b/fieldservice_account_analytic/models/account_invoice_line.py @@ -0,0 +1,21 @@ +# 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.exceptions import ValidationError + + +class AccountInvoiceLine(models.Model): + _inherit = "account.invoice.line" + + @api.model + def create(self, vals): + order = self.env['fsm.order'].browse(vals.get('fsm_order_id')) + if order: + if order.location_id.analytic_account_id: + vals['account_analytic_id'] = order.location_id.\ + analytic_account_id.id + else: + raise ValidationError(_("No analytic account " + "set on the order's Location.")) + return super(AccountInvoiceLine, self).create(vals) diff --git a/fieldservice_account_analytic/models/analytic_account.py b/fieldservice_account_analytic/models/analytic_account.py new file mode 100644 index 0000000000..62bb9c12a7 --- /dev/null +++ b/fieldservice_account_analytic/models/analytic_account.py @@ -0,0 +1,28 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models, _ +from odoo.exceptions import ValidationError + + +class AccountAnalyticLine(models.Model): + _inherit = 'account.analytic.line' + + fsm_order_id = fields.Many2one('fsm.order', string='FSM Order') + product_id = fields.Many2one('product.product', string='Time Type') + + @api.model + def create(self, vals): + order = self.env['fsm.order'].browse(vals.get('fsm_order_id')) + if order: + if order.location_id.analytic_account_id: + vals['account_id'] = order.location_id.analytic_account_id.id + else: + raise ValidationError(_("No analytic account set " + "on the order's Location.")) + return super(AccountAnalyticLine, self).create(vals) + + @api.onchange('product_id') + def onchange_product_id(self): + if self.product_id: + self.name = self.product_id.name diff --git a/fieldservice_account_analytic/models/fsm_location.py b/fieldservice_account_analytic/models/fsm_location.py new file mode 100644 index 0000000000..07d4f5c450 --- /dev/null +++ b/fieldservice_account_analytic/models/fsm_location.py @@ -0,0 +1,11 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class FSMLocation(models.Model): + _inherit = 'fsm.location' + + analytic_account_id = fields.Many2one('account.analytic.account', + string='Analytic Account') diff --git a/fieldservice_account_analytic/readme/CONFIGURE.rst b/fieldservice_account_analytic/readme/CONFIGURE.rst new file mode 100644 index 0000000000..ecc5d5f7a7 --- /dev/null +++ b/fieldservice_account_analytic/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +To configure this module, you need to: + +* Go to Field Service > Master Data > Locations +* Create or select a location and set their analytic account diff --git a/fieldservice_account_analytic/readme/CONTRIBUTORS.rst b/fieldservice_account_analytic/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..e9143c46f2 --- /dev/null +++ b/fieldservice_account_analytic/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Michael Allen +* Serpent Consulting Services Pvt. Ltd. +* Brian McMaster diff --git a/fieldservice_account_analytic/readme/CREDITS.rst b/fieldservice_account_analytic/readme/CREDITS.rst new file mode 100644 index 0000000000..0eff0acf4e --- /dev/null +++ b/fieldservice_account_analytic/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Open Source Integrators diff --git a/fieldservice_account_analytic/readme/DESCRIPTION.rst b/fieldservice_account_analytic/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..67dffec1b1 --- /dev/null +++ b/fieldservice_account_analytic/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module adds the ability to track your analytic accounts on field +service orders. diff --git a/fieldservice_account_analytic/readme/INSTALL.rst b/fieldservice_account_analytic/readme/INSTALL.rst new file mode 100644 index 0000000000..54fea7becb --- /dev/null +++ b/fieldservice_account_analytic/readme/INSTALL.rst @@ -0,0 +1 @@ +No special installation instructions diff --git a/fieldservice_account_analytic/readme/USAGE.rst b/fieldservice_account_analytic/readme/USAGE.rst new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/fieldservice_account_analytic/readme/USAGE.rst @@ -0,0 +1 @@ + diff --git a/fieldservice_account_analytic/security/ir.model.access.csv b/fieldservice_account_analytic/security/ir.model.access.csv new file mode 100644 index 0000000000..07c8b38ef7 --- /dev/null +++ b/fieldservice_account_analytic/security/ir.model.access.csv @@ -0,0 +1,5 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_analytic_line_fsm_manager,account.analytic.line.manager,model_account_analytic_line,fieldservice.group_fsm_manager,1,1,1,1 +access_account_analytic_line_fsm_dispatcher,account.analytic.line.dispatcher,model_account_analytic_line,fieldservice.group_fsm_dispatcher,1,1,1,0 +access_analytic_account_fsm_manager,account.analytic.account.manager,analytic.model_account_analytic_account,fieldservice.group_fsm_manager,1,1,1,1 +access_analytic_account_fsm_dispatcher,account.analytic.account.dispatcher,analytic.model_account_analytic_account,fieldservice.group_fsm_dispatcher,1,1,1,0 diff --git a/fieldservice_account_analytic/static/description/icon.png b/fieldservice_account_analytic/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..955674d8f0b8c47de3ffa9db25cb109fbe4a1091 GIT binary patch literal 17808 zcmeHvc;{H3sucZElF-G)hC-+rdy@|cVP3o7ETY&& zJl-5>)T;P#Y>Z2k74p9gK&J2CJC5%@{WsV@`$(=#w|Cf>44L@opuIqTY_XMpYif9< zJEhZ)*(Ciawd2E4g!g{`tf-6DV*W@FZ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#JJ}~40%m2>j zGWwXHJI2OAP%xvDU9Fj)f3zvya2lRc-*b24QTTj4YW{ZA8xplo{PTs)6LjtvE4+oq zO>t&E^fTM;A=cV%8JzPn3PB&kAXl2KhW?Nd85wzJlx#0ijShXJW?6qNFT5WHgX*`4 znAw6(otBnuX*CHI7J32YAFrpeFe*%n?tiX`q=R&agxqy8y^(5Q$_ZB`XM!tI*GZbX z(X#_0LZp6h^6*3~mEHhT0b`4Yup6AXVlpn+Q7tknyZpxvuEohyH{$F=!8mZnEQAjI zQ46(s-Yaz;wNUgv&W5ThKB{W3(9dUm{iObJMRL?`A=vQt%jg)l{#&O4GI+#Kwjew0nySosF+@T>xBYngWHD;bxF;7b-%>cT74(~!j za)0gM!|>0eyS75X+B()YfAk)l$Phu_s10UQ8K<;`o;##M&SgtTuC$&4T{~TLYh~dK zLm$LxbZ^z;{Wl*6GW5?iFeeetYLG-nRdM6TR)K?1<#+hD&;m{|(ME|BrHBci#pV0oF(@prIFR=LEDdC|` z$6e@>ZBk~p1x{c}1ap=W1^2W?Z=AMy=;mO76+#5-nyl4XmK<5P7YCL|M_(NIF>`>^ z*RLK*lO8nwDMbFyjM$-Z6Jc-2q&bOb^^g1dhQG`X-*=g!K5kpSk08tH`uba$AEu(3 gUHh>HCdQ7*k1fAW1vhU(MTsEtw^U^Fq)ngxAO8EYHUIzs literal 0 HcmV?d00001 diff --git a/fieldservice_account_analytic/static/description/index.html b/fieldservice_account_analytic/static/description/index.html new file mode 100644 index 0000000000..be45db7518 --- /dev/null +++ b/fieldservice_account_analytic/static/description/index.html @@ -0,0 +1,460 @@ + + + + + + +Field Service - Accounting + + + +
+

Field Service - Accounting

+ + +

Beta License: AGPL-3 OCA/field-service Translate me on Weblate Try me on Runbot

+

This module adds the ability to track employee time and contractor +costs for Field Service Orders. It also adds functionality to create +a customer invoice and a vendor bill when a Field Service Order is +completed.

+

Table of contents

+ +
+

Installation

+

No special installation instructions

+
+
+

Configuration

+

To configure this module, you need to:

+
    +
  • Go to Field Service > Master Data > Locations
  • +
  • Create or select a location and set their analytic account
  • +
+
+
+

Usage

+

To use the module:

+

On a field service order, open the “Accounting” tab. Depending on +whether the logged in user or an employee or not, they will see +either a place to enter timesheet records or contractor costs.

+

The total cost of the order is calculated based on the entries in +the employee timesheet entries and contractor costs.

+

When an order is completed, a customer invoice will be generated for +the employee time and the contractor costs. A vendor bill will be +created for the contractor costs.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Open Source Integrators
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The development of this module has been financially supported by:

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

osimallen

+

This module is part of the OCA/field-service project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/fieldservice_account_analytic/views/fsm_location.xml b/fieldservice_account_analytic/views/fsm_location.xml new file mode 100644 index 0000000000..80477e2838 --- /dev/null +++ b/fieldservice_account_analytic/views/fsm_location.xml @@ -0,0 +1,20 @@ + + + + + fsm.location.form.analytic + fsm.location + + + + + + + + + + + + + From e5079688c63d8baa6e727bed5382e52d96be1333 Mon Sep 17 00:00:00 2001 From: hparfr Date: Wed, 27 Nov 2019 15:30:48 +0100 Subject: [PATCH 02/44] Clean up customer_id (billing), cost and change link between account_invoice* and fsm_order --- fieldservice_account_analytic/__init__.py | 1 + fieldservice_account_analytic/__manifest__.py | 8 +++ .../demo/fsm_location.xml | 20 ++++++ .../migrations/12.0.2.0.0/post-migration.py | 10 +++ .../models/fsm_location.py | 10 ++- .../models/fsm_location_person.py | 13 ++++ .../models/fsm_order.py | 47 ++++++++++++++ .../readme/DESCRIPTION.rst | 2 + .../report/fsm_order_report_template.xml | 16 +++++ .../views/fsm_location.xml | 46 +++++++++++--- .../views/fsm_order.xml | 62 +++++++++++++++++++ .../views/fsm_person.xml | 26 ++++++++ .../views/fsm_route.xml | 14 +++++ .../wizard/__init__.py | 1 + .../wizard/fsm_wizard.py | 13 ++++ 15 files changed, 281 insertions(+), 8 deletions(-) create mode 100644 fieldservice_account_analytic/demo/fsm_location.xml create mode 100644 fieldservice_account_analytic/migrations/12.0.2.0.0/post-migration.py create mode 100644 fieldservice_account_analytic/models/fsm_location_person.py create mode 100644 fieldservice_account_analytic/models/fsm_order.py create mode 100644 fieldservice_account_analytic/report/fsm_order_report_template.xml create mode 100644 fieldservice_account_analytic/views/fsm_order.xml create mode 100644 fieldservice_account_analytic/views/fsm_person.xml create mode 100644 fieldservice_account_analytic/views/fsm_route.xml create mode 100644 fieldservice_account_analytic/wizard/__init__.py create mode 100644 fieldservice_account_analytic/wizard/fsm_wizard.py diff --git a/fieldservice_account_analytic/__init__.py b/fieldservice_account_analytic/__init__.py index 66ca882fcc..f272a247d4 100644 --- a/fieldservice_account_analytic/__init__.py +++ b/fieldservice_account_analytic/__init__.py @@ -2,3 +2,4 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models +from . import wizard \ No newline at end of file diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index 88cbae6efc..4d93f31191 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -17,8 +17,16 @@ 'data': [ 'data/ir_rule.xml', 'security/ir.model.access.csv', + 'report/fsm_order_report_template.xml', 'views/fsm_location.xml', + 'views/fsm_order.xml', + 'views/fsm_person.xml', + 'views/fsm_route.xml', ], + 'demo': [ + 'demo/fsm_location.xml', + ], + 'pre_init_hook': 'pre_init_hook', 'license': 'AGPL-3', 'development_status': 'Beta', 'maintainers': ['osimallen'], diff --git a/fieldservice_account_analytic/demo/fsm_location.xml b/fieldservice_account_analytic/demo/fsm_location.xml new file mode 100644 index 0000000000..fc3a0e6201 --- /dev/null +++ b/fieldservice_account_analytic/demo/fsm_location.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/fieldservice_account_analytic/migrations/12.0.2.0.0/post-migration.py b/fieldservice_account_analytic/migrations/12.0.2.0.0/post-migration.py new file mode 100644 index 0000000000..7218f7ce5e --- /dev/null +++ b/fieldservice_account_analytic/migrations/12.0.2.0.0/post-migration.py @@ -0,0 +1,10 @@ +# Copyright (C) 2019, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +def migrate(env, version): + if not version: + return + + env.execute("UPDATE fsm_order SET bill_to = 'location' " + "WHERE bill_to IS NULL;") diff --git a/fieldservice_account_analytic/models/fsm_location.py b/fieldservice_account_analytic/models/fsm_location.py index 07d4f5c450..92611bcbc0 100644 --- a/fieldservice_account_analytic/models/fsm_location.py +++ b/fieldservice_account_analytic/models/fsm_location.py @@ -1,7 +1,7 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import fields, models, api class FSMLocation(models.Model): @@ -9,3 +9,11 @@ class FSMLocation(models.Model): analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account') + + customer_id = fields.Many2one( + 'res.partner', string='Billed Customer', required=True, + ondelete='restrict', auto_join=True, track_visibility='onchange') + + @api.onchange('fsm_parent_id') + def _onchange_fsm_parent_id_account(self): + self.customer_id = self.fsm_parent_id.customer_id or False diff --git a/fieldservice_account_analytic/models/fsm_location_person.py b/fieldservice_account_analytic/models/fsm_location_person.py new file mode 100644 index 0000000000..d6e3a1f2e1 --- /dev/null +++ b/fieldservice_account_analytic/models/fsm_location_person.py @@ -0,0 +1,13 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class FSMLocationPerson(models.Model): + _inherit = 'fsm.location.person' + + customer_id = fields.Many2one('res.partner', string='Billed Customer', + required=True, ondelete='restrict', + auto_join=True, + track_visibility='onchange') diff --git a/fieldservice_account_analytic/models/fsm_order.py b/fieldservice_account_analytic/models/fsm_order.py new file mode 100644 index 0000000000..d88ac6091a --- /dev/null +++ b/fieldservice_account_analytic/models/fsm_order.py @@ -0,0 +1,47 @@ +# Copyright (C) 2018 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class FSMOrder(models.Model): + _inherit = 'fsm.order' + + total_cost = fields.Float(compute='_compute_total_cost', + string='Total Cost') + bill_to = fields.Selection([('location', 'Bill Location'), + ('contact', 'Bill Contact')], + string="Bill to", + required=True, + default="location") + customer_id = fields.Many2one('res.partner', string='Contact', + domain=[('customer', '=', True)], + change_default=True, + index=True, + track_visibility='always') + + def _compute_total_cost(self): + """ To be overridden as needed from other modules """ + for order in self: + order.total_cost = 0.0 + + @api.onchange('location_id') + def _onchange_location_id_customer_account(self): + if self.location_id: + return {'domain': {'customer_id': [('service_location_id', '=', + self.location_id.name)]}} + else: + return {'domain': {'customer_id': [('id', '!=', None)]}} + + @api.onchange('customer_id') + def _onchange_customer_id_location(self): + if self.customer_id: + self.location_id = self.customer_id.service_location_id + + @api.multi + def write(self, vals): + res = super(FSMOrder, self).write(vals) + for order in self: + if 'customer_id' not in vals and order.customer_id is False: + order.customer_id = order.location_id.customer_id.id + return res diff --git a/fieldservice_account_analytic/readme/DESCRIPTION.rst b/fieldservice_account_analytic/readme/DESCRIPTION.rst index 67dffec1b1..2941a900e3 100644 --- a/fieldservice_account_analytic/readme/DESCRIPTION.rst +++ b/fieldservice_account_analytic/readme/DESCRIPTION.rst @@ -1,2 +1,4 @@ This module adds the ability to track your analytic accounts on field service orders. +It also adds the option to track the billing partner for field service +locations and orders. diff --git a/fieldservice_account_analytic/report/fsm_order_report_template.xml b/fieldservice_account_analytic/report/fsm_order_report_template.xml new file mode 100644 index 0000000000..e00d75f2c7 --- /dev/null +++ b/fieldservice_account_analytic/report/fsm_order_report_template.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/fieldservice_account_analytic/views/fsm_location.xml b/fieldservice_account_analytic/views/fsm_location.xml index 80477e2838..3a5e23cdcf 100644 --- a/fieldservice_account_analytic/views/fsm_location.xml +++ b/fieldservice_account_analytic/views/fsm_location.xml @@ -1,19 +1,51 @@ + + + fsm.location.tree.accounting + fsm.location + + + + + + + + + - fsm.location.form.analytic + fsm.location.form.accounting fsm.location - + - - + + - + + + - + + + + + + + + + + fsm.location.search + fsm.location + + + + + + + + diff --git a/fieldservice_account_analytic/views/fsm_order.xml b/fieldservice_account_analytic/views/fsm_order.xml new file mode 100644 index 0000000000..db0ccee063 --- /dev/null +++ b/fieldservice_account_analytic/views/fsm_order.xml @@ -0,0 +1,62 @@ + + + + fsm.order.form.account + fsm.order + + + + + + + + + + + + + + + + + fsm.order.tree + fsm.order + + + + + + + + + + + fsm.order.kanban + fsm.order + + + + + + +
+ + + +
+
+
+
+ + + Orders + fsm.order + + + + + + + + +
diff --git a/fieldservice_account_analytic/views/fsm_person.xml b/fieldservice_account_analytic/views/fsm_person.xml new file mode 100644 index 0000000000..1e8581675e --- /dev/null +++ b/fieldservice_account_analytic/views/fsm_person.xml @@ -0,0 +1,26 @@ + + + + fsm.person.form + fsm.person + + + + + + + + + + + fsm.location.person.form + fsm.location.person + + + + + + + + + diff --git a/fieldservice_account_analytic/views/fsm_route.xml b/fieldservice_account_analytic/views/fsm_route.xml new file mode 100644 index 0000000000..4f1df4b04b --- /dev/null +++ b/fieldservice_account_analytic/views/fsm_route.xml @@ -0,0 +1,14 @@ + + + + fsm.route.form + fsm.route + + + + + + + + + diff --git a/fieldservice_account_analytic/wizard/__init__.py b/fieldservice_account_analytic/wizard/__init__.py new file mode 100644 index 0000000000..c013f4b7c3 --- /dev/null +++ b/fieldservice_account_analytic/wizard/__init__.py @@ -0,0 +1 @@ +from . import fsm_wizard diff --git a/fieldservice_account_analytic/wizard/fsm_wizard.py b/fieldservice_account_analytic/wizard/fsm_wizard.py new file mode 100644 index 0000000000..a3050f737d --- /dev/null +++ b/fieldservice_account_analytic/wizard/fsm_wizard.py @@ -0,0 +1,13 @@ +# Copyright (C) 2018 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models + + +class FSMWizard(models.TransientModel): + _inherit = 'fsm.wizard' + + def _prepare_fsm_location(self, partner): + res = super()._prepare_fsm_location(partner) + res['customer_id'] = partner.id + res['owner_id'] = partner.id + return res From 43b8d82d3e0c665be56c38701913c61c64c4630a Mon Sep 17 00:00:00 2001 From: hparfr Date: Wed, 27 Nov 2019 15:31:46 +0100 Subject: [PATCH 03/44] add missing files --- fieldservice_account_analytic/models/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 fieldservice_account_analytic/models/__init__.py diff --git a/fieldservice_account_analytic/models/__init__.py b/fieldservice_account_analytic/models/__init__.py new file mode 100644 index 0000000000..5c0842d55d --- /dev/null +++ b/fieldservice_account_analytic/models/__init__.py @@ -0,0 +1,10 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import ( + account_invoice, + analytic_account, + fsm_location, + fsm_location_person, + fsm_order, + fsm_person, +) From 535d8ec8c95fae65c1dbd6d241b7b2cf4e71fff7 Mon Sep 17 00:00:00 2001 From: brian10048 Date: Mon, 2 Dec 2019 17:32:47 -0500 Subject: [PATCH 04/44] [FIX] fieldservice_account: tests and travis --- fieldservice_account_analytic/__init__.py | 3 +- fieldservice_account_analytic/__manifest__.py | 1 - fieldservice_account_analytic/init_hook.py | 8 +++++ .../models/__init__.py | 3 +- .../tests/__init__.py | 4 +++ .../tests/test_fsm_account_wizard.py | 30 +++++++++++++++++++ .../views/fsm_person.xml | 26 ---------------- 7 files changed, 45 insertions(+), 30 deletions(-) create mode 100644 fieldservice_account_analytic/init_hook.py create mode 100644 fieldservice_account_analytic/tests/__init__.py create mode 100644 fieldservice_account_analytic/tests/test_fsm_account_wizard.py delete mode 100644 fieldservice_account_analytic/views/fsm_person.xml diff --git a/fieldservice_account_analytic/__init__.py b/fieldservice_account_analytic/__init__.py index f272a247d4..a60aec2546 100644 --- a/fieldservice_account_analytic/__init__.py +++ b/fieldservice_account_analytic/__init__.py @@ -2,4 +2,5 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models -from . import wizard \ No newline at end of file +from . import wizard +from .init_hook import pre_init_hook diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index 4d93f31191..5b98148f4f 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -20,7 +20,6 @@ 'report/fsm_order_report_template.xml', 'views/fsm_location.xml', 'views/fsm_order.xml', - 'views/fsm_person.xml', 'views/fsm_route.xml', ], 'demo': [ diff --git a/fieldservice_account_analytic/init_hook.py b/fieldservice_account_analytic/init_hook.py new file mode 100644 index 0000000000..730d91faac --- /dev/null +++ b/fieldservice_account_analytic/init_hook.py @@ -0,0 +1,8 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +def pre_init_hook(cr): + cr.execute("""ALTER TABLE "fsm_location" ADD "customer_id" INT;""") + cr.execute("""UPDATE "fsm_location" SET customer_id = owner_id + WHERE customer_id IS NULL;""") diff --git a/fieldservice_account_analytic/models/__init__.py b/fieldservice_account_analytic/models/__init__.py index 5c0842d55d..173f04e574 100644 --- a/fieldservice_account_analytic/models/__init__.py +++ b/fieldservice_account_analytic/models/__init__.py @@ -1,10 +1,9 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import ( - account_invoice, + account_invoice_line, analytic_account, fsm_location, fsm_location_person, fsm_order, - fsm_person, ) diff --git a/fieldservice_account_analytic/tests/__init__.py b/fieldservice_account_analytic/tests/__init__.py new file mode 100644 index 0000000000..3eb82c6555 --- /dev/null +++ b/fieldservice_account_analytic/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2019 Brian McMaster +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from . import test_fsm_account_wizard diff --git a/fieldservice_account_analytic/tests/test_fsm_account_wizard.py b/fieldservice_account_analytic/tests/test_fsm_account_wizard.py new file mode 100644 index 0000000000..5a3eaf84ae --- /dev/null +++ b/fieldservice_account_analytic/tests/test_fsm_account_wizard.py @@ -0,0 +1,30 @@ +# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) + +from odoo.addons.fieldservice_account.tests.test_fsm_account import ( + FSMAccountCase +) + + +class FSMAccountCase(FSMAccountCase): + + def setUp(self): + super(FSMAccountCase, self).setUp() + + def test_convert_contact_to_fsm_location(self): + """ + Test converting a contact to a location to make sure the customer_id + and owner_id get set correctly + :return: + """ + self.Wizard.action_convert_location(self.test_loc_partner2) + + # check if there is a new FSM Location with the same name + self.wiz_location = self.env['fsm.location']. \ + search([('name', '=', self.test_loc_partner2.name)]) + + # check if location is created successfully and fields copied over + self.assertEqual(self.test_loc_partner2, + self.wiz_location.customer_id) + self.assertEqual(self.test_loc_partner2, + self.wiz_location.owner_id) diff --git a/fieldservice_account_analytic/views/fsm_person.xml b/fieldservice_account_analytic/views/fsm_person.xml deleted file mode 100644 index 1e8581675e..0000000000 --- a/fieldservice_account_analytic/views/fsm_person.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - fsm.person.form - fsm.person - - - - - - - - - - - fsm.location.person.form - fsm.location.person - - - - - - - - - From a33fe13345f687b20d0669e7ec75d7b233bb6059 Mon Sep 17 00:00:00 2001 From: brian10048 Date: Thu, 5 Dec 2019 13:28:31 -0500 Subject: [PATCH 05/44] [IMP] fieldservice_account: Update maintainers --- fieldservice_account_analytic/README.rst | 44 ++++--- fieldservice_account_analytic/__manifest__.py | 6 +- .../i18n/fieldservice_account_analytic.pot | 109 ++++++++++++++++++ .../static/description/index.html | 34 +++--- 4 files changed, 147 insertions(+), 46 deletions(-) create mode 100644 fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot diff --git a/fieldservice_account_analytic/README.rst b/fieldservice_account_analytic/README.rst index 278e295c55..aeb2336ff6 100644 --- a/fieldservice_account_analytic/README.rst +++ b/fieldservice_account_analytic/README.rst @@ -1,6 +1,6 @@ -========================== -Field Service - Accounting -========================== +=================================== +Field Service - Analytic Accounting +=================================== .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! @@ -14,10 +14,10 @@ Field Service - Accounting :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github - :target: https://github.com/OCA/field-service/tree/12.0/fieldservice_account + :target: https://github.com/OCA/field-service/tree/12.0/fieldservice_account_analytic :alt: OCA/field-service .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_account + :target: https://translation.odoo-community.org/projects/field-service-12-0/field-service-12-0-fieldservice_account_analytic :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png :target: https://runbot.odoo-community.org/runbot/264/12.0 @@ -25,10 +25,10 @@ Field Service - Accounting |badge1| |badge2| |badge3| |badge4| |badge5| -This module adds the ability to track employee time and contractor -costs for Field Service Orders. It also adds functionality to create -a customer invoice and a vendor bill when a Field Service Order is -completed. +This module adds the ability to track your analytic accounts on field +service orders. +It also adds the option to track the billing partner for field service +locations and orders. **Table of contents** @@ -51,18 +51,7 @@ To configure this module, you need to: Usage ===== -To use the module: -On a field service order, open the "Accounting" tab. Depending on -whether the logged in user or an employee or not, they will see -either a place to enter timesheet records or contractor costs. - -The total cost of the order is calculated based on the entries in -the employee timesheet entries and contractor costs. - -When an order is completed, a customer invoice will be generated for -the employee time and the contractor costs. A vendor bill will be -created for the contractor costs. Bug Tracker =========== @@ -70,7 +59,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -87,6 +76,7 @@ Contributors * Michael Allen * Serpent Consulting Services Pvt. Ltd. +* Brian McMaster Other credits ~~~~~~~~~~~~~ @@ -111,11 +101,17 @@ promote its widespread use. .. |maintainer-osimallen| image:: https://github.com/osimallen.png?size=40px :target: https://github.com/osimallen :alt: osimallen +.. |maintainer-brian10048| image:: https://github.com/brian10048.png?size=40px + :target: https://github.com/brian10048 + :alt: brian10048 +.. |maintainer-bodedra| image:: https://github.com/bodedra.png?size=40px + :target: https://github.com/bodedra + :alt: bodedra -Current `maintainer `__: +Current `maintainers `__: -|maintainer-osimallen| +|maintainer-osimallen| |maintainer-brian10048| |maintainer-bodedra| -This module is part of the `OCA/field-service `_ project on GitHub. +This module is part of the `OCA/field-service `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index 5b98148f4f..b7e1330238 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -28,5 +28,9 @@ 'pre_init_hook': 'pre_init_hook', 'license': 'AGPL-3', 'development_status': 'Beta', - 'maintainers': ['osimallen'], + 'maintainers': [ + 'osimallen', + 'brian10048', + 'bodedra', + ], } diff --git a/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot b/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot new file mode 100644 index 0000000000..c68a6c0d8f --- /dev/null +++ b/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot @@ -0,0 +1,109 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_account_analytic +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_form_view_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_order_form_analytic +msgid "Accounting" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__analytic_account_id +msgid "Analytic Account" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_analytic_line +msgid "Analytic Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__bill_to +msgid "Bill to" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id +msgid "Billed Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id +msgid "Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_search_view_analytic +msgid "Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard +msgid "FSM Record Conversion" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location +msgid "Field Service Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person +msgid "Field Service Location Person Info" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line +msgid "Invoice Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: code:addons/fieldservice_account_analytic/models/account_invoice_line.py:19 +#: code:addons/fieldservice_account_analytic/models/analytic_account.py:21 +#, python-format +msgid "No analytic account set on the order's Location." +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__product_id +msgid "Time Type" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost +msgid "Total Cost" +msgstr "" + diff --git a/fieldservice_account_analytic/static/description/index.html b/fieldservice_account_analytic/static/description/index.html index be45db7518..ac71aa178f 100644 --- a/fieldservice_account_analytic/static/description/index.html +++ b/fieldservice_account_analytic/static/description/index.html @@ -4,7 +4,7 @@ -Field Service - Accounting +Field Service - Analytic Accounting -
-

Field Service - Accounting

+
+

Field Service - Analytic Accounting

-

Beta License: AGPL-3 OCA/field-service Translate me on Weblate Try me on Runbot

-

This module adds the ability to track employee time and contractor -costs for Field Service Orders. It also adds functionality to create -a customer invoice and a vendor bill when a Field Service Order is -completed.

+

Beta License: AGPL-3 OCA/field-service Translate me on Weblate Try me on Runbot

+

This module adds the ability to track your analytic accounts on field +service orders. +It also adds the option to track the billing partner for field service +locations and orders.

Table of contents

Usage

-

To use the module:

-

On a field service order, open the “Accounting” tab. Depending on -whether the logged in user or an employee or not, they will see -either a place to enter timesheet records or contractor costs.

-

The total cost of the order is calculated based on the entries in -the employee timesheet entries and contractor costs.

-

When an order is completed, a customer invoice will be generated for -the employee time and the contractor costs. A vendor bill will be -created for the contractor costs.

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -433,6 +424,7 @@

Contributors

@@ -449,9 +441,9 @@

Maintainers

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

-

Current maintainer:

-

osimallen

-

This module is part of the OCA/field-service project on GitHub.

+

Current maintainers:

+

osimallen brian10048 bodedra

+

This module is part of the OCA/field-service project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

From ecca72a1c321cc7204a1ae72822c13401b4df20d Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 5 Dec 2019 19:10:31 +0000 Subject: [PATCH 06/44] fieldservice_account_analytic 12.0.2.0.2 --- fieldservice_account_analytic/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index b7e1330238..6857117776 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Field Service - Analytic Accounting', 'summary': """Track analytic accounts on Field Service locations and orders""", - 'version': '12.0.2.0.1', + 'version': '12.0.2.0.2', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', From bb3ed55079b49c113ce4c0dc2443ae71984262a9 Mon Sep 17 00:00:00 2001 From: scampbell Date: Wed, 11 Dec 2019 15:28:09 -0800 Subject: [PATCH 07/44] [IMP] Analytic Account Company Dependant --- fieldservice_account_analytic/models/fsm_location.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fieldservice_account_analytic/models/fsm_location.py b/fieldservice_account_analytic/models/fsm_location.py index 92611bcbc0..bf9ed97b7b 100644 --- a/fieldservice_account_analytic/models/fsm_location.py +++ b/fieldservice_account_analytic/models/fsm_location.py @@ -8,7 +8,8 @@ class FSMLocation(models.Model): _inherit = 'fsm.location' analytic_account_id = fields.Many2one('account.analytic.account', - string='Analytic Account') + string='Analytic Account', + company_dependent=True) customer_id = fields.Many2one( 'res.partner', string='Billed Customer', required=True, From 7b0776657244f3fbc79d51f673a4bd3d28a950af Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 12 Dec 2019 15:52:24 +0000 Subject: [PATCH 08/44] fieldservice_account_analytic 12.0.2.1.0 --- fieldservice_account_analytic/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index 6857117776..d041e45c72 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Field Service - Analytic Accounting', 'summary': """Track analytic accounts on Field Service locations and orders""", - 'version': '12.0.2.0.2', + 'version': '12.0.2.1.0', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', From b5a95da9ca7e1b9e867bc27416cb7553153f16d1 Mon Sep 17 00:00:00 2001 From: Murtuza Saleh Date: Tue, 17 Dec 2019 13:51:21 +0530 Subject: [PATCH 09/44] [12.0][IMP] fieldservice --- fieldservice_account_analytic/__manifest__.py | 1 - fieldservice_account_analytic/views/fsm_route.xml | 14 -------------- 2 files changed, 15 deletions(-) delete mode 100644 fieldservice_account_analytic/views/fsm_route.xml diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index d041e45c72..de1e8f178e 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -20,7 +20,6 @@ 'report/fsm_order_report_template.xml', 'views/fsm_location.xml', 'views/fsm_order.xml', - 'views/fsm_route.xml', ], 'demo': [ 'demo/fsm_location.xml', diff --git a/fieldservice_account_analytic/views/fsm_route.xml b/fieldservice_account_analytic/views/fsm_route.xml deleted file mode 100644 index 4f1df4b04b..0000000000 --- a/fieldservice_account_analytic/views/fsm_route.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - fsm.route.form - fsm.route - - - - - - - - - From a3133d963a67b80b004ffcda4afcc23a6b33be26 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 18 Dec 2019 15:26:50 +0000 Subject: [PATCH 10/44] fieldservice_account_analytic 12.0.3.0.0 --- fieldservice_account_analytic/__manifest__.py | 2 +- fieldservice_account_analytic/i18n/es_CL.po | 111 ++++++++++++++++++ fieldservice_account_analytic/i18n/pt_BR.po | 109 +++++++++++++++++ 3 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 fieldservice_account_analytic/i18n/es_CL.po create mode 100644 fieldservice_account_analytic/i18n/pt_BR.po diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index de1e8f178e..945f00ca47 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Field Service - Analytic Accounting', 'summary': """Track analytic accounts on Field Service locations and orders""", - 'version': '12.0.2.1.0', + 'version': '12.0.3.0.0', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', diff --git a/fieldservice_account_analytic/i18n/es_CL.po b/fieldservice_account_analytic/i18n/es_CL.po new file mode 100644 index 0000000000..87b385b095 --- /dev/null +++ b/fieldservice_account_analytic/i18n/es_CL.po @@ -0,0 +1,111 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_account_analytic +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-01-15 06:13+0000\n" +"Last-Translator: Nelson Ramírez Sánchez \n" +"Language-Team: none\n" +"Language: es_CL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_form_view_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_order_form_analytic +msgid "Accounting" +msgstr "Contabilidad" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__analytic_account_id +msgid "Analytic Account" +msgstr "Cuenta Analítica" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_analytic_line +msgid "Analytic Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__bill_to +msgid "Bill to" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id +msgid "Billed Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id +msgid "Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_search_view_analytic +msgid "Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard +msgid "FSM Record Conversion" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location +msgid "Field Service Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person +msgid "Field Service Location Person Info" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line +msgid "Invoice Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: code:addons/fieldservice_account_analytic/models/account_invoice_line.py:19 +#: code:addons/fieldservice_account_analytic/models/analytic_account.py:21 +#, python-format +msgid "No analytic account set on the order's Location." +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__product_id +msgid "Time Type" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost +msgid "Total Cost" +msgstr "" diff --git a/fieldservice_account_analytic/i18n/pt_BR.po b/fieldservice_account_analytic/i18n/pt_BR.po new file mode 100644 index 0000000000..199dd9b8bc --- /dev/null +++ b/fieldservice_account_analytic/i18n/pt_BR.po @@ -0,0 +1,109 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_account_analytic +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_form_view_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_order_form_analytic +msgid "Accounting" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__analytic_account_id +msgid "Analytic Account" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_analytic_line +msgid "Analytic Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__bill_to +msgid "Bill to" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id +msgid "Billed Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id +msgid "Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_search_view_analytic +msgid "Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard +msgid "FSM Record Conversion" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location +msgid "Field Service Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person +msgid "Field Service Location Person Info" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line +msgid "Invoice Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: code:addons/fieldservice_account_analytic/models/account_invoice_line.py:19 +#: code:addons/fieldservice_account_analytic/models/analytic_account.py:21 +#, python-format +msgid "No analytic account set on the order's Location." +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__product_id +msgid "Time Type" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost +msgid "Total Cost" +msgstr "" From 67fb2f891854668c260e35023f2625ebc74c5dbb Mon Sep 17 00:00:00 2001 From: scampbell Date: Wed, 15 Jan 2020 17:35:01 -0800 Subject: [PATCH 11/44] [IMP] Set Default Customer [IMP] Move Method Up [IMP] api.model + space [IMP] fsm_parent_id [FIX] Typo --- fieldservice_account_analytic/i18n/es.po | 111 ++++++++++++++++++ .../models/fsm_location.py | 9 +- 2 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 fieldservice_account_analytic/i18n/es.po diff --git a/fieldservice_account_analytic/i18n/es.po b/fieldservice_account_analytic/i18n/es.po new file mode 100644 index 0000000000..b8c52b0790 --- /dev/null +++ b/fieldservice_account_analytic/i18n/es.po @@ -0,0 +1,111 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_account_analytic +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-01-15 06:13+0000\n" +"Last-Translator: Nelson Ramírez Sánchez \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_form_view_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_order_form_analytic +msgid "Accounting" +msgstr "Contabilidad" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__analytic_account_id +msgid "Analytic Account" +msgstr "Cuenta Analítica" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_analytic_line +msgid "Analytic Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__bill_to +msgid "Bill to" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id +msgid "Billed Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id +msgid "Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_search_view_analytic +msgid "Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard +msgid "FSM Record Conversion" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location +msgid "Field Service Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person +msgid "Field Service Location Person Info" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_order +msgid "Field Service Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line +msgid "Invoice Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: code:addons/fieldservice_account_analytic/models/account_invoice_line.py:19 +#: code:addons/fieldservice_account_analytic/models/analytic_account.py:21 +#, python-format +msgid "No analytic account set on the order's Location." +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__product_id +msgid "Time Type" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost +msgid "Total Cost" +msgstr "" diff --git a/fieldservice_account_analytic/models/fsm_location.py b/fieldservice_account_analytic/models/fsm_location.py index bf9ed97b7b..6885f1b1c1 100644 --- a/fieldservice_account_analytic/models/fsm_location.py +++ b/fieldservice_account_analytic/models/fsm_location.py @@ -11,9 +11,16 @@ class FSMLocation(models.Model): string='Analytic Account', company_dependent=True) + @api.model + def get_default_customer(self): + if self.fsm_parent_id: + return self.fsm_parent_id.customer_id.id + return self.owner_id.id + customer_id = fields.Many2one( 'res.partner', string='Billed Customer', required=True, - ondelete='restrict', auto_join=True, track_visibility='onchange') + ondelete='restrict', auto_join=True, track_visibility='onchange', + default=get_default_customer) @api.onchange('fsm_parent_id') def _onchange_fsm_parent_id_account(self): From 66c6b9ecb3d46dce5022f17ebfe2f5caf635238f Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 17 Jan 2020 00:35:14 +0000 Subject: [PATCH 12/44] fieldservice_account_analytic 12.0.3.1.0 --- fieldservice_account_analytic/__manifest__.py | 2 +- fieldservice_account_analytic/i18n/es.po | 34 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index 945f00ca47..8a4fd731d1 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Field Service - Analytic Accounting', 'summary': """Track analytic accounts on Field Service locations and orders""", - 'version': '12.0.3.0.0', + 'version': '12.0.3.1.0', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', diff --git a/fieldservice_account_analytic/i18n/es.po b/fieldservice_account_analytic/i18n/es.po index b8c52b0790..53524f15f9 100644 --- a/fieldservice_account_analytic/i18n/es.po +++ b/fieldservice_account_analytic/i18n/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2020-01-15 06:13+0000\n" +"PO-Revision-Date: 2020-01-17 06:13+0000\n" "Last-Translator: Nelson Ramírez Sánchez \n" "Language-Team: none\n" "Language: es\n" @@ -30,82 +30,82 @@ msgstr "Cuenta Analítica" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_account_analytic_line msgid "Analytic Line" -msgstr "" +msgstr "Linea Analitica" #. module: fieldservice_account_analytic #: selection:fsm.order,bill_to:0 msgid "Bill Contact" -msgstr "" +msgstr "Contacto de Facturación" #. module: fieldservice_account_analytic #: selection:fsm.order,bill_to:0 msgid "Bill Location" -msgstr "" +msgstr "Dirección de Facturación" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__bill_to msgid "Bill to" -msgstr "" +msgstr "Facturar a" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id msgid "Billed Customer" -msgstr "" +msgstr "Facturado a Cliente" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id msgid "Contact" -msgstr "" +msgstr "Contacto" #. module: fieldservice_account_analytic #: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_search_view_analytic msgid "Customer" -msgstr "" +msgstr "Cliente" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id msgid "FSM Order" -msgstr "" +msgstr "Pedido FSM" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard msgid "FSM Record Conversion" -msgstr "" +msgstr "Conversión de Registro FSM" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_location msgid "Field Service Location" -msgstr "" +msgstr "Ubicación del Servicio de Campo" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person msgid "Field Service Location Person Info" -msgstr "" +msgstr "Servicio de campo Ubicación Información de la persona" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_order msgid "Field Service Order" -msgstr "" +msgstr "Orden de Servicio de Campo" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line msgid "Invoice Line" -msgstr "" +msgstr "Línea de factura" #. module: fieldservice_account_analytic #: code:addons/fieldservice_account_analytic/models/account_invoice_line.py:19 #: code:addons/fieldservice_account_analytic/models/analytic_account.py:21 #, python-format msgid "No analytic account set on the order's Location." -msgstr "" +msgstr "No hay una cuenta analítica establecida en la ubicación del pedido." #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__product_id msgid "Time Type" -msgstr "" +msgstr "Tipo de Tiempo" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost msgid "Total Cost" -msgstr "" +msgstr "Coste Total" From acf90a78f75aeb372982eab059524a1a723dfeaa Mon Sep 17 00:00:00 2001 From: scampbell Date: Fri, 31 Jan 2020 14:49:43 -0800 Subject: [PATCH 13/44] [DEL] Remove fsm_location_person.py --- .../i18n/fieldservice_account_analytic.pot | 6 ------ fieldservice_account_analytic/models/__init__.py | 1 - .../models/fsm_location_person.py | 13 ------------- 3 files changed, 20 deletions(-) delete mode 100644 fieldservice_account_analytic/models/fsm_location_person.py diff --git a/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot b/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot index c68a6c0d8f..a7729d23a4 100644 --- a/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot +++ b/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot @@ -46,7 +46,6 @@ msgstr "" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id -#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id msgid "Billed Customer" msgstr "" @@ -75,11 +74,6 @@ msgstr "" msgid "Field Service Location" msgstr "" -#. module: fieldservice_account_analytic -#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person -msgid "Field Service Location Person Info" -msgstr "" - #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_order msgid "Field Service Order" diff --git a/fieldservice_account_analytic/models/__init__.py b/fieldservice_account_analytic/models/__init__.py index 173f04e574..59b98aeef2 100644 --- a/fieldservice_account_analytic/models/__init__.py +++ b/fieldservice_account_analytic/models/__init__.py @@ -4,6 +4,5 @@ account_invoice_line, analytic_account, fsm_location, - fsm_location_person, fsm_order, ) diff --git a/fieldservice_account_analytic/models/fsm_location_person.py b/fieldservice_account_analytic/models/fsm_location_person.py deleted file mode 100644 index d6e3a1f2e1..0000000000 --- a/fieldservice_account_analytic/models/fsm_location_person.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (C) 2018 - TODAY, Open Source Integrators -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class FSMLocationPerson(models.Model): - _inherit = 'fsm.location.person' - - customer_id = fields.Many2one('res.partner', string='Billed Customer', - required=True, ondelete='restrict', - auto_join=True, - track_visibility='onchange') From baf9ea35d4c8308144ef499228be78b89a90f3df Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sat, 1 Feb 2020 20:06:12 +0000 Subject: [PATCH 14/44] fieldservice_account_analytic 12.0.3.2.0 --- fieldservice_account_analytic/__manifest__.py | 2 +- fieldservice_account_analytic/i18n/es.po | 11 ++--- fieldservice_account_analytic/i18n/es_CL.po | 8 +--- fieldservice_account_analytic/i18n/pt_BR.po | 46 +++++++++---------- 4 files changed, 27 insertions(+), 40 deletions(-) diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index 8a4fd731d1..5fc8d3276f 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Field Service - Analytic Accounting', 'summary': """Track analytic accounts on Field Service locations and orders""", - 'version': '12.0.3.1.0', + 'version': '12.0.3.2.0', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', diff --git a/fieldservice_account_analytic/i18n/es.po b/fieldservice_account_analytic/i18n/es.po index 53524f15f9..017a539d4e 100644 --- a/fieldservice_account_analytic/i18n/es.po +++ b/fieldservice_account_analytic/i18n/es.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * fieldservice_account_analytic +# * fieldservice_account_analytic # msgid "" msgstr "" @@ -49,7 +49,6 @@ msgstr "Facturar a" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id -#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id msgid "Billed Customer" msgstr "Facturado a Cliente" @@ -78,11 +77,6 @@ msgstr "Conversión de Registro FSM" msgid "Field Service Location" msgstr "Ubicación del Servicio de Campo" -#. module: fieldservice_account_analytic -#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person -msgid "Field Service Location Person Info" -msgstr "Servicio de campo Ubicación Información de la persona" - #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_order msgid "Field Service Order" @@ -109,3 +103,6 @@ msgstr "Tipo de Tiempo" #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost msgid "Total Cost" msgstr "Coste Total" + +#~ msgid "Field Service Location Person Info" +#~ msgstr "Servicio de campo Ubicación Información de la persona" diff --git a/fieldservice_account_analytic/i18n/es_CL.po b/fieldservice_account_analytic/i18n/es_CL.po index 87b385b095..1ac61bd739 100644 --- a/fieldservice_account_analytic/i18n/es_CL.po +++ b/fieldservice_account_analytic/i18n/es_CL.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * fieldservice_account_analytic +# * fieldservice_account_analytic # msgid "" msgstr "" @@ -49,7 +49,6 @@ msgstr "" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id -#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id msgid "Billed Customer" msgstr "" @@ -78,11 +77,6 @@ msgstr "" msgid "Field Service Location" msgstr "" -#. module: fieldservice_account_analytic -#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person -msgid "Field Service Location Person Info" -msgstr "" - #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_order msgid "Field Service Order" diff --git a/fieldservice_account_analytic/i18n/pt_BR.po b/fieldservice_account_analytic/i18n/pt_BR.po index 199dd9b8bc..5c3dc5dd7d 100644 --- a/fieldservice_account_analytic/i18n/pt_BR.po +++ b/fieldservice_account_analytic/i18n/pt_BR.po @@ -1,109 +1,105 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * fieldservice_account_analytic +# * fieldservice_account_analytic # msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2020-02-05 22:13+0000\n" +"Last-Translator: Marcel Savegnago \n" "Language-Team: none\n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" #. module: fieldservice_account_analytic #: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_form_view_analytic #: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_order_form_analytic msgid "Accounting" -msgstr "" +msgstr "Contabilidade" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__analytic_account_id msgid "Analytic Account" -msgstr "" +msgstr "Conta Analítica" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_account_analytic_line msgid "Analytic Line" -msgstr "" +msgstr "Linha Analitica" #. module: fieldservice_account_analytic #: selection:fsm.order,bill_to:0 msgid "Bill Contact" -msgstr "" +msgstr "Conta do Contato" #. module: fieldservice_account_analytic #: selection:fsm.order,bill_to:0 msgid "Bill Location" -msgstr "" +msgstr "Localização de Conta" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__bill_to msgid "Bill to" -msgstr "" +msgstr "Conta para" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id -#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location_person__customer_id msgid "Billed Customer" -msgstr "" +msgstr "Cliente Faturado" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id msgid "Contact" -msgstr "" +msgstr "Contato" #. module: fieldservice_account_analytic #: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_search_view_analytic msgid "Customer" -msgstr "" +msgstr "Cliente" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id msgid "FSM Order" -msgstr "" +msgstr "Ordem FSM" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard msgid "FSM Record Conversion" -msgstr "" +msgstr "Conversão do Registro FSM" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_location msgid "Field Service Location" -msgstr "" - -#. module: fieldservice_account_analytic -#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location_person -msgid "Field Service Location Person Info" -msgstr "" +msgstr "Localização do Serviço de Campo" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_order msgid "Field Service Order" -msgstr "" +msgstr "Ordem de Serviço de Campo" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line msgid "Invoice Line" -msgstr "" +msgstr "Linha de Fatura" #. module: fieldservice_account_analytic #: code:addons/fieldservice_account_analytic/models/account_invoice_line.py:19 #: code:addons/fieldservice_account_analytic/models/analytic_account.py:21 #, python-format msgid "No analytic account set on the order's Location." -msgstr "" +msgstr "Nenhuma conta analítica definida na Localização do ordem." #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__product_id msgid "Time Type" -msgstr "" +msgstr "Tipo de Tempo" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost msgid "Total Cost" -msgstr "" +msgstr "Custo Total" From d5f30980008add9a30fc667cfbce6689cd84b936 Mon Sep 17 00:00:00 2001 From: scampbell Date: Thu, 16 Jan 2020 15:33:27 -0800 Subject: [PATCH 15/44] [IMP] Filter Location/Contact [IMP] Remove Unused Import [IMP] Github Comments [IMP] Add FSM to Variable --- fieldservice_account_analytic/__manifest__.py | 1 + .../i18n/fieldservice_account_analytic.pot | 22 +++++++++++++++++ .../models/__init__.py | 2 ++ .../models/fsm_order.py | 19 +++++++++++---- .../models/res_company.py | 18 ++++++++++++++ .../models/res_config_settings.py | 14 +++++++++++ .../views/res_config_settings.xml | 24 +++++++++++++++++++ 7 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 fieldservice_account_analytic/models/res_company.py create mode 100644 fieldservice_account_analytic/models/res_config_settings.py create mode 100644 fieldservice_account_analytic/views/res_config_settings.xml diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index 5fc8d3276f..c9aae9b2d8 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -20,6 +20,7 @@ 'report/fsm_order_report_template.xml', 'views/fsm_location.xml', 'views/fsm_order.xml', + 'views/res_config_settings.xml' ], 'demo': [ 'demo/fsm_location.xml', diff --git a/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot b/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot index a7729d23a4..9ec0a906fa 100644 --- a/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot +++ b/fieldservice_account_analytic/i18n/fieldservice_account_analytic.pot @@ -49,6 +49,16 @@ msgstr "" msgid "Billed Customer" msgstr "" +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_company +msgid "Companies" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_config_settings +msgid "Config Settings" +msgstr "" + #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id msgid "Contact" @@ -79,6 +89,18 @@ msgstr "" msgid "Field Service Order" msgstr "" +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_company__fsm_filter_location_by_contact +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_config_settings__fsm_filter_location_by_contact +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter Contacts with Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter the Location on an FSM Order by the Contact" +msgstr "" + #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line msgid "Invoice Line" diff --git a/fieldservice_account_analytic/models/__init__.py b/fieldservice_account_analytic/models/__init__.py index 59b98aeef2..a08d9949b4 100644 --- a/fieldservice_account_analytic/models/__init__.py +++ b/fieldservice_account_analytic/models/__init__.py @@ -5,4 +5,6 @@ analytic_account, fsm_location, fsm_order, + res_company, + res_config_settings ) diff --git a/fieldservice_account_analytic/models/fsm_order.py b/fieldservice_account_analytic/models/fsm_order.py index d88ac6091a..c2e5da8402 100644 --- a/fieldservice_account_analytic/models/fsm_order.py +++ b/fieldservice_account_analytic/models/fsm_order.py @@ -25,13 +25,22 @@ def _compute_total_cost(self): for order in self: order.total_cost = 0.0 - @api.onchange('location_id') + @api.onchange('location_id', 'customer_id') def _onchange_location_id_customer_account(self): - if self.location_id: - return {'domain': {'customer_id': [('service_location_id', '=', - self.location_id.name)]}} + if self.env.user.company_id.fsm_filter_location_by_contact: + if self.location_id: + return {'domain': {'customer_id': [('service_location_id', '=', + self.location_id.id)]}} + else: + return {'domain': {'customer_id': [], + 'location_id': []}} else: - return {'domain': {'customer_id': [('id', '!=', None)]}} + if self.customer_id: + return {'domain': {'location_id': [('partner_id', '=', + self.customer_id.id)]}} + else: + return {'domain': {'location_id': [], + 'customer_id': []}} @api.onchange('customer_id') def _onchange_customer_id_location(self): diff --git a/fieldservice_account_analytic/models/res_company.py b/fieldservice_account_analytic/models/res_company.py new file mode 100644 index 0000000000..ed087f6ed9 --- /dev/null +++ b/fieldservice_account_analytic/models/res_company.py @@ -0,0 +1,18 @@ +# Copyright (C) 2020 - TODAY, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ResCompany(models.Model): + _inherit = 'res.company' + + fsm_filter_location_by_contact = fields.Boolean( + string='Filter Contacts with Location' + ) + + @api.onchange('fsm_filter_location_by_contact') + def onchange_fsm_filter_location_by_contact(self): + fso_ids = self.env['fsm.order'].search([]) + for fso_id in fso_ids: + fso_id._onchange_location_id_customer_account() diff --git a/fieldservice_account_analytic/models/res_config_settings.py b/fieldservice_account_analytic/models/res_config_settings.py new file mode 100644 index 0000000000..e8ea540845 --- /dev/null +++ b/fieldservice_account_analytic/models/res_config_settings.py @@ -0,0 +1,14 @@ +# Copyright (C) 2020, Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + fsm_filter_location_by_contact = fields.Boolean( + string='Filter Contacts with Location', + related='company_id.fsm_filter_location_by_contact', + readonly=False + ) diff --git a/fieldservice_account_analytic/views/res_config_settings.xml b/fieldservice_account_analytic/views/res_config_settings.xml new file mode 100644 index 0000000000..b7bb82f2f6 --- /dev/null +++ b/fieldservice_account_analytic/views/res_config_settings.xml @@ -0,0 +1,24 @@ + + + res.config.settings.view.form.fsm.filter + res.config.settings + + + +
+
+
+ +
+
+
+
+
+
+
+
From 8f1554b7cf62de4fc7ad5f08432a9790806cf87c Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 19 Feb 2020 00:55:17 +0000 Subject: [PATCH 16/44] fieldservice_account_analytic 12.0.3.3.0 --- fieldservice_account_analytic/__manifest__.py | 2 +- fieldservice_account_analytic/i18n/es.po | 22 +++ fieldservice_account_analytic/i18n/es_AR.po | 127 ++++++++++++++++++ fieldservice_account_analytic/i18n/es_CL.po | 22 +++ fieldservice_account_analytic/i18n/pt_BR.po | 29 +++- fieldservice_account_analytic/i18n/pt_PT.po | 127 ++++++++++++++++++ 6 files changed, 325 insertions(+), 4 deletions(-) create mode 100644 fieldservice_account_analytic/i18n/es_AR.po create mode 100644 fieldservice_account_analytic/i18n/pt_PT.po diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index c9aae9b2d8..bca30ae460 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -5,7 +5,7 @@ 'name': 'Field Service - Analytic Accounting', 'summary': """Track analytic accounts on Field Service locations and orders""", - 'version': '12.0.3.2.0', + 'version': '12.0.3.3.0', 'category': 'Field Service', 'author': 'Open Source Integrators, Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/field-service', diff --git a/fieldservice_account_analytic/i18n/es.po b/fieldservice_account_analytic/i18n/es.po index 017a539d4e..77f10545fe 100644 --- a/fieldservice_account_analytic/i18n/es.po +++ b/fieldservice_account_analytic/i18n/es.po @@ -52,6 +52,16 @@ msgstr "Facturar a" msgid "Billed Customer" msgstr "Facturado a Cliente" +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_company +msgid "Companies" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_config_settings +msgid "Config Settings" +msgstr "" + #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id msgid "Contact" @@ -82,6 +92,18 @@ msgstr "Ubicación del Servicio de Campo" msgid "Field Service Order" msgstr "Orden de Servicio de Campo" +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_company__fsm_filter_location_by_contact +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_config_settings__fsm_filter_location_by_contact +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter Contacts with Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter the Location on an FSM Order by the Contact" +msgstr "" + #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line msgid "Invoice Line" diff --git a/fieldservice_account_analytic/i18n/es_AR.po b/fieldservice_account_analytic/i18n/es_AR.po new file mode 100644 index 0000000000..965e516fe5 --- /dev/null +++ b/fieldservice_account_analytic/i18n/es_AR.po @@ -0,0 +1,127 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_account_analytic +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-09-10 08:00+0000\n" +"Last-Translator: Ignacio Buioli \n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_form_view_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_order_form_analytic +msgid "Accounting" +msgstr "Contabilidad" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__analytic_account_id +msgid "Analytic Account" +msgstr "Cuenta Analítica" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_analytic_line +msgid "Analytic Line" +msgstr "Línea Analítica" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Contact" +msgstr "Factura de Contacto" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Location" +msgstr "Ubicación de Factura" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__bill_to +msgid "Bill to" +msgstr "Facturar a" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id +msgid "Billed Customer" +msgstr "Cliente Facturado" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_config_settings +msgid "Config Settings" +msgstr "Configurar Ajustes" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id +msgid "Contact" +msgstr "Contacto" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_search_view_analytic +msgid "Customer" +msgstr "Cliente" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id +msgid "FSM Order" +msgstr "Pedido FSM" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard +msgid "FSM Record Conversion" +msgstr "Conversión a Registro FSM" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location +msgid "Field Service Location" +msgstr "Ubicación del Servicio de Campo" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_order +msgid "Field Service Order" +msgstr "Pedido de Servicio de Campo" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_company__fsm_filter_location_by_contact +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_config_settings__fsm_filter_location_by_contact +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter Contacts with Location" +msgstr "Filtrar Contactos con Ubicación" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter the Location on an FSM Order by the Contact" +msgstr "Filtrar la Ubicación por Contacto en un Pedido FSM" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line +msgid "Invoice Line" +msgstr "Línea de Factura" + +#. module: fieldservice_account_analytic +#: code:addons/fieldservice_account_analytic/models/account_invoice_line.py:19 +#: code:addons/fieldservice_account_analytic/models/analytic_account.py:21 +#, python-format +msgid "No analytic account set on the order's Location." +msgstr "No hay una cuenta analítica establecida en la Ubicación del pedido." + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__product_id +msgid "Time Type" +msgstr "Tipo de Tiempo" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost +msgid "Total Cost" +msgstr "Costo Total" diff --git a/fieldservice_account_analytic/i18n/es_CL.po b/fieldservice_account_analytic/i18n/es_CL.po index 1ac61bd739..cfe0014f8f 100644 --- a/fieldservice_account_analytic/i18n/es_CL.po +++ b/fieldservice_account_analytic/i18n/es_CL.po @@ -52,6 +52,16 @@ msgstr "" msgid "Billed Customer" msgstr "" +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_company +msgid "Companies" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_config_settings +msgid "Config Settings" +msgstr "" + #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id msgid "Contact" @@ -82,6 +92,18 @@ msgstr "" msgid "Field Service Order" msgstr "" +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_company__fsm_filter_location_by_contact +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_config_settings__fsm_filter_location_by_contact +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter Contacts with Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter the Location on an FSM Order by the Contact" +msgstr "" + #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line msgid "Invoice Line" diff --git a/fieldservice_account_analytic/i18n/pt_BR.po b/fieldservice_account_analytic/i18n/pt_BR.po index 5c3dc5dd7d..e44e795ee0 100644 --- a/fieldservice_account_analytic/i18n/pt_BR.po +++ b/fieldservice_account_analytic/i18n/pt_BR.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2020-02-05 22:13+0000\n" -"Last-Translator: Marcel Savegnago \n" +"PO-Revision-Date: 2020-06-17 16:19+0000\n" +"Last-Translator: Fernando Colus \n" "Language-Team: none\n" "Language: pt_BR\n" "MIME-Version: 1.0\n" @@ -52,6 +52,16 @@ msgstr "Conta para" msgid "Billed Customer" msgstr "Cliente Faturado" +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_company +msgid "Companies" +msgstr "Empresas" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_config_settings +msgid "Config Settings" +msgstr "Definições de configuração" + #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id msgid "Contact" @@ -65,7 +75,7 @@ msgstr "Cliente" #. module: fieldservice_account_analytic #: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id msgid "FSM Order" -msgstr "Ordem FSM" +msgstr "Ordem FSM (Field Service Management)" #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard @@ -82,6 +92,19 @@ msgstr "Localização do Serviço de Campo" msgid "Field Service Order" msgstr "Ordem de Serviço de Campo" +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_company__fsm_filter_location_by_contact +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_config_settings__fsm_filter_location_by_contact +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter Contacts with Location" +msgstr "Filtrar contatos de acordo com o Local" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter the Location on an FSM Order by the Contact" +msgstr "" +"Filtrar por contato o local em um pedido do FSM (Field Services Management)" + #. module: fieldservice_account_analytic #: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line msgid "Invoice Line" diff --git a/fieldservice_account_analytic/i18n/pt_PT.po b/fieldservice_account_analytic/i18n/pt_PT.po new file mode 100644 index 0000000000..bf9ae769dc --- /dev/null +++ b/fieldservice_account_analytic/i18n/pt_PT.po @@ -0,0 +1,127 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fieldservice_account_analytic +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-07-21 10:19+0000\n" +"Last-Translator: Daniel Reis \n" +"Language-Team: none\n" +"Language: pt_PT\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_form_view_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_order_form_analytic +msgid "Accounting" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__analytic_account_id +msgid "Analytic Account" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_analytic_line +msgid "Analytic Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: selection:fsm.order,bill_to:0 +msgid "Bill Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__bill_to +msgid "Bill to" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_location__customer_id +msgid "Billed Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_company +msgid "Companies" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__customer_id +msgid "Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.fsm_location_search_view_analytic +msgid "Customer" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__fsm_order_id +msgid "FSM Order" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_wizard +msgid "FSM Record Conversion" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_location +msgid "Field Service Location" +msgstr "Local do Serviço de Campo" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_fsm_order +msgid "Field Service Order" +msgstr "Ordem de Serviço" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_company__fsm_filter_location_by_contact +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_res_config_settings__fsm_filter_location_by_contact +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter Contacts with Location" +msgstr "" + +#. module: fieldservice_account_analytic +#: model_terms:ir.ui.view,arch_db:fieldservice_account_analytic.res_config_settings_view_form_filter +msgid "Filter the Location on an FSM Order by the Contact" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model,name:fieldservice_account_analytic.model_account_invoice_line +msgid "Invoice Line" +msgstr "" + +#. module: fieldservice_account_analytic +#: code:addons/fieldservice_account_analytic/models/account_invoice_line.py:19 +#: code:addons/fieldservice_account_analytic/models/analytic_account.py:21 +#, python-format +msgid "No analytic account set on the order's Location." +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_account_analytic_line__product_id +msgid "Time Type" +msgstr "" + +#. module: fieldservice_account_analytic +#: model:ir.model.fields,field_description:fieldservice_account_analytic.field_fsm_order__total_cost +msgid "Total Cost" +msgstr "" From e7ec788c8040e437045192006d51ea3893004ed4 Mon Sep 17 00:00:00 2001 From: Murtuza Saleh Date: Wed, 7 Oct 2020 00:06:36 +0530 Subject: [PATCH 17/44] [WIP][13.0][MIG] Fix Travis --- fieldservice_account_analytic/__manifest__.py | 48 ++++++--------- .../data/ir_rule.xml | 33 +++++------ .../demo/fsm_location.xml | 12 ++-- fieldservice_account_analytic/init_hook.py | 6 +- .../migrations/12.0.2.0.0/post-migration.py | 3 +- .../models/__init__.py | 2 +- .../models/account_invoice_line.py | 12 ++-- .../models/analytic_account.py | 19 +++--- .../models/fsm_location.py | 23 +++++--- .../models/fsm_order.py | 59 +++++++++++-------- .../models/res_company.py | 8 +-- .../models/res_config_settings.py | 8 +-- .../readme/USAGE.rst | 1 - .../report/fsm_order_report_template.xml | 13 ++-- .../tests/test_fsm_account_wizard.py | 16 ++--- .../views/fsm_location.xml | 26 ++++---- .../views/fsm_order.xml | 27 ++++----- .../views/res_config_settings.xml | 12 ++-- .../wizard/fsm_wizard.py | 6 +- 19 files changed, 166 insertions(+), 168 deletions(-) diff --git a/fieldservice_account_analytic/__manifest__.py b/fieldservice_account_analytic/__manifest__.py index bca30ae460..02a768abd2 100644 --- a/fieldservice_account_analytic/__manifest__.py +++ b/fieldservice_account_analytic/__manifest__.py @@ -2,35 +2,25 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Field Service - Analytic Accounting', - 'summary': """Track analytic accounts on Field Service locations + "name": "Field Service - Analytic Accounting", + "summary": """Track analytic accounts on Field Service locations and orders""", - 'version': '12.0.3.3.0', - 'category': 'Field Service', - 'author': 'Open Source Integrators, Odoo Community Association (OCA)', - 'website': 'https://github.com/OCA/field-service', - 'depends': [ - 'fieldservice_account', - 'analytic', - 'product', - ], - 'data': [ - 'data/ir_rule.xml', - 'security/ir.model.access.csv', - 'report/fsm_order_report_template.xml', - 'views/fsm_location.xml', - 'views/fsm_order.xml', - 'views/res_config_settings.xml' - ], - 'demo': [ - 'demo/fsm_location.xml', - ], - 'pre_init_hook': 'pre_init_hook', - 'license': 'AGPL-3', - 'development_status': 'Beta', - 'maintainers': [ - 'osimallen', - 'brian10048', - 'bodedra', + "version": "13.0.1.0.0", + "category": "Field Service", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/field-service", + "depends": ["fieldservice_account", "analytic", "product"], + "data": [ + "data/ir_rule.xml", + "security/ir.model.access.csv", + "report/fsm_order_report_template.xml", + "views/fsm_location.xml", + "views/fsm_order.xml", + "views/res_config_settings.xml", ], + "demo": ["demo/fsm_location.xml"], + "pre_init_hook": "pre_init_hook", + "license": "AGPL-3", + "development_status": "Beta", + "maintainers": ["osimallen", "brian10048", "bodedra"], } diff --git a/fieldservice_account_analytic/data/ir_rule.xml b/fieldservice_account_analytic/data/ir_rule.xml index 622bca4ee7..279666bf91 100644 --- a/fieldservice_account_analytic/data/ir_rule.xml +++ b/fieldservice_account_analytic/data/ir_rule.xml @@ -1,28 +1,25 @@ - + - account.analytic.line.fsm.manager - - + + [(1, '=', 1)] - - - - - + + + + + - account.analytic.line.fsm.dispatcher - - + + [(1, '=', 1)] - - - - - + + + + + - diff --git a/fieldservice_account_analytic/demo/fsm_location.xml b/fieldservice_account_analytic/demo/fsm_location.xml index fc3a0e6201..713b1d2a7c 100644 --- a/fieldservice_account_analytic/demo/fsm_location.xml +++ b/fieldservice_account_analytic/demo/fsm_location.xml @@ -1,20 +1,16 @@ - - + - - + - - + - - + diff --git a/fieldservice_account_analytic/init_hook.py b/fieldservice_account_analytic/init_hook.py index 730d91faac..49ef6b0ab8 100644 --- a/fieldservice_account_analytic/init_hook.py +++ b/fieldservice_account_analytic/init_hook.py @@ -4,5 +4,7 @@ def pre_init_hook(cr): cr.execute("""ALTER TABLE "fsm_location" ADD "customer_id" INT;""") - cr.execute("""UPDATE "fsm_location" SET customer_id = owner_id - WHERE customer_id IS NULL;""") + cr.execute( + """UPDATE "fsm_location" SET customer_id = owner_id + WHERE customer_id IS NULL;""" + ) diff --git a/fieldservice_account_analytic/migrations/12.0.2.0.0/post-migration.py b/fieldservice_account_analytic/migrations/12.0.2.0.0/post-migration.py index 7218f7ce5e..1f7de1b3b7 100644 --- a/fieldservice_account_analytic/migrations/12.0.2.0.0/post-migration.py +++ b/fieldservice_account_analytic/migrations/12.0.2.0.0/post-migration.py @@ -6,5 +6,4 @@ def migrate(env, version): if not version: return - env.execute("UPDATE fsm_order SET bill_to = 'location' " - "WHERE bill_to IS NULL;") + env.execute("UPDATE fsm_order SET bill_to = 'location' " "WHERE bill_to IS NULL;") diff --git a/fieldservice_account_analytic/models/__init__.py b/fieldservice_account_analytic/models/__init__.py index a08d9949b4..f42338c138 100644 --- a/fieldservice_account_analytic/models/__init__.py +++ b/fieldservice_account_analytic/models/__init__.py @@ -6,5 +6,5 @@ fsm_location, fsm_order, res_company, - res_config_settings + res_config_settings, ) diff --git a/fieldservice_account_analytic/models/account_invoice_line.py b/fieldservice_account_analytic/models/account_invoice_line.py index ca90dab2b1..21bb9c93a3 100644 --- a/fieldservice_account_analytic/models/account_invoice_line.py +++ b/fieldservice_account_analytic/models/account_invoice_line.py @@ -1,7 +1,7 @@ # 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 @@ -10,12 +10,12 @@ class AccountInvoiceLine(models.Model): @api.model def create(self, vals): - order = self.env['fsm.order'].browse(vals.get('fsm_order_id')) + order = self.env["fsm.order"].browse(vals.get("fsm_order_id")) if order: if order.location_id.analytic_account_id: - vals['account_analytic_id'] = order.location_id.\ - analytic_account_id.id + vals["account_analytic_id"] = order.location_id.analytic_account_id.id else: - raise ValidationError(_("No analytic account " - "set on the order's Location.")) + raise ValidationError( + _("No analytic account " "set on the order's Location.") + ) return super(AccountInvoiceLine, self).create(vals) diff --git a/fieldservice_account_analytic/models/analytic_account.py b/fieldservice_account_analytic/models/analytic_account.py index 62bb9c12a7..149b82fe81 100644 --- a/fieldservice_account_analytic/models/analytic_account.py +++ b/fieldservice_account_analytic/models/analytic_account.py @@ -1,28 +1,29 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models, _ +from odoo import _, api, fields, models from odoo.exceptions import ValidationError class AccountAnalyticLine(models.Model): - _inherit = 'account.analytic.line' + _inherit = "account.analytic.line" - fsm_order_id = fields.Many2one('fsm.order', string='FSM Order') - product_id = fields.Many2one('product.product', string='Time Type') + fsm_order_id = fields.Many2one("fsm.order", string="FSM Order") + product_id = fields.Many2one("product.product", string="Time Type") @api.model def create(self, vals): - order = self.env['fsm.order'].browse(vals.get('fsm_order_id')) + order = self.env["fsm.order"].browse(vals.get("fsm_order_id")) if order: if order.location_id.analytic_account_id: - vals['account_id'] = order.location_id.analytic_account_id.id + vals["account_id"] = order.location_id.analytic_account_id.id else: - raise ValidationError(_("No analytic account set " - "on the order's Location.")) + raise ValidationError( + _("No analytic account set " "on the order's Location.") + ) return super(AccountAnalyticLine, self).create(vals) - @api.onchange('product_id') + @api.onchange("product_id") def onchange_product_id(self): if self.product_id: self.name = self.product_id.name diff --git a/fieldservice_account_analytic/models/fsm_location.py b/fieldservice_account_analytic/models/fsm_location.py index 6885f1b1c1..d1fa677f92 100644 --- a/fieldservice_account_analytic/models/fsm_location.py +++ b/fieldservice_account_analytic/models/fsm_location.py @@ -1,15 +1,15 @@ # Copyright (C) 2018 - TODAY, Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models, api +from odoo import api, fields, models class FSMLocation(models.Model): - _inherit = 'fsm.location' + _inherit = "fsm.location" - analytic_account_id = fields.Many2one('account.analytic.account', - string='Analytic Account', - company_dependent=True) + analytic_account_id = fields.Many2one( + "account.analytic.account", string="Analytic Account", company_dependent=True + ) @api.model def get_default_customer(self): @@ -18,10 +18,15 @@ def get_default_customer(self): return self.owner_id.id customer_id = fields.Many2one( - 'res.partner', string='Billed Customer', required=True, - ondelete='restrict', auto_join=True, track_visibility='onchange', - default=get_default_customer) + "res.partner", + string="Billed Customer", + required=True, + ondelete="restrict", + auto_join=True, + track_visibility="onchange", + default=get_default_customer, + ) - @api.onchange('fsm_parent_id') + @api.onchange("fsm_parent_id") def _onchange_fsm_parent_id_account(self): self.customer_id = self.fsm_parent_id.customer_id or False diff --git a/fieldservice_account_analytic/models/fsm_order.py b/fieldservice_account_analytic/models/fsm_order.py index c2e5da8402..77ab3e6264 100644 --- a/fieldservice_account_analytic/models/fsm_order.py +++ b/fieldservice_account_analytic/models/fsm_order.py @@ -5,44 +5,53 @@ class FSMOrder(models.Model): - _inherit = 'fsm.order' - - total_cost = fields.Float(compute='_compute_total_cost', - string='Total Cost') - bill_to = fields.Selection([('location', 'Bill Location'), - ('contact', 'Bill Contact')], - string="Bill to", - required=True, - default="location") - customer_id = fields.Many2one('res.partner', string='Contact', - domain=[('customer', '=', True)], - change_default=True, - index=True, - track_visibility='always') + _inherit = "fsm.order" + + total_cost = fields.Float(compute="_compute_total_cost", string="Total Cost") + bill_to = fields.Selection( + [("location", "Bill Location"), ("contact", "Bill Contact")], + string="Bill to", + required=True, + default="location", + ) + customer_id = fields.Many2one( + "res.partner", + string="Contact", + domain=[("customer", "=", True)], + change_default=True, + index=True, + track_visibility="always", + ) def _compute_total_cost(self): """ To be overridden as needed from other modules """ for order in self: order.total_cost = 0.0 - @api.onchange('location_id', 'customer_id') + @api.onchange("location_id", "customer_id") def _onchange_location_id_customer_account(self): if self.env.user.company_id.fsm_filter_location_by_contact: if self.location_id: - return {'domain': {'customer_id': [('service_location_id', '=', - self.location_id.id)]}} + return { + "domain": { + "customer_id": [ + ("service_location_id", "=", self.location_id.id) + ] + } + } else: - return {'domain': {'customer_id': [], - 'location_id': []}} + return {"domain": {"customer_id": [], "location_id": []}} else: if self.customer_id: - return {'domain': {'location_id': [('partner_id', '=', - self.customer_id.id)]}} + return { + "domain": { + "location_id": [("partner_id", "=", self.customer_id.id)] + } + } else: - return {'domain': {'location_id': [], - 'customer_id': []}} + return {"domain": {"location_id": [], "customer_id": []}} - @api.onchange('customer_id') + @api.onchange("customer_id") def _onchange_customer_id_location(self): if self.customer_id: self.location_id = self.customer_id.service_location_id @@ -51,6 +60,6 @@ def _onchange_customer_id_location(self): def write(self, vals): res = super(FSMOrder, self).write(vals) for order in self: - if 'customer_id' not in vals and order.customer_id is False: + if "customer_id" not in vals and order.customer_id is False: order.customer_id = order.location_id.customer_id.id return res diff --git a/fieldservice_account_analytic/models/res_company.py b/fieldservice_account_analytic/models/res_company.py index ed087f6ed9..4d6dd0e399 100644 --- a/fieldservice_account_analytic/models/res_company.py +++ b/fieldservice_account_analytic/models/res_company.py @@ -5,14 +5,14 @@ class ResCompany(models.Model): - _inherit = 'res.company' + _inherit = "res.company" fsm_filter_location_by_contact = fields.Boolean( - string='Filter Contacts with Location' + string="Filter Contacts with Location" ) - @api.onchange('fsm_filter_location_by_contact') + @api.onchange("fsm_filter_location_by_contact") def onchange_fsm_filter_location_by_contact(self): - fso_ids = self.env['fsm.order'].search([]) + fso_ids = self.env["fsm.order"].search([]) for fso_id in fso_ids: fso_id._onchange_location_id_customer_account() diff --git a/fieldservice_account_analytic/models/res_config_settings.py b/fieldservice_account_analytic/models/res_config_settings.py index e8ea540845..8d37084ce9 100644 --- a/fieldservice_account_analytic/models/res_config_settings.py +++ b/fieldservice_account_analytic/models/res_config_settings.py @@ -5,10 +5,10 @@ class ResConfigSettings(models.TransientModel): - _inherit = 'res.config.settings' + _inherit = "res.config.settings" fsm_filter_location_by_contact = fields.Boolean( - string='Filter Contacts with Location', - related='company_id.fsm_filter_location_by_contact', - readonly=False + string="Filter Contacts with Location", + related="company_id.fsm_filter_location_by_contact", + readonly=False, ) diff --git a/fieldservice_account_analytic/readme/USAGE.rst b/fieldservice_account_analytic/readme/USAGE.rst index 8b13789179..e69de29bb2 100644 --- a/fieldservice_account_analytic/readme/USAGE.rst +++ b/fieldservice_account_analytic/readme/USAGE.rst @@ -1 +0,0 @@ - diff --git a/fieldservice_account_analytic/report/fsm_order_report_template.xml b/fieldservice_account_analytic/report/fsm_order_report_template.xml index e00d75f2c7..701c934f27 100644 --- a/fieldservice_account_analytic/report/fsm_order_report_template.xml +++ b/fieldservice_account_analytic/report/fsm_order_report_template.xml @@ -1,16 +1,19 @@ - -