From 94c287b1653f60009b327fc9e9e6f6c40031e3ea Mon Sep 17 00:00:00 2001 From: scampbell Date: Sat, 20 Jul 2019 13:38:56 -0700 Subject: [PATCH 01/40] [ADD] sale_brand --- sale_brand/README.rst | 21 ++++ sale_brand/__init__.py | 4 + sale_brand/__manifest__.py | 23 ++++ sale_brand/models/__init__.py | 4 + sale_brand/models/sale_order.py | 21 ++++ sale_brand/readme/CONFIGURE.rst | 2 + sale_brand/readme/CONTRIBUTORS.rst | 3 + sale_brand/readme/CREDITS.rst | 1 + sale_brand/readme/DESCRIPTION.rst | 4 + sale_brand/readme/USAGE.rst | 8 ++ sale_brand/static/description/icon.png | Bin 0 -> 9455 bytes sale_brand/views/report_template.xml | 144 +++++++++++++++++++++++++ sale_brand/views/sale_views.xml | 17 +++ 13 files changed, 252 insertions(+) create mode 100644 sale_brand/README.rst create mode 100644 sale_brand/__init__.py create mode 100644 sale_brand/__manifest__.py create mode 100644 sale_brand/models/__init__.py create mode 100644 sale_brand/models/sale_order.py create mode 100644 sale_brand/readme/CONFIGURE.rst create mode 100644 sale_brand/readme/CONTRIBUTORS.rst create mode 100644 sale_brand/readme/CREDITS.rst create mode 100644 sale_brand/readme/DESCRIPTION.rst create mode 100644 sale_brand/readme/USAGE.rst create mode 100644 sale_brand/static/description/icon.png create mode 100644 sale_brand/views/report_template.xml create mode 100644 sale_brand/views/sale_views.xml diff --git a/sale_brand/README.rst b/sale_brand/README.rst new file mode 100644 index 000000000..21cd7854d --- /dev/null +++ b/sale_brand/README.rst @@ -0,0 +1,21 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. diff --git a/sale_brand/__init__.py b/sale_brand/__init__.py new file mode 100644 index 000000000..33c2f06ef --- /dev/null +++ b/sale_brand/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py new file mode 100644 index 000000000..e80564e03 --- /dev/null +++ b/sale_brand/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Sale Brand", + "summary": "Send branded sales orders", + "version": "12.0.1.0.0", + "category": "Sales Management", + "website": "https://github.com/OCA/sale-workflow", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + 'account_brand', + 'sale', + ], + "data": [ + "views/sale_views.xml", + "views/report_template.xml", + ], + "installable": True, + "development_status": "Beta", + "maintainers": ["osi-scampbell"], +} diff --git a/sale_brand/models/__init__.py b/sale_brand/models/__init__.py new file mode 100644 index 000000000..cc07d44a4 --- /dev/null +++ b/sale_brand/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import sale_order diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py new file mode 100644 index 000000000..437faae9d --- /dev/null +++ b/sale_brand/models/sale_order.py @@ -0,0 +1,21 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class SaleOrder(models.Model): + _inherit = 'sale.order' + + brand_id = fields.Many2one( + 'res.partner', string='Brand', domain="[('type', '=', 'brand')]", + help="Brand to use for this sale") + + @api.multi + def _prepare_invoice(self): + for order in self: + invoice_vals = super(SaleOrder, order)._prepare_invoice() + invoice_vals.update({ + 'brand_id': order.brand_id.id, + }) + return invoice_vals diff --git a/sale_brand/readme/CONFIGURE.rst b/sale_brand/readme/CONFIGURE.rst new file mode 100644 index 000000000..a20e2200f --- /dev/null +++ b/sale_brand/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +To configure this module, please refer to the documentation of +`partner_brand `_. diff --git a/sale_brand/readme/CONTRIBUTORS.rst b/sale_brand/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..d9fb6931c --- /dev/null +++ b/sale_brand/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Raphael Lee +* Steve Campbell +* Maxime Chambreuil diff --git a/sale_brand/readme/CREDITS.rst b/sale_brand/readme/CREDITS.rst new file mode 100644 index 000000000..dab2345c9 --- /dev/null +++ b/sale_brand/readme/CREDITS.rst @@ -0,0 +1 @@ +* Open Source Integrators diff --git a/sale_brand/readme/DESCRIPTION.rst b/sale_brand/readme/DESCRIPTION.rst new file mode 100644 index 000000000..16941ec37 --- /dev/null +++ b/sale_brand/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module allows you to send branded quotations and sales orders to your +customers. +It adds a brand field on the quotation and propagate the value on +the invoices. diff --git a/sale_brand/readme/USAGE.rst b/sale_brand/readme/USAGE.rst new file mode 100644 index 000000000..a55741b5e --- /dev/null +++ b/sale_brand/readme/USAGE.rst @@ -0,0 +1,8 @@ +To use this module, you need to: + +#. Go to Sales > Quotations +#. Select or create a quotation +#. Enter the information and the brand +#. Print the PDF report. It includes the information of the brand. +#. Confirm the quotation and generate an invoice +#. Print the PDF report. It includes the information of the brand. diff --git a/sale_brand/static/description/icon.png b/sale_brand/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9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qa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/sale_brand/views/report_template.xml b/sale_brand/views/report_template.xml new file mode 100644 index 000000000..7b936aa36 --- /dev/null +++ b/sale_brand/views/report_template.xml @@ -0,0 +1,144 @@ + + + + + + + diff --git a/sale_brand/views/sale_views.xml b/sale_brand/views/sale_views.xml new file mode 100644 index 000000000..c7c5931d0 --- /dev/null +++ b/sale_brand/views/sale_views.xml @@ -0,0 +1,17 @@ + + + + + + sale.order.form.brand + sale.order + + + + + + + + + From bb760d4de2d363bd8cf0d72b39164e6449ce665d Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Sat, 20 Jul 2019 20:05:07 -0500 Subject: [PATCH 02/40] [DEL] sale_brand: More report to partner_brand --- sale_brand/README.rst | 120 +++++- sale_brand/__manifest__.py | 1 - sale_brand/i18n/sale_brand.pot | 30 ++ sale_brand/i18n/zh_CN.po | 32 ++ sale_brand/static/description/index.html | 452 +++++++++++++++++++++++ sale_brand/views/report_template.xml | 144 -------- 6 files changed, 618 insertions(+), 161 deletions(-) create mode 100644 sale_brand/i18n/sale_brand.pot create mode 100644 sale_brand/i18n/zh_CN.po create mode 100644 sale_brand/static/description/index.html delete mode 100644 sale_brand/views/report_template.xml diff --git a/sale_brand/README.rst b/sale_brand/README.rst index 21cd7854d..361de3efe 100644 --- a/sale_brand/README.rst +++ b/sale_brand/README.rst @@ -1,21 +1,109 @@ -**This file is going to be generated by oca-gen-addon-readme.** +========== +Sale Brand +========== -*Manual changes will be overwritten.* +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -Please provide content in the ``readme`` directory: +.. |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%2Fbrand-lightgray.png?logo=github + :target: https://github.com/OCA/brand/tree/12.0/sale_brand + :alt: OCA/brand +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/brand-12-0/brand-12-0-sale_brand + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/284/12.0 + :alt: Try me on Runbot -* **DESCRIPTION.rst** (required) -* INSTALL.rst (optional) -* CONFIGURE.rst (optional) -* **USAGE.rst** (optional, highly recommended) -* DEVELOP.rst (optional) -* ROADMAP.rst (optional) -* HISTORY.rst (optional, recommended) -* **CONTRIBUTORS.rst** (optional, highly recommended) -* CREDITS.rst (optional) +|badge1| |badge2| |badge3| |badge4| |badge5| -Content of this README will also be drawn from the addon manifest, -from keys such as name, authors, maintainers, development_status, -and license. +This module allows you to send branded quotations and sales orders to your +customers. +It adds a brand field on the quotation and propagate the value on +the invoices. -A good, one sentence summary in the manifest is also highly recommended. +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, please refer to the documentation of +`partner_brand `_. + +Usage +===== + +To use this module, you need to: + +#. Go to Sales > Quotations +#. Select or create a quotation +#. Enter the information and the brand +#. Print the PDF report. It includes the information of the brand. +#. Confirm the quotation and generate an invoice +#. Print the PDF report. It includes the information of the brand. + +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 +~~~~~~~~~~~~ + +* Raphael Lee +* Steve Campbell +* Maxime Chambreuil + +Other credits +~~~~~~~~~~~~~ + +* 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-osi-scampbell| image:: https://github.com/osi-scampbell.png?size=40px + :target: https://github.com/osi-scampbell + :alt: osi-scampbell + +Current `maintainer `__: + +|maintainer-osi-scampbell| + +This module is part of the `OCA/brand `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index e80564e03..a36e3a0fc 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -15,7 +15,6 @@ ], "data": [ "views/sale_views.xml", - "views/report_template.xml", ], "installable": True, "development_status": "Beta", diff --git a/sale_brand/i18n/sale_brand.pot b/sale_brand/i18n/sale_brand.pot new file mode 100644 index 000000000..5d371ee7c --- /dev/null +++ b/sale_brand/i18n/sale_brand.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_brand +# +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: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id +msgid "Brand" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id +msgid "Brand to use for this sale" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_order +msgid "Sale Order" +msgstr "" + diff --git a/sale_brand/i18n/zh_CN.po b/sale_brand/i18n/zh_CN.po new file mode 100644 index 000000000..8e3fcb229 --- /dev/null +++ b/sale_brand/i18n/zh_CN.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-09-01 09:03+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id +msgid "Brand" +msgstr "品牌" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id +msgid "Brand to use for this sale" +msgstr "品牌用于此次销售" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_order +msgid "Sale Order" +msgstr "销售订单" diff --git a/sale_brand/static/description/index.html b/sale_brand/static/description/index.html new file mode 100644 index 000000000..8c94aa7c2 --- /dev/null +++ b/sale_brand/static/description/index.html @@ -0,0 +1,452 @@ + + + + + + +Sale Brand + + + +
+

Sale Brand

+ + +

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

+

This module allows you to send branded quotations and sales orders to your +customers. +It adds a brand field on the quotation and propagate the value on +the invoices.

+

Table of contents

+ +
+

Configuration

+

To configure this module, please refer to the documentation of +partner_brand.

+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Sales > Quotations
  2. +
  3. Select or create a quotation
  4. +
  5. Enter the information and the brand
  6. +
  7. Print the PDF report. It includes the information of the brand.
  8. +
  9. Confirm the quotation and generate an invoice
  10. +
  11. Print the PDF report. It includes the information of the brand.
  12. +
+
+
+

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
  • +
+
+ +
+

Other credits

+ +
+
+

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:

+

osi-scampbell

+

This module is part of the OCA/brand project on GitHub.

+

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

+
+
+
+ + diff --git a/sale_brand/views/report_template.xml b/sale_brand/views/report_template.xml deleted file mode 100644 index 7b936aa36..000000000 --- a/sale_brand/views/report_template.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - From ebc622ce29da24b8d9f313be09934ccfe36d935a Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Fri, 16 Aug 2019 13:57:40 +0200 Subject: [PATCH 03/40] [12.0][IMP] - dedicated model for partner model in sale_brand module --- sale_brand/__manifest__.py | 2 +- .../migrations/12.0.2.0.0/post-migration.py | 15 +++++++++++++++ .../migrations/12.0.2.0.0/pre-migration.py | 16 ++++++++++++++++ sale_brand/models/sale_order.py | 2 +- 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 sale_brand/migrations/12.0.2.0.0/post-migration.py create mode 100644 sale_brand/migrations/12.0.2.0.0/pre-migration.py diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index a36e3a0fc..8104336c7 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "12.0.1.0.0", + "version": "12.0.2.0.0", "category": "Sales Management", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/sale_brand/migrations/12.0.2.0.0/post-migration.py b/sale_brand/migrations/12.0.2.0.0/post-migration.py new file mode 100644 index 000000000..242f93c85 --- /dev/null +++ b/sale_brand/migrations/12.0.2.0.0/post-migration.py @@ -0,0 +1,15 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + _logger.info("Move sale brand to res.brand model") + cr.execute(""" + UPDATE sale_order SET brand_id = brand.id + FROM res_brand brand + WHERE brand.partner_id=brand_id_tmp""") + cr.execute("""ALTER TABLE sale_order DROP COLUMN brand_id_tmp""") diff --git a/sale_brand/migrations/12.0.2.0.0/pre-migration.py b/sale_brand/migrations/12.0.2.0.0/pre-migration.py new file mode 100644 index 000000000..63d48fc69 --- /dev/null +++ b/sale_brand/migrations/12.0.2.0.0/pre-migration.py @@ -0,0 +1,16 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + _logger.info("Move sale brand to res.brand model") + cr.execute( + """ALTER TABLE sale_order + ADD COLUMN brand_id_tmp INTEGER""" + ) + cr.execute("""UPDATE sale_order SET brand_id_tmp = brand_id""") + cr.execute("""ALTER TABLE sale_order DROP COLUMN brand_id""") diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py index 437faae9d..a379d261f 100644 --- a/sale_brand/models/sale_order.py +++ b/sale_brand/models/sale_order.py @@ -8,7 +8,7 @@ class SaleOrder(models.Model): _inherit = 'sale.order' brand_id = fields.Many2one( - 'res.partner', string='Brand', domain="[('type', '=', 'brand')]", + 'res.brand', string='Brand', help="Brand to use for this sale") @api.multi From 1e51abc01f80281889efdf0ea54a65af716fb249 Mon Sep 17 00:00:00 2001 From: Xavier Brochard Date: Fri, 25 Oct 2019 08:54:31 +0200 Subject: [PATCH 04/40] Fix URL was on OCA/partner-contact, switch to OCA/brand --- sale_brand/README.rst | 2 +- sale_brand/readme/CONFIGURE.rst | 2 +- sale_brand/static/description/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sale_brand/README.rst b/sale_brand/README.rst index 361de3efe..a629e8b83 100644 --- a/sale_brand/README.rst +++ b/sale_brand/README.rst @@ -39,7 +39,7 @@ Configuration ============= To configure this module, please refer to the documentation of -`partner_brand `_. +`partner_brand `_. Usage ===== diff --git a/sale_brand/readme/CONFIGURE.rst b/sale_brand/readme/CONFIGURE.rst index a20e2200f..bdf04f5e5 100644 --- a/sale_brand/readme/CONFIGURE.rst +++ b/sale_brand/readme/CONFIGURE.rst @@ -1,2 +1,2 @@ To configure this module, please refer to the documentation of -`partner_brand `_. +`partner_brand `_. diff --git a/sale_brand/static/description/index.html b/sale_brand/static/description/index.html index 8c94aa7c2..13508c855 100644 --- a/sale_brand/static/description/index.html +++ b/sale_brand/static/description/index.html @@ -390,7 +390,7 @@

Sale Brand

Configuration

To configure this module, please refer to the documentation of -partner_brand.

+partner_brand.

Usage

From b4cb8f95bf461d9c081783e75acbc92c11b47ade Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Thu, 31 Oct 2019 18:05:59 +0100 Subject: [PATCH 05/40] [12.0][REF] - Use brand mixin in branded sale orders definition --- sale_brand/__manifest__.py | 5 +++-- sale_brand/i18n/hr.po | 29 +++++++++++++++++++++++++++++ sale_brand/i18n/sale_brand.pot | 10 ---------- sale_brand/i18n/zh_CN.po | 18 +++++++----------- sale_brand/models/sale_order.py | 9 +++------ 5 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 sale_brand/i18n/hr.po diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 8104336c7..7835fd272 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,14 +4,15 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "12.0.2.0.0", + "version": "12.0.2.1.0", "category": "Sales Management", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", "license": "AGPL-3", "depends": [ - 'account_brand', 'sale', + 'brand', + 'account_brand', ], "data": [ "views/sale_views.xml", diff --git a/sale_brand/i18n/hr.po b/sale_brand/i18n/hr.po new file mode 100644 index 000000000..30686568d --- /dev/null +++ b/sale_brand/i18n/hr.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-11-13 15:34+0000\n" +"Last-Translator: Bole \n" +"Language-Team: none\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.8\n" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_order +msgid "Sale Order" +msgstr "Ponuda" + +#~ msgid "Brand" +#~ msgstr "Brand" + +#~ msgid "Brand to use for this sale" +#~ msgstr "Za ovu prodaju koristiti brand" diff --git a/sale_brand/i18n/sale_brand.pot b/sale_brand/i18n/sale_brand.pot index 5d371ee7c..234602f4c 100644 --- a/sale_brand/i18n/sale_brand.pot +++ b/sale_brand/i18n/sale_brand.pot @@ -13,16 +13,6 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: sale_brand -#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id -msgid "Brand" -msgstr "" - -#. module: sale_brand -#: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id -msgid "Brand to use for this sale" -msgstr "" - #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_order msgid "Sale Order" diff --git a/sale_brand/i18n/zh_CN.po b/sale_brand/i18n/zh_CN.po index 8e3fcb229..2d85e0d0e 100644 --- a/sale_brand/i18n/zh_CN.po +++ b/sale_brand/i18n/zh_CN.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sale_brand +# * sale_brand # msgid "" msgstr "" @@ -16,17 +16,13 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Weblate 3.8\n" -#. module: sale_brand -#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id -msgid "Brand" -msgstr "品牌" - -#. module: sale_brand -#: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id -msgid "Brand to use for this sale" -msgstr "品牌用于此次销售" - #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_order msgid "Sale Order" msgstr "销售订单" + +#~ msgid "Brand" +#~ msgstr "品牌" + +#~ msgid "Brand to use for this sale" +#~ msgstr "品牌用于此次销售" diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py index a379d261f..693a71992 100644 --- a/sale_brand/models/sale_order.py +++ b/sale_brand/models/sale_order.py @@ -1,15 +1,12 @@ # Copyright (C) 2019 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, models class SaleOrder(models.Model): - _inherit = 'sale.order' - - brand_id = fields.Many2one( - 'res.brand', string='Brand', - help="Brand to use for this sale") + _name = 'sale.order' + _inherit = ['sale.order', 'res.brand.mixin'] @api.multi def _prepare_invoice(self): From 6a2c06529a5700d4c68f0872a47c1038a0bf5bf6 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Wed, 14 Aug 2019 17:39:14 +0200 Subject: [PATCH 06/40] [FIX] - set brand for down payment invoices --- sale_brand/__init__.py | 1 + sale_brand/wizard/__init__.py | 1 + sale_brand/wizard/sale_make_invoice_advance.py | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 sale_brand/wizard/__init__.py create mode 100644 sale_brand/wizard/sale_make_invoice_advance.py diff --git a/sale_brand/__init__.py b/sale_brand/__init__.py index 33c2f06ef..a5b63e4aa 100644 --- a/sale_brand/__init__.py +++ b/sale_brand/__init__.py @@ -2,3 +2,4 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models +from . import wizard diff --git a/sale_brand/wizard/__init__.py b/sale_brand/wizard/__init__.py new file mode 100644 index 000000000..fca48c3d0 --- /dev/null +++ b/sale_brand/wizard/__init__.py @@ -0,0 +1 @@ +from . import sale_make_invoice_advance diff --git a/sale_brand/wizard/sale_make_invoice_advance.py b/sale_brand/wizard/sale_make_invoice_advance.py new file mode 100644 index 000000000..9a0cae4e5 --- /dev/null +++ b/sale_brand/wizard/sale_make_invoice_advance.py @@ -0,0 +1,15 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class SaleAdvancePaymentInv(models.TransientModel): + _inherit = "sale.advance.payment.inv" + + @api.multi + def _create_invoice(self, order, so_line, amount): + invoice = super()._create_invoice(order, so_line, amount) + invoice.brand_id = order.brand_id + invoice._onchange_partner_id() + return invoice From aeb5ddd6ab013d07cf157e614b74ac4f9aed95e3 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Fri, 16 Aug 2019 11:41:34 +0200 Subject: [PATCH 07/40] [ADD] - Add unit tests --- sale_brand/__init__.py | 1 + sale_brand/__manifest__.py | 2 +- sale_brand/i18n/hr.po | 5 +++++ sale_brand/i18n/sale_brand.pot | 5 +++++ sale_brand/i18n/zh_CN.po | 5 +++++ sale_brand/tests/__init__.py | 1 + sale_brand/tests/test_sale_order.py | 35 +++++++++++++++++++++++++++++ 7 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 sale_brand/tests/__init__.py create mode 100644 sale_brand/tests/test_sale_order.py diff --git a/sale_brand/__init__.py b/sale_brand/__init__.py index a5b63e4aa..4c550ffcc 100644 --- a/sale_brand/__init__.py +++ b/sale_brand/__init__.py @@ -3,3 +3,4 @@ from . import models from . import wizard +from . import tests diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 7835fd272..829e3aba0 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "12.0.2.1.0", + "version": "12.0.2.1.1", "category": "Sales Management", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/sale_brand/i18n/hr.po b/sale_brand/i18n/hr.po index 30686568d..165c33329 100644 --- a/sale_brand/i18n/hr.po +++ b/sale_brand/i18n/hr.po @@ -22,6 +22,11 @@ msgstr "" msgid "Sale Order" msgstr "Ponuda" +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + #~ msgid "Brand" #~ msgstr "Brand" diff --git a/sale_brand/i18n/sale_brand.pot b/sale_brand/i18n/sale_brand.pot index 234602f4c..951bd7ae1 100644 --- a/sale_brand/i18n/sale_brand.pot +++ b/sale_brand/i18n/sale_brand.pot @@ -18,3 +18,8 @@ msgstr "" msgid "Sale Order" msgstr "" +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + diff --git a/sale_brand/i18n/zh_CN.po b/sale_brand/i18n/zh_CN.po index 2d85e0d0e..e0960f51c 100644 --- a/sale_brand/i18n/zh_CN.po +++ b/sale_brand/i18n/zh_CN.po @@ -21,6 +21,11 @@ msgstr "" msgid "Sale Order" msgstr "销售订单" +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + #~ msgid "Brand" #~ msgstr "品牌" diff --git a/sale_brand/tests/__init__.py b/sale_brand/tests/__init__.py new file mode 100644 index 000000000..6f699d0d8 --- /dev/null +++ b/sale_brand/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_order diff --git a/sale_brand/tests/test_sale_order.py b/sale_brand/tests/test_sale_order.py new file mode 100644 index 000000000..70731c641 --- /dev/null +++ b/sale_brand/tests/test_sale_order.py @@ -0,0 +1,35 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + + +class TestSaleOrder(TransactionCase): + def setUp(self): + super(TestSaleOrder, self).setUp() + self.sale = self.env.ref('sale.sale_order_1') + self.sale.brand_id = self.env['res.brand'].create({'name': 'brand'}) + self.sale.order_line.mapped('product_id').write( + {'invoice_policy': 'order'} + ) + self.sale.action_confirm() + + def test_create_invoice(self): + """It should create branded invoice""" + self.assertEqual(self.sale.invoice_status, 'to invoice') + invoice_ids = self.sale.action_invoice_create() + invoice = self.env['account.invoice'].browse(invoice_ids[0]) + self.assertEqual(invoice.brand_id, self.sale.brand_id) + + def test_create_down_payment_invoice(self): + """It should create branded down-payment invoice""" + advance_payment_wizard = self.env['sale.advance.payment.inv'].create( + {'advance_payment_method': 'fixed', 'amount': 10.0} + ) + advance_payment_wizard.with_context( + active_ids=self.sale.ids + ).create_invoices() + invoice = self.sale.order_line.mapped('invoice_lines').mapped( + 'invoice_id' + ) + self.assertEqual(invoice.brand_id, self.sale.brand_id) From 870f73dd82f877e1072502ff9006dd31be344ac6 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Thu, 13 Feb 2020 11:40:15 +0100 Subject: [PATCH 08/40] [12.0][IMP] - Brand field is editable in draft state for invoice and sale object --- sale_brand/__manifest__.py | 2 +- sale_brand/i18n/hr.po | 16 ++++++++++------ sale_brand/i18n/sale_brand.pot | 10 ++++++++++ sale_brand/i18n/zh_CN.po | 16 ++++++++++------ sale_brand/models/sale_order.py | 11 ++++++++++- 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 829e3aba0..870a19cce 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "12.0.2.1.1", + "version": "12.0.3.0.0", "category": "Sales Management", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/sale_brand/i18n/hr.po b/sale_brand/i18n/hr.po index 165c33329..cccfe2512 100644 --- a/sale_brand/i18n/hr.po +++ b/sale_brand/i18n/hr.po @@ -17,6 +17,16 @@ msgstr "" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 3.8\n" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id +msgid "Brand" +msgstr "Brand" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id +msgid "Brand to use for this sale" +msgstr "Za ovu prodaju koristiti brand" + #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_order msgid "Sale Order" @@ -26,9 +36,3 @@ msgstr "Ponuda" #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" msgstr "" - -#~ msgid "Brand" -#~ msgstr "Brand" - -#~ msgid "Brand to use for this sale" -#~ msgstr "Za ovu prodaju koristiti brand" diff --git a/sale_brand/i18n/sale_brand.pot b/sale_brand/i18n/sale_brand.pot index 951bd7ae1..c03baf66a 100644 --- a/sale_brand/i18n/sale_brand.pot +++ b/sale_brand/i18n/sale_brand.pot @@ -13,6 +13,16 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id +msgid "Brand" +msgstr "" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id +msgid "Brand to use for this sale" +msgstr "" + #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_order msgid "Sale Order" diff --git a/sale_brand/i18n/zh_CN.po b/sale_brand/i18n/zh_CN.po index e0960f51c..371304829 100644 --- a/sale_brand/i18n/zh_CN.po +++ b/sale_brand/i18n/zh_CN.po @@ -16,6 +16,16 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Weblate 3.8\n" +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id +msgid "Brand" +msgstr "品牌" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id +msgid "Brand to use for this sale" +msgstr "品牌用于此次销售" + #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_order msgid "Sale Order" @@ -25,9 +35,3 @@ msgstr "销售订单" #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" msgstr "" - -#~ msgid "Brand" -#~ msgstr "品牌" - -#~ msgid "Brand to use for this sale" -#~ msgstr "品牌用于此次销售" diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py index 693a71992..d97b6850d 100644 --- a/sale_brand/models/sale_order.py +++ b/sale_brand/models/sale_order.py @@ -1,13 +1,22 @@ # Copyright (C) 2019 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, models +from odoo import api, fields, models class SaleOrder(models.Model): _name = 'sale.order' _inherit = ['sale.order', 'res.brand.mixin'] + brand_id = fields.Many2one( + states={ + 'sent': [('readonly', True)], + 'sale': [('readonly', True)], + 'done': [('readonly', True)], + 'cancel': [('readonly', True)], + } + ) + @api.multi def _prepare_invoice(self): for order in self: From c05445c67dc1b1c2373510ca5f328eea94f5d53d Mon Sep 17 00:00:00 2001 From: cubells Date: Fri, 17 Apr 2020 19:34:23 +0200 Subject: [PATCH 09/40] [IMP] sale_brand: black, isort, prettier --- sale_brand/__init__.py | 3 --- sale_brand/__manifest__.py | 12 +++------- .../migrations/12.0.2.0.0/post-migration.py | 15 ------------ .../migrations/12.0.2.0.0/pre-migration.py | 16 ------------- sale_brand/models/__init__.py | 3 --- sale_brand/models/sale_order.py | 17 +++++++------ sale_brand/tests/test_sale_order.py | 24 +++++++------------ sale_brand/views/sale_views.xml | 7 ++---- 8 files changed, 22 insertions(+), 75 deletions(-) delete mode 100644 sale_brand/migrations/12.0.2.0.0/post-migration.py delete mode 100644 sale_brand/migrations/12.0.2.0.0/pre-migration.py diff --git a/sale_brand/__init__.py b/sale_brand/__init__.py index 4c550ffcc..2c9b3790d 100644 --- a/sale_brand/__init__.py +++ b/sale_brand/__init__.py @@ -1,6 +1,3 @@ -# Copyright (C) 2019 Open Source Integrators -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - from . import models from . import wizard from . import tests diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 870a19cce..89bc6acf7 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,19 +4,13 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "12.0.3.0.0", + "version": "13.0.0.0.0", "category": "Sales Management", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", "license": "AGPL-3", - "depends": [ - 'sale', - 'brand', - 'account_brand', - ], - "data": [ - "views/sale_views.xml", - ], + "depends": ["sale", "brand", "account_brand"], + "data": ["views/sale_views.xml"], "installable": True, "development_status": "Beta", "maintainers": ["osi-scampbell"], diff --git a/sale_brand/migrations/12.0.2.0.0/post-migration.py b/sale_brand/migrations/12.0.2.0.0/post-migration.py deleted file mode 100644 index 242f93c85..000000000 --- a/sale_brand/migrations/12.0.2.0.0/post-migration.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import logging - -_logger = logging.getLogger(__name__) - - -def migrate(cr, version): - _logger.info("Move sale brand to res.brand model") - cr.execute(""" - UPDATE sale_order SET brand_id = brand.id - FROM res_brand brand - WHERE brand.partner_id=brand_id_tmp""") - cr.execute("""ALTER TABLE sale_order DROP COLUMN brand_id_tmp""") diff --git a/sale_brand/migrations/12.0.2.0.0/pre-migration.py b/sale_brand/migrations/12.0.2.0.0/pre-migration.py deleted file mode 100644 index 63d48fc69..000000000 --- a/sale_brand/migrations/12.0.2.0.0/pre-migration.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import logging - -_logger = logging.getLogger(__name__) - - -def migrate(cr, version): - _logger.info("Move sale brand to res.brand model") - cr.execute( - """ALTER TABLE sale_order - ADD COLUMN brand_id_tmp INTEGER""" - ) - cr.execute("""UPDATE sale_order SET brand_id_tmp = brand_id""") - cr.execute("""ALTER TABLE sale_order DROP COLUMN brand_id""") diff --git a/sale_brand/models/__init__.py b/sale_brand/models/__init__.py index cc07d44a4..6aacb7531 100644 --- a/sale_brand/models/__init__.py +++ b/sale_brand/models/__init__.py @@ -1,4 +1 @@ -# Copyright (C) 2019 Open Source Integrators -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - from . import sale_order diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py index d97b6850d..e21b1b40f 100644 --- a/sale_brand/models/sale_order.py +++ b/sale_brand/models/sale_order.py @@ -5,23 +5,22 @@ class SaleOrder(models.Model): - _name = 'sale.order' - _inherit = ['sale.order', 'res.brand.mixin'] + _name = "sale.order" + _inherit = ["sale.order", "res.brand.mixin"] brand_id = fields.Many2one( states={ - 'sent': [('readonly', True)], - 'sale': [('readonly', True)], - 'done': [('readonly', True)], - 'cancel': [('readonly', True)], + "sent": [("readonly", True)], + "sale": [("readonly", True)], + "done": [("readonly", True)], + "cancel": [("readonly", True)], } ) @api.multi def _prepare_invoice(self): + invoice_vals = {} for order in self: invoice_vals = super(SaleOrder, order)._prepare_invoice() - invoice_vals.update({ - 'brand_id': order.brand_id.id, - }) + invoice_vals.update({"brand_id": order.brand_id.id}) return invoice_vals diff --git a/sale_brand/tests/test_sale_order.py b/sale_brand/tests/test_sale_order.py index 70731c641..9d0bb21ab 100644 --- a/sale_brand/tests/test_sale_order.py +++ b/sale_brand/tests/test_sale_order.py @@ -7,29 +7,23 @@ class TestSaleOrder(TransactionCase): def setUp(self): super(TestSaleOrder, self).setUp() - self.sale = self.env.ref('sale.sale_order_1') - self.sale.brand_id = self.env['res.brand'].create({'name': 'brand'}) - self.sale.order_line.mapped('product_id').write( - {'invoice_policy': 'order'} - ) + self.sale = self.env.ref("sale.sale_order_1") + self.sale.brand_id = self.env["res.brand"].create({"name": "brand"}) + self.sale.order_line.mapped("product_id").write({"invoice_policy": "order"}) self.sale.action_confirm() def test_create_invoice(self): """It should create branded invoice""" - self.assertEqual(self.sale.invoice_status, 'to invoice') + self.assertEqual(self.sale.invoice_status, "to invoice") invoice_ids = self.sale.action_invoice_create() - invoice = self.env['account.invoice'].browse(invoice_ids[0]) + invoice = self.env["account.invoice"].browse(invoice_ids[0]) self.assertEqual(invoice.brand_id, self.sale.brand_id) def test_create_down_payment_invoice(self): """It should create branded down-payment invoice""" - advance_payment_wizard = self.env['sale.advance.payment.inv'].create( - {'advance_payment_method': 'fixed', 'amount': 10.0} - ) - advance_payment_wizard.with_context( - active_ids=self.sale.ids - ).create_invoices() - invoice = self.sale.order_line.mapped('invoice_lines').mapped( - 'invoice_id' + advance_payment_wizard = self.env["sale.advance.payment.inv"].create( + {"advance_payment_method": "fixed", "amount": 10.0} ) + advance_payment_wizard.with_context(active_ids=self.sale.ids).create_invoices() + invoice = self.sale.order_line.mapped("invoice_lines").mapped("invoice_id") self.assertEqual(invoice.brand_id, self.sale.brand_id) diff --git a/sale_brand/views/sale_views.xml b/sale_brand/views/sale_views.xml index c7c5931d0..7a4ad69f7 100644 --- a/sale_brand/views/sale_views.xml +++ b/sale_brand/views/sale_views.xml @@ -1,17 +1,14 @@ - - sale.order.form.brand sale.order - + - + - From 4ed1262ab8defeec8e33798a6ac28ff5bfa69876 Mon Sep 17 00:00:00 2001 From: cubells Date: Fri, 17 Apr 2020 19:45:40 +0200 Subject: [PATCH 10/40] [MIG] sale_brand: Migration to 13.0 --- sale_brand/README.rst | 27 ++++++----- sale_brand/__manifest__.py | 2 +- sale_brand/i18n/hr.po | 12 +++-- sale_brand/i18n/sale_brand.pot | 15 +++--- sale_brand/i18n/zh_CN.po | 12 +++-- sale_brand/models/sale_order.py | 3 +- sale_brand/readme/CONFIGURE.rst | 2 - sale_brand/readme/CONTRIBUTORS.rst | 4 ++ sale_brand/static/description/index.html | 48 +++++++++---------- sale_brand/tests/test_sale_order.py | 7 ++- .../wizard/sale_make_invoice_advance.py | 3 +- 11 files changed, 68 insertions(+), 67 deletions(-) delete mode 100644 sale_brand/readme/CONFIGURE.rst diff --git a/sale_brand/README.rst b/sale_brand/README.rst index a629e8b83..1b8643cf4 100644 --- a/sale_brand/README.rst +++ b/sale_brand/README.rst @@ -14,13 +14,13 @@ Sale Brand :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github - :target: https://github.com/OCA/brand/tree/12.0/sale_brand + :target: https://github.com/OCA/brand/tree/13.0/sale_brand :alt: OCA/brand .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/brand-12-0/brand-12-0-sale_brand + :target: https://translation.odoo-community.org/projects/brand-13-0/brand-13-0-sale_brand :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/284/12.0 + :target: https://runbot.odoo-community.org/runbot/284/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -35,12 +35,6 @@ the invoices. .. contents:: :local: -Configuration -============= - -To configure this module, please refer to the documentation of -`partner_brand `_. - Usage ===== @@ -59,7 +53,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. @@ -78,6 +72,10 @@ Contributors * Steve Campbell * Maxime Chambreuil +* `Obertix `_: + + * Vicent Cubells + Other credits ~~~~~~~~~~~~~ @@ -99,11 +97,14 @@ promote its widespread use. .. |maintainer-osi-scampbell| image:: https://github.com/osi-scampbell.png?size=40px :target: https://github.com/osi-scampbell :alt: osi-scampbell +.. |maintainer-sbejaoui| image:: https://github.com/sbejaoui.png?size=40px + :target: https://github.com/sbejaoui + :alt: sbejaoui -Current `maintainer `__: +Current `maintainers `__: -|maintainer-osi-scampbell| +|maintainer-osi-scampbell| |maintainer-sbejaoui| -This module is part of the `OCA/brand `_ project on GitHub. +This module is part of the `OCA/brand `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 89bc6acf7..c640fcde2 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -13,5 +13,5 @@ "data": ["views/sale_views.xml"], "installable": True, "development_status": "Beta", - "maintainers": ["osi-scampbell"], + "maintainers": ["osi-scampbell", "sbejaoui"], } diff --git a/sale_brand/i18n/hr.po b/sale_brand/i18n/hr.po index cccfe2512..7283befe8 100644 --- a/sale_brand/i18n/hr.po +++ b/sale_brand/i18n/hr.po @@ -27,12 +27,14 @@ msgstr "Brand" msgid "Brand to use for this sale" msgstr "Za ovu prodaju koristiti brand" -#. module: sale_brand -#: model:ir.model,name:sale_brand.model_sale_order -msgid "Sale Order" -msgstr "Ponuda" - #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_order +#, fuzzy +#| msgid "Sale Order" +msgid "Sales Order" +msgstr "Ponuda" diff --git a/sale_brand/i18n/sale_brand.pot b/sale_brand/i18n/sale_brand.pot index c03baf66a..68e5eabc9 100644 --- a/sale_brand/i18n/sale_brand.pot +++ b/sale_brand/i18n/sale_brand.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sale_brand +# * sale_brand # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -23,13 +23,12 @@ msgstr "" msgid "Brand to use for this sale" msgstr "" -#. module: sale_brand -#: model:ir.model,name:sale_brand.model_sale_order -msgid "Sale Order" -msgstr "" - #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" msgstr "" +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_order +msgid "Sales Order" +msgstr "" diff --git a/sale_brand/i18n/zh_CN.po b/sale_brand/i18n/zh_CN.po index 371304829..b30ee34a9 100644 --- a/sale_brand/i18n/zh_CN.po +++ b/sale_brand/i18n/zh_CN.po @@ -26,12 +26,14 @@ msgstr "品牌" msgid "Brand to use for this sale" msgstr "品牌用于此次销售" -#. module: sale_brand -#: model:ir.model,name:sale_brand.model_sale_order -msgid "Sale Order" -msgstr "销售订单" - #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_advance_payment_inv msgid "Sales Advance Payment Invoice" msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_order +#, fuzzy +#| msgid "Sale Order" +msgid "Sales Order" +msgstr "销售订单" diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py index e21b1b40f..6cbba7754 100644 --- a/sale_brand/models/sale_order.py +++ b/sale_brand/models/sale_order.py @@ -1,7 +1,7 @@ # Copyright (C) 2019 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, fields, models +from odoo import fields, models class SaleOrder(models.Model): @@ -17,7 +17,6 @@ class SaleOrder(models.Model): } ) - @api.multi def _prepare_invoice(self): invoice_vals = {} for order in self: diff --git a/sale_brand/readme/CONFIGURE.rst b/sale_brand/readme/CONFIGURE.rst deleted file mode 100644 index bdf04f5e5..000000000 --- a/sale_brand/readme/CONFIGURE.rst +++ /dev/null @@ -1,2 +0,0 @@ -To configure this module, please refer to the documentation of -`partner_brand `_. diff --git a/sale_brand/readme/CONTRIBUTORS.rst b/sale_brand/readme/CONTRIBUTORS.rst index d9fb6931c..be2101c94 100644 --- a/sale_brand/readme/CONTRIBUTORS.rst +++ b/sale_brand/readme/CONTRIBUTORS.rst @@ -1,3 +1,7 @@ * Raphael Lee * Steve Campbell * Maxime Chambreuil + +* `Obertix `_: + + * Vicent Cubells diff --git a/sale_brand/static/description/index.html b/sale_brand/static/description/index.html index 13508c855..7a2730b28 100644 --- a/sale_brand/static/description/index.html +++ b/sale_brand/static/description/index.html @@ -367,7 +367,7 @@

Sale Brand

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module allows you to send branded quotations and sales orders to your customers. It adds a brand field on the quotation and propagate the value on @@ -375,25 +375,19 @@

Sale Brand

Table of contents

-
-

Configuration

-

To configure this module, please refer to the documentation of -partner_brand.

-
-

Usage

+

Usage

To use this module, you need to:

  1. Go to Sales > Quotations
  2. @@ -405,45 +399,49 @@

    Usage

-

Bug Tracker

+

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.

-

Credits

+

Credits

-

Authors

+

Authors

  • Open Source Integrators
-

Maintainers

+

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:

-

osi-scampbell

-

This module is part of the OCA/brand project on GitHub.

+

Current maintainers:

+

osi-scampbell sbejaoui

+

This module is part of the OCA/brand project on GitHub.

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

diff --git a/sale_brand/tests/test_sale_order.py b/sale_brand/tests/test_sale_order.py index 9d0bb21ab..ed4005a01 100644 --- a/sale_brand/tests/test_sale_order.py +++ b/sale_brand/tests/test_sale_order.py @@ -15,15 +15,14 @@ def setUp(self): def test_create_invoice(self): """It should create branded invoice""" self.assertEqual(self.sale.invoice_status, "to invoice") - invoice_ids = self.sale.action_invoice_create() - invoice = self.env["account.invoice"].browse(invoice_ids[0]) + invoice = self.sale._create_invoices() self.assertEqual(invoice.brand_id, self.sale.brand_id) def test_create_down_payment_invoice(self): """It should create branded down-payment invoice""" advance_payment_wizard = self.env["sale.advance.payment.inv"].create( - {"advance_payment_method": "fixed", "amount": 10.0} + {"advance_payment_method": "fixed", "fixed_amount": 10.0} ) advance_payment_wizard.with_context(active_ids=self.sale.ids).create_invoices() - invoice = self.sale.order_line.mapped("invoice_lines").mapped("invoice_id") + invoice = self.sale.order_line.mapped("invoice_lines").mapped("move_id") self.assertEqual(invoice.brand_id, self.sale.brand_id) diff --git a/sale_brand/wizard/sale_make_invoice_advance.py b/sale_brand/wizard/sale_make_invoice_advance.py index 9a0cae4e5..428fe4d70 100644 --- a/sale_brand/wizard/sale_make_invoice_advance.py +++ b/sale_brand/wizard/sale_make_invoice_advance.py @@ -1,13 +1,12 @@ # Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import api, models +from odoo import models class SaleAdvancePaymentInv(models.TransientModel): _inherit = "sale.advance.payment.inv" - @api.multi def _create_invoice(self, order, so_line, amount): invoice = super()._create_invoice(order, so_line, amount) invoice.brand_id = order.brand_id From 8722b86fb49f050cc8bc75264d0ec769b3336e61 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 30 Dec 2019 15:04:50 +0100 Subject: [PATCH 11/40] [IMP] - set the sale order analytic account at brand change --- sale_brand/__manifest__.py | 2 +- sale_brand/models/sale_order.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index c640fcde2..72daf829a 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -9,7 +9,7 @@ "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", "license": "AGPL-3", - "depends": ["sale", "brand", "account_brand"], + "depends": ["sale", "brand", "account_brand", "analytic_brand"], "data": ["views/sale_views.xml"], "installable": True, "development_status": "Beta", diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py index 6cbba7754..b2055df8a 100644 --- a/sale_brand/models/sale_order.py +++ b/sale_brand/models/sale_order.py @@ -1,7 +1,7 @@ # Copyright (C) 2019 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import api, fields, models class SaleOrder(models.Model): @@ -23,3 +23,11 @@ def _prepare_invoice(self): invoice_vals = super(SaleOrder, order)._prepare_invoice() invoice_vals.update({"brand_id": order.brand_id.id}) return invoice_vals + + @api.onchange("brand_id") + def _onchange_brand_id(self): + res = super()._onchange_brand_id() + for order in self: + if order.state == "draft" and order.brand_id: + order.analytic_account_id = order.brand_id.analytic_account_id + return res From 698825ff7986d209c431043cefe0384fb4503a2a Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 30 Dec 2019 15:07:57 +0100 Subject: [PATCH 12/40] [FIX] - brand field in sale order form view is editable only at draft state --- sale_brand/views/sale_views.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sale_brand/views/sale_views.xml b/sale_brand/views/sale_views.xml index 7a4ad69f7..b6f3934e0 100644 --- a/sale_brand/views/sale_views.xml +++ b/sale_brand/views/sale_views.xml @@ -7,7 +7,10 @@ - + From ba51efa6db94fac8490acf4711058897af9dea5d Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 30 Dec 2019 16:19:07 +0100 Subject: [PATCH 13/40] [IMP] - Add unit tests --- sale_brand/__manifest__.py | 2 +- sale_brand/i18n/hr.po | 1 - sale_brand/i18n/nl.po | 37 +++++++++++++++++++++++++++++ sale_brand/i18n/zh_CN.po | 1 - sale_brand/tests/test_sale_order.py | 11 +++++++++ 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 sale_brand/i18n/nl.po diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 72daf829a..750891bdd 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "13.0.0.0.0", + "version": "13.0.0.0.1", "category": "Sales Management", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/sale_brand/i18n/hr.po b/sale_brand/i18n/hr.po index 7283befe8..ece66a3e8 100644 --- a/sale_brand/i18n/hr.po +++ b/sale_brand/i18n/hr.po @@ -35,6 +35,5 @@ msgstr "" #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_order #, fuzzy -#| msgid "Sale Order" msgid "Sales Order" msgstr "Ponuda" diff --git a/sale_brand/i18n/nl.po b/sale_brand/i18n/nl.po new file mode 100644 index 000000000..6ff7cfbb4 --- /dev/null +++ b/sale_brand/i18n/nl.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-12-13 23:19+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: none\n" +"Language: nl\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 4.3.2\n" + +#. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id +msgid "Brand" +msgstr "Merk" + +#. module: sale_brand +#: model:ir.model.fields,help:sale_brand.field_sale_order__brand_id +msgid "Brand to use for this sale" +msgstr "Merk te gebruiken voor deze verkoop" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_advance_payment_inv +msgid "Sales Advance Payment Invoice" +msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_sale_order +msgid "Sales Order" +msgstr "" diff --git a/sale_brand/i18n/zh_CN.po b/sale_brand/i18n/zh_CN.po index b30ee34a9..cf2e5935b 100644 --- a/sale_brand/i18n/zh_CN.po +++ b/sale_brand/i18n/zh_CN.po @@ -34,6 +34,5 @@ msgstr "" #. module: sale_brand #: model:ir.model,name:sale_brand.model_sale_order #, fuzzy -#| msgid "Sale Order" msgid "Sales Order" msgstr "销售订单" diff --git a/sale_brand/tests/test_sale_order.py b/sale_brand/tests/test_sale_order.py index ed4005a01..596a658c0 100644 --- a/sale_brand/tests/test_sale_order.py +++ b/sale_brand/tests/test_sale_order.py @@ -26,3 +26,14 @@ def test_create_down_payment_invoice(self): advance_payment_wizard.with_context(active_ids=self.sale.ids).create_invoices() invoice = self.sale.order_line.mapped("invoice_lines").mapped("move_id") self.assertEqual(invoice.brand_id, self.sale.brand_id) + + def test_sale_analytic_account_onchange_brand(self): + draft_sale = self.sale.copy() + draft_sale.brand_id.analytic_account_id = self.env[ + "account.analytic.account" + ].create({"name": "analytic account"}) + self.assertFalse(draft_sale.analytic_account_id) + draft_sale._onchange_brand_id() + self.assertEqual( + draft_sale.analytic_account_id, draft_sale.brand_id.analytic_account_id, + ) From 66e8b6a03707a150ba9409aa7e4a4eb281ff1420 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Fri, 7 Feb 2020 12:56:27 +0000 Subject: [PATCH 14/40] [IMP] sale_brand: assign default brand to Sales Teams --- sale_brand/__manifest__.py | 4 ++-- sale_brand/i18n/hr.po | 6 ++++++ sale_brand/i18n/nl.po | 6 ++++++ sale_brand/i18n/sale_brand.pot | 6 ++++++ sale_brand/i18n/zh_CN.po | 6 ++++++ sale_brand/models/__init__.py | 1 + sale_brand/models/crm_team.py | 10 ++++++++++ sale_brand/models/sale_order.py | 4 ++++ sale_brand/views/crm_team_views.xml | 14 ++++++++++++++ 9 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 sale_brand/models/crm_team.py create mode 100644 sale_brand/views/crm_team_views.xml diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 750891bdd..80079d04b 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,13 +4,13 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "13.0.0.0.1", + "version": "13.0.0.0.2", "category": "Sales Management", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", "license": "AGPL-3", "depends": ["sale", "brand", "account_brand", "analytic_brand"], - "data": ["views/sale_views.xml"], + "data": ["views/sale_views.xml", "views/crm_team_views.xml"], "installable": True, "development_status": "Beta", "maintainers": ["osi-scampbell", "sbejaoui"], diff --git a/sale_brand/i18n/hr.po b/sale_brand/i18n/hr.po index ece66a3e8..ea2dc930a 100644 --- a/sale_brand/i18n/hr.po +++ b/sale_brand/i18n/hr.po @@ -18,6 +18,7 @@ msgstr "" "X-Generator: Weblate 3.8\n" #. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" msgstr "Brand" @@ -37,3 +38,8 @@ msgstr "" #, fuzzy msgid "Sales Order" msgstr "Ponuda" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_crm_team +msgid "Sales Team" +msgstr "" diff --git a/sale_brand/i18n/nl.po b/sale_brand/i18n/nl.po index 6ff7cfbb4..b04fbfc8d 100644 --- a/sale_brand/i18n/nl.po +++ b/sale_brand/i18n/nl.po @@ -17,6 +17,7 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" msgstr "Merk" @@ -35,3 +36,8 @@ msgstr "" #: model:ir.model,name:sale_brand.model_sale_order msgid "Sales Order" msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_crm_team +msgid "Sales Team" +msgstr "" diff --git a/sale_brand/i18n/sale_brand.pot b/sale_brand/i18n/sale_brand.pot index 68e5eabc9..3be21fae1 100644 --- a/sale_brand/i18n/sale_brand.pot +++ b/sale_brand/i18n/sale_brand.pot @@ -14,6 +14,7 @@ msgstr "" "Plural-Forms: \n" #. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" msgstr "" @@ -32,3 +33,8 @@ msgstr "" #: model:ir.model,name:sale_brand.model_sale_order msgid "Sales Order" msgstr "" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_crm_team +msgid "Sales Team" +msgstr "" diff --git a/sale_brand/i18n/zh_CN.po b/sale_brand/i18n/zh_CN.po index cf2e5935b..78113808d 100644 --- a/sale_brand/i18n/zh_CN.po +++ b/sale_brand/i18n/zh_CN.po @@ -17,6 +17,7 @@ msgstr "" "X-Generator: Weblate 3.8\n" #. module: sale_brand +#: model:ir.model.fields,field_description:sale_brand.field_crm_team__brand_id #: model:ir.model.fields,field_description:sale_brand.field_sale_order__brand_id msgid "Brand" msgstr "品牌" @@ -36,3 +37,8 @@ msgstr "" #, fuzzy msgid "Sales Order" msgstr "销售订单" + +#. module: sale_brand +#: model:ir.model,name:sale_brand.model_crm_team +msgid "Sales Team" +msgstr "" diff --git a/sale_brand/models/__init__.py b/sale_brand/models/__init__.py index 6aacb7531..326207d35 100644 --- a/sale_brand/models/__init__.py +++ b/sale_brand/models/__init__.py @@ -1 +1,2 @@ from . import sale_order +from . import crm_team diff --git a/sale_brand/models/crm_team.py b/sale_brand/models/crm_team.py new file mode 100644 index 000000000..cda26f59f --- /dev/null +++ b/sale_brand/models/crm_team.py @@ -0,0 +1,10 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class CrmTeam(models.Model): + _inherit = "crm.team" + + brand_id = fields.Many2one(comodel_name="res.brand", string="Brand") diff --git a/sale_brand/models/sale_order.py b/sale_brand/models/sale_order.py index b2055df8a..6d836b10d 100644 --- a/sale_brand/models/sale_order.py +++ b/sale_brand/models/sale_order.py @@ -31,3 +31,7 @@ def _onchange_brand_id(self): if order.state == "draft" and order.brand_id: order.analytic_account_id = order.brand_id.analytic_account_id return res + + @api.onchange("team_id") + def _onchange_team_id(self): + self.brand_id = self.team_id.brand_id diff --git a/sale_brand/views/crm_team_views.xml b/sale_brand/views/crm_team_views.xml new file mode 100644 index 000000000..01f0080be --- /dev/null +++ b/sale_brand/views/crm_team_views.xml @@ -0,0 +1,14 @@ + + + + + crm.team + + + + + + + + From 091178b66f27e88196b9734444aadae13bb28e01 Mon Sep 17 00:00:00 2001 From: Freni-OSI Date: Wed, 9 Jun 2021 12:31:35 +0530 Subject: [PATCH 15/40] [14.0][MIG] sale_brand --- sale_brand/README.rst | 11 ++++++----- sale_brand/__manifest__.py | 2 +- sale_brand/readme/CONTRIBUTORS.rst | 1 + sale_brand/static/description/index.html | 9 +++++---- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sale_brand/README.rst b/sale_brand/README.rst index 1b8643cf4..73c30be05 100644 --- a/sale_brand/README.rst +++ b/sale_brand/README.rst @@ -14,13 +14,13 @@ Sale Brand :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github - :target: https://github.com/OCA/brand/tree/13.0/sale_brand + :target: https://github.com/OCA/brand/tree/14.0/sale_brand :alt: OCA/brand .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/brand-13-0/brand-13-0-sale_brand + :target: https://translation.odoo-community.org/projects/brand-14-0/brand-14-0-sale_brand :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/284/13.0 + :target: https://runbot.odoo-community.org/runbot/284/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -53,7 +53,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. @@ -71,6 +71,7 @@ Contributors * Raphael Lee * Steve Campbell * Maxime Chambreuil +* Freni Patel * `Obertix `_: @@ -105,6 +106,6 @@ Current `maintainers `__: |maintainer-osi-scampbell| |maintainer-sbejaoui| -This module is part of the `OCA/brand `_ project on GitHub. +This module is part of the `OCA/brand `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_brand/__manifest__.py b/sale_brand/__manifest__.py index 80079d04b..e82cee5a0 100644 --- a/sale_brand/__manifest__.py +++ b/sale_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Brand", "summary": "Send branded sales orders", - "version": "13.0.0.0.2", + "version": "14.0.1.0.0", "category": "Sales Management", "website": "https://github.com/OCA/sale-workflow", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/sale_brand/readme/CONTRIBUTORS.rst b/sale_brand/readme/CONTRIBUTORS.rst index be2101c94..30dc5dbc7 100644 --- a/sale_brand/readme/CONTRIBUTORS.rst +++ b/sale_brand/readme/CONTRIBUTORS.rst @@ -1,6 +1,7 @@ * Raphael Lee * Steve Campbell * Maxime Chambreuil +* Freni Patel * `Obertix `_: diff --git a/sale_brand/static/description/index.html b/sale_brand/static/description/index.html index 7a2730b28..9e6828d5b 100644 --- a/sale_brand/static/description/index.html +++ b/sale_brand/static/description/index.html @@ -3,7 +3,7 @@ - + Sale Brand -
-

Sale Brand

+
+ + +Odoo Community Association + +
+

Sale Brand

-

Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runboat

This module allows you to send branded quotations and sales orders to your customers. It adds a brand field on the quotation and propagate the value on the invoices.

@@ -388,7 +393,7 @@

Sale Brand

-

Usage

+

Usage

To use this module, you need to:

  1. Go to Sales > Quotations
  2. @@ -399,23 +404,23 @@

    Usage

-

Bug Tracker

+

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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Open Source Integrators
-

Contributors

+

Contributors

+
  • Heliconia Solutions Pvt. Ltd.
      +
    • Bhavesh Heliconia
    • +
    +
  • -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association @@ -444,10 +453,11 @@

    Maintainers

    promote its widespread use.

    Current maintainers:

    osi-scampbell sbejaoui

    -

    This module is part of the OCA/brand project on GitHub.

    +

    This module is part of the OCA/brand project on GitHub.

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

    +
    diff --git a/sale_brand/tests/test_sale_order.py b/sale_brand/tests/test_sale_order.py index ebe4c778b..57c0d8b91 100644 --- a/sale_brand/tests/test_sale_order.py +++ b/sale_brand/tests/test_sale_order.py @@ -1,16 +1,78 @@ # Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import Command from odoo.tests.common import TransactionCase class TestSaleOrder(TransactionCase): def setUp(self): super().setUp() - self.sale = self.env.ref("sale.sale_order_1") + self.account_receivable = self.env["account.account"].create( + { + "name": "Receivable", + "code": "TEST.400000", + "account_type": "asset_receivable", + "reconcile": True, + "company_ids": [self.env.company.id], + } + ) + self.account_payable = self.env["account.account"].create( + { + "name": "Payable", + "code": "TEST.440000", + "account_type": "liability_payable", + "reconcile": True, + "company_ids": [self.env.company.id], + } + ) + self.account_income = self.env["account.account"].create( + { + "name": "Income", + "code": "TEST.700000", + "account_type": "income", + "company_ids": [self.env.company.id], + } + ) + self.partner = self.env["res.partner"].create( + { + "name": "Test Partner", + "property_account_receivable_id": self.account_receivable.id, + "property_account_payable_id": self.account_payable.id, + } + ) + self.product = self.env["product.product"].create( + { + "name": "Test Product", + "invoice_policy": "order", + "property_account_income_id": self.account_income.id, + } + ) + self.brand = self.env["res.brand"].create({"name": "brand"}) + self.sale = self.env["sale.order"].create( + { + "partner_id": self.partner.id, + "brand_id": self.brand.id, + "order_line": [ + Command.create( + { + "product_id": self.product.id, + "product_uom_qty": 1.0, + "price_unit": 100.0, + } + ) + ], + } + ) + self.journal = self.env["account.journal"].create( + { + "name": "Sale Journal", + "code": "SALE", + "type": "sale", + "company_id": self.env.company.id, + } + ) self.sale.company_id.brand_use_level = "required" - self.sale.brand_id = self.env["res.brand"].create({"name": "brand"}) - self.sale.order_line.mapped("product_id").write({"invoice_policy": "order"}) self.sale.action_confirm() def test_create_invoice(self): @@ -37,7 +99,7 @@ def test_brand_onchange_team(self): brand = sale.brand_id brand2 = self.env["res.brand"].create({"name": "brand"}) - team = self.env.ref("sales_team.team_sales_department") + team = self.env["crm.team"].create({"name": "Test Team"}) team.brand_id = brand2.id sale.team_id = team.id From db228f0f5c3df30a8db887d4e9eef9768e61b98a Mon Sep 17 00:00:00 2001 From: Bhavesh Heliconia Date: Mon, 18 May 2026 17:27:58 +0530 Subject: [PATCH 40/40] [DON'T MERGE] test-requirements.txt --- test-requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test-requirements.txt diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..2616819c2 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo-addon-account_brand @ git+https://github.com/OCA/brand.git@refs/pull/303/head#subdirectory=account_brand