From 2351d430864c5752c4511e31137067a6a1704297 Mon Sep 17 00:00:00 2001
From: oca-travis <oca+oca-travis@odoo-community.org>
Date: Wed, 14 Oct 2020 16:30:31 +0000
Subject: [PATCH 01/26] [UPD] Update account_invoice_margin_sale.pot

---
 account_invoice_margin_sale/README.rst        |  92 ++++
 account_invoice_margin_sale/__init__.py       |   3 +
 account_invoice_margin_sale/__manifest__.py   |  19 +
 .../i18n/account_invoice_margin_sale.pot      |  19 +
 .../models/__init__.py                        |   3 +
 account_invoice_margin_sale/models/sale.py    |  14 +
 .../readme/CONTRIBUTORS.rst                   |   4 +
 .../readme/DESCRIPTION.rst                    |   1 +
 .../readme/INSTALL.rst                        |   1 +
 .../static/description/icon.png               | Bin 0 -> 9455 bytes
 .../static/description/index.html             | 430 ++++++++++++++++++
 account_invoice_margin_sale/tests/__init__.py |   3 +
 .../tests/test_account_invoice_margin_sale.py |  77 ++++
 13 files changed, 666 insertions(+)
 create mode 100644 account_invoice_margin_sale/README.rst
 create mode 100644 account_invoice_margin_sale/__init__.py
 create mode 100644 account_invoice_margin_sale/__manifest__.py
 create mode 100644 account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
 create mode 100644 account_invoice_margin_sale/models/__init__.py
 create mode 100644 account_invoice_margin_sale/models/sale.py
 create mode 100644 account_invoice_margin_sale/readme/CONTRIBUTORS.rst
 create mode 100644 account_invoice_margin_sale/readme/DESCRIPTION.rst
 create mode 100644 account_invoice_margin_sale/readme/INSTALL.rst
 create mode 100644 account_invoice_margin_sale/static/description/icon.png
 create mode 100644 account_invoice_margin_sale/static/description/index.html
 create mode 100644 account_invoice_margin_sale/tests/__init__.py
 create mode 100644 account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
new file mode 100644
index 000000000..dcba648d3
--- /dev/null
+++ b/account_invoice_margin_sale/README.rst
@@ -0,0 +1,92 @@
+===========================
+Account Invoice Margin Sale
+===========================
+
+.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   !! This file is generated by oca-gen-addon-readme !!
+   !! changes will be overwritten.                   !!
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
+    :target: https://odoo-community.org/page/development-status
+    :alt: Production/Stable
+.. |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%2Fmargin--analysis-lightgray.png?logo=github
+    :target: https://github.com/OCA/margin-analysis/tree/13.0/account_invoice_margin_sale
+    :alt: OCA/margin-analysis
+.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
+    :target: https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin_sale
+    :alt: Translate me on Weblate
+.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
+    :target: https://runbot.odoo-community.org/runbot/132/13.0
+    :alt: Try me on Runbot
+
+|badge1| |badge2| |badge3| |badge4| |badge5| 
+
+This module allows transfer purchase price from sale order line to invoice.
+
+**Table of contents**
+
+.. contents::
+   :local:
+
+Installation
+============
+
+This module is autoinstalable.
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub Issues <https://github.com/OCA/margin-analysis/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 <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
+
+Do not contact contributors directly about support or help with technical issues.
+
+Credits
+=======
+
+Authors
+~~~~~~~
+
+* Tecnativa
+
+Contributors
+~~~~~~~~~~~~
+
+* `Tecnativa <https://www.tecnativa.com>`__:
+
+  * Sergio Teruel
+  * Carlos Dauden
+
+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-sergio-teruel| image:: https://github.com/sergio-teruel.png?size=40px
+    :target: https://github.com/sergio-teruel
+    :alt: sergio-teruel
+.. |maintainer-carlosdauden| image:: https://github.com/carlosdauden.png?size=40px
+    :target: https://github.com/carlosdauden
+    :alt: carlosdauden
+
+Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
+
+|maintainer-sergio-teruel| |maintainer-carlosdauden| 
+
+This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/13.0/account_invoice_margin_sale>`_ project on GitHub.
+
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_invoice_margin_sale/__init__.py b/account_invoice_margin_sale/__init__.py
new file mode 100644
index 000000000..7d768b54b
--- /dev/null
+++ b/account_invoice_margin_sale/__init__.py
@@ -0,0 +1,3 @@
+# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
+
+from . import models
diff --git a/account_invoice_margin_sale/__manifest__.py b/account_invoice_margin_sale/__manifest__.py
new file mode 100644
index 000000000..aaa435430
--- /dev/null
+++ b/account_invoice_margin_sale/__manifest__.py
@@ -0,0 +1,19 @@
+# Copyright 2017-2018 Tecnativa - Sergio Teruel
+# Copyright 2019 Tecnativa - Carlos Dauden
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
+
+{
+    "name": "Account Invoice Margin Sale",
+    "summary": "Set margin in invoices from sale orders",
+    "version": "13.0.1.0.0",
+    "development_status": "Production/Stable",
+    "maintainers": ["sergio-teruel", "carlosdauden"],
+    "category": "Account",
+    "website": "https://github.com/OCA/margin-analysis",
+    "author": "Tecnativa, " "Odoo Community Association (OCA)",
+    "license": "AGPL-3",
+    "application": False,
+    "installable": True,
+    "auto_install": True,
+    "depends": ["sale_margin", "account_invoice_margin"],
+}
diff --git a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
new file mode 100644
index 000000000..63fe7daa5
--- /dev/null
+++ b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
@@ -0,0 +1,19 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* account_invoice_margin_sale
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.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: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
+msgid "Sales Order Line"
+msgstr ""
diff --git a/account_invoice_margin_sale/models/__init__.py b/account_invoice_margin_sale/models/__init__.py
new file mode 100644
index 000000000..a6061a236
--- /dev/null
+++ b/account_invoice_margin_sale/models/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import sale
diff --git a/account_invoice_margin_sale/models/sale.py b/account_invoice_margin_sale/models/sale.py
new file mode 100644
index 000000000..e728eb6c7
--- /dev/null
+++ b/account_invoice_margin_sale/models/sale.py
@@ -0,0 +1,14 @@
+# Copyright 2017-2018 Tecnativa - Sergio Teruel
+# Copyright 2019 Tecnativa - Carlos Dauden
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import models
+
+
+class SaleOrderLine(models.Model):
+    _inherit = "sale.order.line"
+
+    def _prepare_invoice_line(self):
+        vals = super()._prepare_invoice_line()
+        vals["purchase_price"] = self.purchase_price
+        return vals
diff --git a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
new file mode 100644
index 000000000..508f0287d
--- /dev/null
+++ b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
@@ -0,0 +1,4 @@
+* `Tecnativa <https://www.tecnativa.com>`__:
+
+  * Sergio Teruel
+  * Carlos Dauden
diff --git a/account_invoice_margin_sale/readme/DESCRIPTION.rst b/account_invoice_margin_sale/readme/DESCRIPTION.rst
new file mode 100644
index 000000000..6fb927348
--- /dev/null
+++ b/account_invoice_margin_sale/readme/DESCRIPTION.rst
@@ -0,0 +1 @@
+This module allows transfer purchase price from sale order line to invoice.
diff --git a/account_invoice_margin_sale/readme/INSTALL.rst b/account_invoice_margin_sale/readme/INSTALL.rst
new file mode 100644
index 000000000..0cde2de70
--- /dev/null
+++ b/account_invoice_margin_sale/readme/INSTALL.rst
@@ -0,0 +1 @@
+This module is autoinstalable.
diff --git a/account_invoice_margin_sale/static/description/icon.png b/account_invoice_margin_sale/static/description/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d
GIT binary patch
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
new file mode 100644
index 000000000..a6fc1d4eb
--- /dev/null
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -0,0 +1,430 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
+<title>Account Invoice Margin Sale</title>
+<style type="text/css">
+
+/*
+:Author: David Goodger (goodger@python.org)
+:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+
+See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+  border: 0 }
+
+table.borderless td, table.borderless th {
+  /* Override padding for "table.docutils td" with "! important".
+     The right padding separates the table cells. */
+  padding: 0 0.5em 0 0 ! important }
+
+.first {
+  /* Override more specific margin styles with "! important". */
+  margin-top: 0 ! important }
+
+.last, .with-subtitle {
+  margin-bottom: 0 ! important }
+
+.hidden {
+  display: none }
+
+.subscript {
+  vertical-align: sub;
+  font-size: smaller }
+
+.superscript {
+  vertical-align: super;
+  font-size: smaller }
+
+a.toc-backref {
+  text-decoration: none ;
+  color: black }
+
+blockquote.epigraph {
+  margin: 2em 5em ; }
+
+dl.docutils dd {
+  margin-bottom: 0.5em }
+
+object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
+  overflow: hidden;
+}
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+  font-weight: bold }
+*/
+
+div.abstract {
+  margin: 2em 5em }
+
+div.abstract p.topic-title {
+  font-weight: bold ;
+  text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+  margin: 2em ;
+  border: medium outset ;
+  padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+  font-weight: bold ;
+  font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title, .code .error {
+  color: red ;
+  font-weight: bold ;
+  font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+   compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+  margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+  margin-top: 0.5em }
+*/
+
+div.dedication {
+  margin: 2em 5em ;
+  text-align: center ;
+  font-style: italic }
+
+div.dedication p.topic-title {
+  font-weight: bold ;
+  font-style: normal }
+
+div.figure {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+div.footer, div.header {
+  clear: both;
+  font-size: smaller }
+
+div.line-block {
+  display: block ;
+  margin-top: 1em ;
+  margin-bottom: 1em }
+
+div.line-block div.line-block {
+  margin-top: 0 ;
+  margin-bottom: 0 ;
+  margin-left: 1.5em }
+
+div.sidebar {
+  margin: 0 0 0.5em 1em ;
+  border: medium outset ;
+  padding: 1em ;
+  background-color: #ffffee ;
+  width: 40% ;
+  float: right ;
+  clear: right }
+
+div.sidebar p.rubric {
+  font-family: sans-serif ;
+  font-size: medium }
+
+div.system-messages {
+  margin: 5em }
+
+div.system-messages h1 {
+  color: red }
+
+div.system-message {
+  border: medium outset ;
+  padding: 1em }
+
+div.system-message p.system-message-title {
+  color: red ;
+  font-weight: bold }
+
+div.topic {
+  margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+  margin-top: 0.4em }
+
+h1.title {
+  text-align: center }
+
+h2.subtitle {
+  text-align: center }
+
+hr.docutils {
+  width: 75% }
+
+img.align-left, .figure.align-left, object.align-left, table.align-left {
+  clear: left ;
+  float: left ;
+  margin-right: 1em }
+
+img.align-right, .figure.align-right, object.align-right, table.align-right {
+  clear: right ;
+  float: right ;
+  margin-left: 1em }
+
+img.align-center, .figure.align-center, object.align-center {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+table.align-center {
+  margin-left: auto;
+  margin-right: auto;
+}
+
+.align-left {
+  text-align: left }
+
+.align-center {
+  clear: both ;
+  text-align: center }
+
+.align-right {
+  text-align: right }
+
+/* reset inner alignment in figures */
+div.align-right {
+  text-align: inherit }
+
+/* div.align-center * { */
+/*   text-align: left } */
+
+.align-top    {
+  vertical-align: top }
+
+.align-middle {
+  vertical-align: middle }
+
+.align-bottom {
+  vertical-align: bottom }
+
+ol.simple, ul.simple {
+  margin-bottom: 1em }
+
+ol.arabic {
+  list-style: decimal }
+
+ol.loweralpha {
+  list-style: lower-alpha }
+
+ol.upperalpha {
+  list-style: upper-alpha }
+
+ol.lowerroman {
+  list-style: lower-roman }
+
+ol.upperroman {
+  list-style: upper-roman }
+
+p.attribution {
+  text-align: right ;
+  margin-left: 50% }
+
+p.caption {
+  font-style: italic }
+
+p.credits {
+  font-style: italic ;
+  font-size: smaller }
+
+p.label {
+  white-space: nowrap }
+
+p.rubric {
+  font-weight: bold ;
+  font-size: larger ;
+  color: maroon ;
+  text-align: center }
+
+p.sidebar-title {
+  font-family: sans-serif ;
+  font-weight: bold ;
+  font-size: larger }
+
+p.sidebar-subtitle {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+p.topic-title {
+  font-weight: bold }
+
+pre.address {
+  margin-bottom: 0 ;
+  margin-top: 0 ;
+  font: inherit }
+
+pre.literal-block, pre.doctest-block, pre.math, pre.code {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+pre.code .ln { color: grey; } /* line numbers */
+pre.code, code { background-color: #eeeeee }
+pre.code .comment, code .comment { color: #5C6576 }
+pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
+pre.code .literal.string, code .literal.string { color: #0C5404 }
+pre.code .name.builtin, code .name.builtin { color: #352B84 }
+pre.code .deleted, code .deleted { background-color: #DEB0A1}
+pre.code .inserted, code .inserted { background-color: #A3D289}
+
+span.classifier {
+  font-family: sans-serif ;
+  font-style: oblique }
+
+span.classifier-delimiter {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+span.interpreted {
+  font-family: sans-serif }
+
+span.option {
+  white-space: nowrap }
+
+span.pre {
+  white-space: pre }
+
+span.problematic {
+  color: red }
+
+span.section-subtitle {
+  /* font-size relative to parent (h1..h6 element) */
+  font-size: 80% }
+
+table.citation {
+  border-left: solid 1px gray;
+  margin-left: 1px }
+
+table.docinfo {
+  margin: 2em 4em }
+
+table.docutils {
+  margin-top: 0.5em ;
+  margin-bottom: 0.5em }
+
+table.footnote {
+  border-left: solid 1px black;
+  margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+  padding-left: 0.5em ;
+  padding-right: 0.5em ;
+  vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+  font-weight: bold ;
+  text-align: left ;
+  white-space: nowrap ;
+  padding-left: 0 }
+
+/* "booktabs" style (no vertical lines) */
+table.docutils.booktabs {
+  border: 0px;
+  border-top: 2px solid;
+  border-bottom: 2px solid;
+  border-collapse: collapse;
+}
+table.docutils.booktabs * {
+  border: 0px;
+}
+table.docutils.booktabs th {
+  border-bottom: thin solid;
+  text-align: left;
+}
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+  font-size: 100% }
+
+ul.auto-toc {
+  list-style-type: none }
+
+</style>
+</head>
+<body>
+<div class="document" id="account-invoice-margin-sale">
+<h1 class="title">Account Invoice Margin Sale</h1>
+
+<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! This file is generated by oca-gen-addon-readme !!
+!! changes will be overwritten.                   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
+<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/13.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/132/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
+<p>This module allows transfer purchase price from sale order line to invoice.</p>
+<p><strong>Table of contents</strong></p>
+<div class="contents local topic" id="contents">
+<ul class="simple">
+<li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
+<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
+<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
+<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
+<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
+<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
+</ul>
+</li>
+</ul>
+</div>
+<div class="section" id="installation">
+<h1><a class="toc-backref" href="#id1">Installation</a></h1>
+<p>This module is autoinstalable.</p>
+</div>
+<div class="section" id="bug-tracker">
+<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
+<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/margin-analysis/issues">GitHub Issues</a>.
+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
+<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
+<p>Do not contact contributors directly about support or help with technical issues.</p>
+</div>
+<div class="section" id="credits">
+<h1><a class="toc-backref" href="#id3">Credits</a></h1>
+<div class="section" id="authors">
+<h2><a class="toc-backref" href="#id4">Authors</a></h2>
+<ul class="simple">
+<li>Tecnativa</li>
+</ul>
+</div>
+<div class="section" id="contributors">
+<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
+<ul class="simple">
+<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
+<li>Sergio Teruel</li>
+<li>Carlos Dauden</li>
+</ul>
+</li>
+</ul>
+</div>
+<div class="section" id="maintainers">
+<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
+<p>This module is maintained by the OCA.</p>
+<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
+<p>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.</p>
+<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
+<p><a class="reference external" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a> <a class="reference external" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a></p>
+<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/13.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
+<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
+</div>
+</div>
+</div>
+</body>
+</html>
diff --git a/account_invoice_margin_sale/tests/__init__.py b/account_invoice_margin_sale/tests/__init__.py
new file mode 100644
index 000000000..4423d9c36
--- /dev/null
+++ b/account_invoice_margin_sale/tests/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import test_account_invoice_margin_sale
diff --git a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
new file mode 100644
index 000000000..ab83ab5de
--- /dev/null
+++ b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
@@ -0,0 +1,77 @@
+# Copyright 2017-2018 Tecnativa - Sergio Teruel
+# Copyright 2019 Tecnativa - Carlos Dauden
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo.tests.common import SavepointCase
+
+
+class TestAccountInvoiceMargin(SavepointCase):
+    @classmethod
+    def setUpClass(cls):
+        super(TestAccountInvoiceMargin, cls).setUpClass()
+        cls.journal = cls.env["account.journal"].create(
+            {"name": "Test journal", "type": "sale", "code": "TEST_J"}
+        )
+        cls.account_type = cls.env["account.account.type"].create(
+            {
+                "name": "Test account type",
+                "type": "receivable",
+                "internal_group": "income",
+            }
+        )
+        cls.account = cls.env["account.account"].create(
+            {
+                "name": "Test account",
+                "code": "TEST_A",
+                "user_type_id": cls.account_type.id,
+                "reconcile": True,
+            }
+        )
+        cls.partner = cls.env["res.partner"].create(
+            {"name": "Test partner", "customer_rank": 1, "is_company": True}
+        )
+        cls.partner.property_account_receivable_id = cls.account
+        cls.product_categ = cls.env["product.category"].create(
+            {"name": "Test category"}
+        )
+
+        cls.product = cls.env["product.product"].create(
+            {
+                "name": "test product",
+                "categ_id": cls.product_categ.id,
+                "uom_id": cls.env.ref("uom.product_uom_unit").id,
+                "uom_po_id": cls.env.ref("uom.product_uom_unit").id,
+                "default_code": "test-margin",
+                "invoice_policy": "order",
+                "list_price": 200.00,
+                "standard_price": 100.00,
+            }
+        )
+        cls.product.property_account_receivable_id = cls.account
+        pricelist = cls.env["product.pricelist"].create({"name": "Public Pricelist"})
+
+        cls.sale_order = cls.env["sale.order"].create(
+            {
+                "partner_id": cls.partner.id,
+                "pricelist_id": pricelist.id,
+                "order_line": [
+                    (
+                        0,
+                        0,
+                        {
+                            "name": cls.product.name,
+                            "product_id": cls.product.id,
+                            "product_uom_qty": 1,
+                            "product_uom": cls.product.uom_id.id,
+                            "price_unit": 100.0,
+                        },
+                    )
+                ],
+            }
+        )
+
+    def test_invoice_sale_order(self):
+        self.sale_order.action_confirm()
+        self.sale_order.order_line.purchase_price = 500.00
+        invoice = self.sale_order._create_invoices()
+        self.assertAlmostEqual(invoice.invoice_line_ids.purchase_price, 500.00, 2)

From 40dae1fbe90663296b149250f3a3b8d0319fef78 Mon Sep 17 00:00:00 2001
From: Harald Panten <harald.panten@sygel.es>
Date: Wed, 16 Dec 2020 19:31:02 +0000
Subject: [PATCH 02/26] Added translation using Weblate (Spanish)

---
 account_invoice_margin_sale/i18n/es.po | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 account_invoice_margin_sale/i18n/es.po

diff --git a/account_invoice_margin_sale/i18n/es.po b/account_invoice_margin_sale/i18n/es.po
new file mode 100644
index 000000000..9e949e78d
--- /dev/null
+++ b/account_invoice_margin_sale/i18n/es.po
@@ -0,0 +1,20 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* account_invoice_margin_sale
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 13.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\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"
+
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
+msgid "Sales Order Line"
+msgstr ""

From f0565289ad8fa38c0baff1735c1f43f8709b2278 Mon Sep 17 00:00:00 2001
From: Harald Panten <harald.panten@sygel.es>
Date: Wed, 16 Dec 2020 19:31:27 +0000
Subject: [PATCH 03/26] Translated using Weblate (Spanish)

Currently translated at 100.0% (1 of 1 strings)

Translation: margin-analysis-13.0/margin-analysis-13.0-account_invoice_margin_sale
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin_sale/es/
---
 account_invoice_margin_sale/i18n/es.po | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/account_invoice_margin_sale/i18n/es.po b/account_invoice_margin_sale/i18n/es.po
index 9e949e78d..fa7d4a6f1 100644
--- a/account_invoice_margin_sale/i18n/es.po
+++ b/account_invoice_margin_sale/i18n/es.po
@@ -6,15 +6,17 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Odoo Server 13.0\n"
 "Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2020-12-16 22:19+0000\n"
+"Last-Translator: Harald Panten <harald.panten@sygel.es>\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 4.3.2\n"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
 msgid "Sales Order Line"
-msgstr ""
+msgstr "Línea de pedido de venta"

From 8255fd54b49224794d532511fe799bf9f408189b Mon Sep 17 00:00:00 2001
From: Bhavesh Odedra <bodedra@opensourceintegrators.com>
Date: Mon, 1 Feb 2021 12:50:41 -0700
Subject: [PATCH 04/26] [IMP] skip margin calculation for Down Payment invoice

[UPD] Update account_invoice_margin_sale.pot

[UPD] README.rst

account_invoice_margin_sale 13.0.1.0.1

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: margin-analysis-13.0/margin-analysis-13.0-account_invoice_margin_sale
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin_sale/
---
 account_invoice_margin_sale/README.rst        |  4 +++
 account_invoice_margin_sale/__manifest__.py   |  2 +-
 .../i18n/account_invoice_margin_sale.pot      | 10 +++++++
 account_invoice_margin_sale/i18n/es.po        | 10 +++++++
 .../models/__init__.py                        |  1 +
 .../models/account_invoice.py                 | 26 +++++++++++++++++++
 .../readme/CONTRIBUTORS.rst                   |  4 +++
 .../static/description/index.html             |  4 +++
 8 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 account_invoice_margin_sale/models/account_invoice.py

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
index dcba648d3..d9b5296e3 100644
--- a/account_invoice_margin_sale/README.rst
+++ b/account_invoice_margin_sale/README.rst
@@ -63,6 +63,10 @@ Contributors
   * Sergio Teruel
   * Carlos Dauden
 
+* `Open Source Integrators <https://www.opensourceintegrators.com>`__:
+
+  * Bhavesh Odedra
+
 Maintainers
 ~~~~~~~~~~~
 
diff --git a/account_invoice_margin_sale/__manifest__.py b/account_invoice_margin_sale/__manifest__.py
index aaa435430..86176cda1 100644
--- a/account_invoice_margin_sale/__manifest__.py
+++ b/account_invoice_margin_sale/__manifest__.py
@@ -5,7 +5,7 @@
 {
     "name": "Account Invoice Margin Sale",
     "summary": "Set margin in invoices from sale orders",
-    "version": "13.0.1.0.0",
+    "version": "13.0.1.0.1",
     "development_status": "Production/Stable",
     "maintainers": ["sergio-teruel", "carlosdauden"],
     "category": "Account",
diff --git a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
index 63fe7daa5..8b6e20ee1 100644
--- a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
+++ b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
@@ -13,6 +13,16 @@ msgstr ""
 "Content-Transfer-Encoding: \n"
 "Plural-Forms: \n"
 
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_account_move
+msgid "Journal Entries"
+msgstr ""
+
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_account_move_line
+msgid "Journal Item"
+msgstr ""
+
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
 msgid "Sales Order Line"
diff --git a/account_invoice_margin_sale/i18n/es.po b/account_invoice_margin_sale/i18n/es.po
index fa7d4a6f1..a15803283 100644
--- a/account_invoice_margin_sale/i18n/es.po
+++ b/account_invoice_margin_sale/i18n/es.po
@@ -16,6 +16,16 @@ msgstr ""
 "Plural-Forms: nplurals=2; plural=n != 1;\n"
 "X-Generator: Weblate 4.3.2\n"
 
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_account_move
+msgid "Journal Entries"
+msgstr ""
+
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_account_move_line
+msgid "Journal Item"
+msgstr ""
+
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
 msgid "Sales Order Line"
diff --git a/account_invoice_margin_sale/models/__init__.py b/account_invoice_margin_sale/models/__init__.py
index a6061a236..1c5404c77 100644
--- a/account_invoice_margin_sale/models/__init__.py
+++ b/account_invoice_margin_sale/models/__init__.py
@@ -1,3 +1,4 @@
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 
 from . import sale
+from . import account_invoice
diff --git a/account_invoice_margin_sale/models/account_invoice.py b/account_invoice_margin_sale/models/account_invoice.py
new file mode 100644
index 000000000..a6637a76d
--- /dev/null
+++ b/account_invoice_margin_sale/models/account_invoice.py
@@ -0,0 +1,26 @@
+# Copyright 2021 Sergio Teruel <sergio.teruel@tecnativa.com>
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import api, models
+
+
+class AccountMove(models.Model):
+    _inherit = "account.move"
+
+    def _get_margin_applicable_lines(self):
+        lines = super()._get_margin_applicable_lines()
+        return lines.filtered(lambda x: not x.sale_line_ids.is_downpayment)
+
+
+class AccountMoveLine(models.Model):
+    _inherit = "account.move.line"
+
+    @api.depends("purchase_price", "price_subtotal")
+    def _compute_margin(self):
+        for line in self:
+            if any(line.sale_line_ids.mapped("is_downpayment")):
+                line.update(
+                    {"margin": 0.0, "margin_signed": 0.0, "margin_percent": 0.0}
+                )
+            else:
+                super(AccountMoveLine, line)._compute_margin()
diff --git a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
index 508f0287d..6690797bb 100644
--- a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
+++ b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
@@ -2,3 +2,7 @@
 
   * Sergio Teruel
   * Carlos Dauden
+
+* `Open Source Integrators <https://www.opensourceintegrators.com>`__:
+
+  * Bhavesh Odedra
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index a6fc1d4eb..1ce804606 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -410,6 +410,10 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
 <li>Carlos Dauden</li>
 </ul>
 </li>
+<li><a class="reference external" href="https://www.opensourceintegrators.com">Open Source Integrators</a>:<ul>
+<li>Bhavesh Odedra</li>
+</ul>
+</li>
 </ul>
 </div>
 <div class="section" id="maintainers">

From cb6cb939a7b31f754c6032e8b022072583c9c6b3 Mon Sep 17 00:00:00 2001
From: Reyes4711 <carlos.rg.92.47@gmail.com>
Date: Mon, 3 May 2021 13:56:53 +0200
Subject: [PATCH 05/26] [14.0][MIG] account_invoice_margin_sale: Migration to
 14.0

[UPD] Update account_invoice_margin_sale.pot

[UPD] README.rst
---
 account_invoice_margin_sale/README.rst        | 10 ++--
 account_invoice_margin_sale/__init__.py       |  2 +-
 account_invoice_margin_sale/__manifest__.py   |  2 +-
 .../i18n/account_invoice_margin_sale.pot      | 25 ++++++++-
 account_invoice_margin_sale/models/sale.py    |  4 +-
 .../static/description/index.html             |  6 +-
 .../tests/test_account_invoice_margin_sale.py | 55 ++++++++++++++++++-
 7 files changed, 89 insertions(+), 15 deletions(-)

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
index d9b5296e3..5de2c0ee8 100644
--- a/account_invoice_margin_sale/README.rst
+++ b/account_invoice_margin_sale/README.rst
@@ -14,13 +14,13 @@ Account Invoice Margin Sale
     :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
     :alt: License: AGPL-3
 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
-    :target: https://github.com/OCA/margin-analysis/tree/13.0/account_invoice_margin_sale
+    :target: https://github.com/OCA/margin-analysis/tree/14.0/account_invoice_margin_sale
     :alt: OCA/margin-analysis
 .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
-    :target: https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin_sale
+    :target: https://translation.odoo-community.org/projects/margin-analysis-14-0/margin-analysis-14-0-account_invoice_margin_sale
     :alt: Translate me on Weblate
 .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
-    :target: https://runbot.odoo-community.org/runbot/132/13.0
+    :target: https://runbot.odoo-community.org/runbot/132/14.0
     :alt: Try me on Runbot
 
 |badge1| |badge2| |badge3| |badge4| |badge5| 
@@ -43,7 +43,7 @@ Bug Tracker
 Bugs are tracked on `GitHub Issues <https://github.com/OCA/margin-analysis/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 <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
+`feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
 
 Do not contact contributors directly about support or help with technical issues.
 
@@ -91,6 +91,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
 
 |maintainer-sergio-teruel| |maintainer-carlosdauden| 
 
-This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/13.0/account_invoice_margin_sale>`_ project on GitHub.
+This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/14.0/account_invoice_margin_sale>`_ project on GitHub.
 
 You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_invoice_margin_sale/__init__.py b/account_invoice_margin_sale/__init__.py
index 7d768b54b..69f7babdf 100644
--- a/account_invoice_margin_sale/__init__.py
+++ b/account_invoice_margin_sale/__init__.py
@@ -1,3 +1,3 @@
-# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 
 from . import models
diff --git a/account_invoice_margin_sale/__manifest__.py b/account_invoice_margin_sale/__manifest__.py
index 86176cda1..28867433e 100644
--- a/account_invoice_margin_sale/__manifest__.py
+++ b/account_invoice_margin_sale/__manifest__.py
@@ -5,7 +5,7 @@
 {
     "name": "Account Invoice Margin Sale",
     "summary": "Set margin in invoices from sale orders",
-    "version": "13.0.1.0.1",
+    "version": "14.0.1.0.0",
     "development_status": "Production/Stable",
     "maintainers": ["sergio-teruel", "carlosdauden"],
     "category": "Account",
diff --git a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
index 8b6e20ee1..b4e57ad38 100644
--- a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
+++ b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
@@ -4,7 +4,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 13.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
 "Report-Msgid-Bugs-To: \n"
 "Last-Translator: \n"
 "Language-Team: \n"
@@ -13,9 +13,23 @@ msgstr ""
 "Content-Transfer-Encoding: \n"
 "Plural-Forms: \n"
 
+#. module: account_invoice_margin_sale
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move__display_name
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move_line__display_name
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_sale_order_line__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: account_invoice_margin_sale
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move__id
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move_line__id
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_sale_order_line__id
+msgid "ID"
+msgstr ""
+
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move
-msgid "Journal Entries"
+msgid "Journal Entry"
 msgstr ""
 
 #. module: account_invoice_margin_sale
@@ -23,6 +37,13 @@ msgstr ""
 msgid "Journal Item"
 msgstr ""
 
+#. module: account_invoice_margin_sale
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move____last_update
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move_line____last_update
+#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_sale_order_line____last_update
+msgid "Last Modified on"
+msgstr ""
+
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
 msgid "Sales Order Line"
diff --git a/account_invoice_margin_sale/models/sale.py b/account_invoice_margin_sale/models/sale.py
index e728eb6c7..c590a399e 100644
--- a/account_invoice_margin_sale/models/sale.py
+++ b/account_invoice_margin_sale/models/sale.py
@@ -8,7 +8,7 @@
 class SaleOrderLine(models.Model):
     _inherit = "sale.order.line"
 
-    def _prepare_invoice_line(self):
-        vals = super()._prepare_invoice_line()
+    def _prepare_invoice_line(self, **optional_values):
+        vals = super()._prepare_invoice_line(**optional_values)
         vals["purchase_price"] = self.purchase_price
         return vals
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index 1ce804606..67dfa5ff5 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -367,7 +367,7 @@ <h1 class="title">Account Invoice Margin Sale</h1>
 !! This file is generated by oca-gen-addon-readme !!
 !! changes will be overwritten.                   !!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/13.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/margin-analysis-13-0/margin-analysis-13-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/132/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
+<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/14.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/margin-analysis-14-0/margin-analysis-14-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/132/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
 <p>This module allows transfer purchase price from sale order line to invoice.</p>
 <p><strong>Table of contents</strong></p>
 <div class="contents local topic" id="contents">
@@ -391,7 +391,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
 <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/margin-analysis/issues">GitHub Issues</a>.
 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
-<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
+<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
 <p>Do not contact contributors directly about support or help with technical issues.</p>
 </div>
 <div class="section" id="credits">
@@ -425,7 +425,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
 promote its widespread use.</p>
 <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
 <p><a class="reference external" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a> <a class="reference external" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a></p>
-<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/13.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
+<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/14.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
 <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
 </div>
 </div>
diff --git a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
index ab83ab5de..5e768d8d7 100644
--- a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
+++ b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
@@ -47,7 +47,6 @@ def setUpClass(cls):
                 "standard_price": 100.00,
             }
         )
-        cls.product.property_account_receivable_id = cls.account
         pricelist = cls.env["product.pricelist"].create({"name": "Public Pricelist"})
 
         cls.sale_order = cls.env["sale.order"].create(
@@ -75,3 +74,57 @@ def test_invoice_sale_order(self):
         self.sale_order.order_line.purchase_price = 500.00
         invoice = self.sale_order._create_invoices()
         self.assertAlmostEqual(invoice.invoice_line_ids.purchase_price, 500.00, 2)
+
+    def test_invoice_down_payment(self):
+        SaleAdvancePaymentInv = self.env["sale.advance.payment.inv"]
+        AccountMove = self.env["account.move"]
+        product = self.env["product.product"].create(
+            {
+                "name": "test product for down payment",
+                "categ_id": self.product_categ.id,
+                "uom_id": self.env.ref("uom.product_uom_unit").id,
+                "list_price": 1000.00,
+                "standard_price": 500.00,
+                "type": "service",
+                "invoice_policy": "order",
+            }
+        )
+        self.order = self.env["sale.order"].create(
+            {
+                "partner_id": self.partner.id,
+                "order_line": [
+                    (
+                        0,
+                        False,
+                        {
+                            "product_id": product.id,
+                            "name": "Testing Product",
+                            "product_uom_qty": 1,
+                            "product_uom": product.uom_id.id,
+                            "price_unit": 1000.00,
+                            "purchase_price": 500.00,
+                        },
+                    ),
+                ],
+            }
+        )
+        self.order.action_confirm()
+        # Create one down payment
+        wiz = SaleAdvancePaymentInv.with_context(
+            active_ids=self.order.ids,
+            open_invoices=True,
+        ).create({"advance_payment_method": "fixed", "fixed_amount": 100.00})
+        action = wiz.create_invoices()
+        invoice_id = action["res_id"]
+        invoice1 = AccountMove.browse(invoice_id)
+        self.assertEqual(invoice1.margin, 0.0)
+
+        # Create regular invoice which has a down payment
+        wiz = SaleAdvancePaymentInv.with_context(
+            active_ids=self.order.ids,
+            open_invoices=True,
+        ).create({"advance_payment_method": "delivered"})
+        wiz.create_invoices()
+        invoice2 = self.order.invoice_ids - invoice1
+        self.assertEqual(invoice2.margin, 500.00)
+        self.assertEqual(invoice2.margin_percent, 50.0)

From 44bea45a8162b79ae3ab7f57f50f36439b9b5906 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=20Mart=C3=ADnez?= <rmartinez@puntsistemes.es>
Date: Sun, 27 Feb 2022 11:10:41 +0000
Subject: [PATCH 06/26] Translated using Weblate (Spanish)

Currently translated at 100.0% (3 of 3 strings)

Translation: margin-analysis-14.0/margin-analysis-14.0-account_invoice_margin_sale
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-14-0/margin-analysis-14-0-account_invoice_margin_sale/es/
---
 account_invoice_margin_sale/i18n/es.po | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/account_invoice_margin_sale/i18n/es.po b/account_invoice_margin_sale/i18n/es.po
index a15803283..ca476b32e 100644
--- a/account_invoice_margin_sale/i18n/es.po
+++ b/account_invoice_margin_sale/i18n/es.po
@@ -6,8 +6,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Odoo Server 13.0\n"
 "Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2020-12-16 22:19+0000\n"
-"Last-Translator: Harald Panten <harald.panten@sygel.es>\n"
+"PO-Revision-Date: 2022-02-27 13:17+0000\n"
+"Last-Translator: Rafa Martínez <rmartinez@puntsistemes.es>\n"
 "Language-Team: none\n"
 "Language: es\n"
 "MIME-Version: 1.0\n"
@@ -19,12 +19,12 @@ msgstr ""
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move
 msgid "Journal Entries"
-msgstr ""
+msgstr "Entradas de diario"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move_line
 msgid "Journal Item"
-msgstr ""
+msgstr "Apunte contable"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line

From 9aab1858f7e3432830796e3680902d802d31793f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?=
 <victor.martinez@tecnativa.com>
Date: Thu, 28 Jul 2022 17:14:57 +0200
Subject: [PATCH 07/26] [MIG] account_invoice_margin_sale: Migration to 15.0
 TT36420

---
 account_invoice_margin_sale/README.rst                | 11 ++++++-----
 account_invoice_margin_sale/__manifest__.py           |  2 +-
 account_invoice_margin_sale/models/account_invoice.py |  1 +
 account_invoice_margin_sale/readme/CONTRIBUTORS.rst   |  1 +
 .../static/description/index.html                     |  9 +++++----
 .../tests/test_account_invoice_margin_sale.py         |  6 +++---
 6 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
index 5de2c0ee8..240df22c0 100644
--- a/account_invoice_margin_sale/README.rst
+++ b/account_invoice_margin_sale/README.rst
@@ -14,13 +14,13 @@ Account Invoice Margin Sale
     :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
     :alt: License: AGPL-3
 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
-    :target: https://github.com/OCA/margin-analysis/tree/14.0/account_invoice_margin_sale
+    :target: https://github.com/OCA/margin-analysis/tree/15.0/account_invoice_margin_sale
     :alt: OCA/margin-analysis
 .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
-    :target: https://translation.odoo-community.org/projects/margin-analysis-14-0/margin-analysis-14-0-account_invoice_margin_sale
+    :target: https://translation.odoo-community.org/projects/margin-analysis-15-0/margin-analysis-15-0-account_invoice_margin_sale
     :alt: Translate me on Weblate
 .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
-    :target: https://runbot.odoo-community.org/runbot/132/14.0
+    :target: https://runbot.odoo-community.org/runbot/132/15.0
     :alt: Try me on Runbot
 
 |badge1| |badge2| |badge3| |badge4| |badge5| 
@@ -43,7 +43,7 @@ Bug Tracker
 Bugs are tracked on `GitHub Issues <https://github.com/OCA/margin-analysis/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 <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
+`feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
 
 Do not contact contributors directly about support or help with technical issues.
 
@@ -62,6 +62,7 @@ Contributors
 
   * Sergio Teruel
   * Carlos Dauden
+  * Víctor Martínez
 
 * `Open Source Integrators <https://www.opensourceintegrators.com>`__:
 
@@ -91,6 +92,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
 
 |maintainer-sergio-teruel| |maintainer-carlosdauden| 
 
-This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/14.0/account_invoice_margin_sale>`_ project on GitHub.
+This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/15.0/account_invoice_margin_sale>`_ project on GitHub.
 
 You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_invoice_margin_sale/__manifest__.py b/account_invoice_margin_sale/__manifest__.py
index 28867433e..7c51edfb3 100644
--- a/account_invoice_margin_sale/__manifest__.py
+++ b/account_invoice_margin_sale/__manifest__.py
@@ -5,7 +5,7 @@
 {
     "name": "Account Invoice Margin Sale",
     "summary": "Set margin in invoices from sale orders",
-    "version": "14.0.1.0.0",
+    "version": "15.0.1.0.0",
     "development_status": "Production/Stable",
     "maintainers": ["sergio-teruel", "carlosdauden"],
     "category": "Account",
diff --git a/account_invoice_margin_sale/models/account_invoice.py b/account_invoice_margin_sale/models/account_invoice.py
index a6637a76d..1c5d55e05 100644
--- a/account_invoice_margin_sale/models/account_invoice.py
+++ b/account_invoice_margin_sale/models/account_invoice.py
@@ -15,6 +15,7 @@ def _get_margin_applicable_lines(self):
 class AccountMoveLine(models.Model):
     _inherit = "account.move.line"
 
+    # pylint: disable=W8110
     @api.depends("purchase_price", "price_subtotal")
     def _compute_margin(self):
         for line in self:
diff --git a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
index 6690797bb..59d8d9964 100644
--- a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
+++ b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
@@ -2,6 +2,7 @@
 
   * Sergio Teruel
   * Carlos Dauden
+  * Víctor Martínez
 
 * `Open Source Integrators <https://www.opensourceintegrators.com>`__:
 
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index 67dfa5ff5..960f15b51 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
 <title>Account Invoice Margin Sale</title>
 <style type="text/css">
 
@@ -367,7 +367,7 @@ <h1 class="title">Account Invoice Margin Sale</h1>
 !! This file is generated by oca-gen-addon-readme !!
 !! changes will be overwritten.                   !!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/14.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/margin-analysis-14-0/margin-analysis-14-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/132/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
+<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/15.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/margin-analysis-15-0/margin-analysis-15-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/132/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
 <p>This module allows transfer purchase price from sale order line to invoice.</p>
 <p><strong>Table of contents</strong></p>
 <div class="contents local topic" id="contents">
@@ -391,7 +391,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
 <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/margin-analysis/issues">GitHub Issues</a>.
 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
-<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
+<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
 <p>Do not contact contributors directly about support or help with technical issues.</p>
 </div>
 <div class="section" id="credits">
@@ -408,6 +408,7 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
 <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
 <li>Sergio Teruel</li>
 <li>Carlos Dauden</li>
+<li>Víctor Martínez</li>
 </ul>
 </li>
 <li><a class="reference external" href="https://www.opensourceintegrators.com">Open Source Integrators</a>:<ul>
@@ -425,7 +426,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
 promote its widespread use.</p>
 <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
 <p><a class="reference external" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a> <a class="reference external" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a></p>
-<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/14.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
+<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/15.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
 <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
 </div>
 </div>
diff --git a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
index 5e768d8d7..08e928a90 100644
--- a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
+++ b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
@@ -2,13 +2,13 @@
 # Copyright 2019 Tecnativa - Carlos Dauden
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 
-from odoo.tests.common import SavepointCase
+from odoo.tests.common import TransactionCase
 
 
-class TestAccountInvoiceMargin(SavepointCase):
+class TestAccountInvoiceMargin(TransactionCase):
     @classmethod
     def setUpClass(cls):
-        super(TestAccountInvoiceMargin, cls).setUpClass()
+        super().setUpClass()
         cls.journal = cls.env["account.journal"].create(
             {"name": "Test journal", "type": "sale", "code": "TEST_J"}
         )

From 3131bf581a50927cbb9015f1a16b214e77afc252 Mon Sep 17 00:00:00 2001
From: oca-ci <oca-ci@odoo-community.org>
Date: Tue, 23 Aug 2022 09:01:32 +0000
Subject: [PATCH 08/26] [UPD] Update account_invoice_margin_sale.pot

---
 .../i18n/account_invoice_margin_sale.pot      | 23 +------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
index b4e57ad38..708e4ed57 100644
--- a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
+++ b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
@@ -4,7 +4,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
 "Report-Msgid-Bugs-To: \n"
 "Last-Translator: \n"
 "Language-Team: \n"
@@ -13,20 +13,6 @@ msgstr ""
 "Content-Transfer-Encoding: \n"
 "Plural-Forms: \n"
 
-#. module: account_invoice_margin_sale
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move__display_name
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move_line__display_name
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_sale_order_line__display_name
-msgid "Display Name"
-msgstr ""
-
-#. module: account_invoice_margin_sale
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move__id
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move_line__id
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_sale_order_line__id
-msgid "ID"
-msgstr ""
-
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move
 msgid "Journal Entry"
@@ -37,13 +23,6 @@ msgstr ""
 msgid "Journal Item"
 msgstr ""
 
-#. module: account_invoice_margin_sale
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move____last_update
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_account_move_line____last_update
-#: model:ir.model.fields,field_description:account_invoice_margin_sale.field_sale_order_line____last_update
-msgid "Last Modified on"
-msgstr ""
-
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
 msgid "Sales Order Line"

From c78697db311fbae5224a411747013f7957efd110 Mon Sep 17 00:00:00 2001
From: OCA-git-bot <oca-git-bot@odoo-community.org>
Date: Tue, 23 Aug 2022 09:03:50 +0000
Subject: [PATCH 09/26] [UPD] README.rst

---
 account_invoice_margin_sale/static/description/index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index 960f15b51..d060ae36c 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -3,7 +3,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
 <title>Account Invoice Margin Sale</title>
 <style type="text/css">
 

From db44379889f620af3a656a3b907834d3fc05380f Mon Sep 17 00:00:00 2001
From: "Luis J. Salvatierra" <luis.salvatierra@factorlibre.com>
Date: Mon, 22 May 2023 09:28:16 +0200
Subject: [PATCH 10/26] [MIG] account_invoice_margin_sale: Migration to 16.0

---
 account_invoice_margin_sale/__manifest__.py   |  2 +-
 .../models/account_invoice.py                 | 24 ++++++++++++-------
 .../readme/CONTRIBUTORS.rst                   |  4 ++++
 .../readme/DESCRIPTION.rst                    |  3 ++-
 account_invoice_margin_sale/readme/USAGE.rst  |  4 ++++
 .../tests/test_account_invoice_margin_sale.py | 21 +++++++++-------
 6 files changed, 38 insertions(+), 20 deletions(-)
 create mode 100644 account_invoice_margin_sale/readme/USAGE.rst

diff --git a/account_invoice_margin_sale/__manifest__.py b/account_invoice_margin_sale/__manifest__.py
index 7c51edfb3..378a43abf 100644
--- a/account_invoice_margin_sale/__manifest__.py
+++ b/account_invoice_margin_sale/__manifest__.py
@@ -5,7 +5,7 @@
 {
     "name": "Account Invoice Margin Sale",
     "summary": "Set margin in invoices from sale orders",
-    "version": "15.0.1.0.0",
+    "version": "16.0.1.0.0",
     "development_status": "Production/Stable",
     "maintainers": ["sergio-teruel", "carlosdauden"],
     "category": "Account",
diff --git a/account_invoice_margin_sale/models/account_invoice.py b/account_invoice_margin_sale/models/account_invoice.py
index 1c5d55e05..71acb3684 100644
--- a/account_invoice_margin_sale/models/account_invoice.py
+++ b/account_invoice_margin_sale/models/account_invoice.py
@@ -8,8 +8,10 @@ class AccountMove(models.Model):
     _inherit = "account.move"
 
     def _get_margin_applicable_lines(self):
-        lines = super()._get_margin_applicable_lines()
-        return lines.filtered(lambda x: not x.sale_line_ids.is_downpayment)
+        invoice_lines = super()._get_margin_applicable_lines()
+        return invoice_lines.filtered(
+            lambda x: not any(x.sale_line_ids.mapped("is_downpayment"))
+        )
 
 
 class AccountMoveLine(models.Model):
@@ -18,10 +20,14 @@ class AccountMoveLine(models.Model):
     # pylint: disable=W8110
     @api.depends("purchase_price", "price_subtotal")
     def _compute_margin(self):
-        for line in self:
-            if any(line.sale_line_ids.mapped("is_downpayment")):
-                line.update(
-                    {"margin": 0.0, "margin_signed": 0.0, "margin_percent": 0.0}
-                )
-            else:
-                super(AccountMoveLine, line)._compute_margin()
+        invoice_lines_with_downpayment = self.filtered(
+            lambda x: any(x.sale_line_ids.mapped("is_downpayment"))
+        )
+        invoice_lines_with_downpayment.update(
+            {
+                "margin": 0.0,
+                "margin_signed": 0.0,
+                "margin_percent": 0.0,
+            }
+        )
+        super(AccountMoveLine, self - invoice_lines_with_downpayment)._compute_margin()
diff --git a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
index 59d8d9964..684550f4a 100644
--- a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
+++ b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
@@ -7,3 +7,7 @@
 * `Open Source Integrators <https://www.opensourceintegrators.com>`__:
 
   * Bhavesh Odedra
+
+* `Factor Libre <https://www.factorlibre.com>`__:
+
+  * Luis J. Salvatierra
diff --git a/account_invoice_margin_sale/readme/DESCRIPTION.rst b/account_invoice_margin_sale/readme/DESCRIPTION.rst
index 6fb927348..f798a9caa 100644
--- a/account_invoice_margin_sale/readme/DESCRIPTION.rst
+++ b/account_invoice_margin_sale/readme/DESCRIPTION.rst
@@ -1 +1,2 @@
-This module allows transfer purchase price from sale order line to invoice.
+This module propagates purchase price from sale order line to invoice and discards the
+invoice lines coming from sale order lines with down-payment when computing the margin.
diff --git a/account_invoice_margin_sale/readme/USAGE.rst b/account_invoice_margin_sale/readme/USAGE.rst
new file mode 100644
index 000000000..a30bc2696
--- /dev/null
+++ b/account_invoice_margin_sale/readme/USAGE.rst
@@ -0,0 +1,4 @@
+This module also adds a security group.
+
+#. To activate it go to user and active "Show Invoice Margin" in
+   security options.
diff --git a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
index 08e928a90..18c44aa6a 100644
--- a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
+++ b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
@@ -9,21 +9,24 @@ class TestAccountInvoiceMargin(TransactionCase):
     @classmethod
     def setUpClass(cls):
         super().setUpClass()
+        cls.env = cls.env(
+            context=dict(
+                cls.env.context,
+                mail_create_nolog=True,
+                mail_create_nosubscribe=True,
+                mail_notrack=True,
+                no_reset_password=True,
+                tracking_disable=True,
+            )
+        )
         cls.journal = cls.env["account.journal"].create(
             {"name": "Test journal", "type": "sale", "code": "TEST_J"}
         )
-        cls.account_type = cls.env["account.account.type"].create(
-            {
-                "name": "Test account type",
-                "type": "receivable",
-                "internal_group": "income",
-            }
-        )
         cls.account = cls.env["account.account"].create(
             {
                 "name": "Test account",
-                "code": "TEST_A",
-                "user_type_id": cls.account_type.id,
+                "code": "TESTACCRECV",
+                "account_type": "asset_receivable",
                 "reconcile": True,
             }
         )

From b905cd3c0dc9d839d74e446ede45eaadb62c98b4 Mon Sep 17 00:00:00 2001
From: "Luis J. Salvatierra" <luis.salvatierra@factorlibre.com>
Date: Mon, 5 Jun 2023 11:52:03 +0200
Subject: [PATCH 11/26] [MIG] account_invoice_margin_sale: Migration to 16.0

---
 account_invoice_margin_sale/readme/USAGE.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/account_invoice_margin_sale/readme/USAGE.rst b/account_invoice_margin_sale/readme/USAGE.rst
index a30bc2696..51b56a21d 100644
--- a/account_invoice_margin_sale/readme/USAGE.rst
+++ b/account_invoice_margin_sale/readme/USAGE.rst
@@ -1,4 +1,4 @@
-This module also adds a security group.
+This module also needs a security group to show margins.
 
 #. To activate it go to user and active "Show Invoice Margin" in
    security options.

From 4ff2c14bee05f0aaada3ecfba35f538bccc721c0 Mon Sep 17 00:00:00 2001
From: oca-ci <oca-ci@odoo-community.org>
Date: Mon, 5 Jun 2023 13:46:41 +0000
Subject: [PATCH 12/26] [UPD] Update account_invoice_margin_sale.pot

---
 .../i18n/account_invoice_margin_sale.pot                        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
index 708e4ed57..427a8da11 100644
--- a/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
+++ b/account_invoice_margin_sale/i18n/account_invoice_margin_sale.pot
@@ -4,7 +4,7 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: Odoo Server 15.0\n"
+"Project-Id-Version: Odoo Server 16.0\n"
 "Report-Msgid-Bugs-To: \n"
 "Last-Translator: \n"
 "Language-Team: \n"

From b268cb52cf11abb924a32179d57405321cddd07b Mon Sep 17 00:00:00 2001
From: OCA-git-bot <oca-git-bot@odoo-community.org>
Date: Mon, 5 Jun 2023 13:49:37 +0000
Subject: [PATCH 13/26] [UPD] README.rst

---
 account_invoice_margin_sale/README.rst        | 25 ++++++++---
 .../static/description/index.html             | 42 ++++++++++++-------
 2 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
index 240df22c0..f57a2073e 100644
--- a/account_invoice_margin_sale/README.rst
+++ b/account_invoice_margin_sale/README.rst
@@ -14,18 +14,19 @@ Account Invoice Margin Sale
     :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
     :alt: License: AGPL-3
 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
-    :target: https://github.com/OCA/margin-analysis/tree/15.0/account_invoice_margin_sale
+    :target: https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale
     :alt: OCA/margin-analysis
 .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
-    :target: https://translation.odoo-community.org/projects/margin-analysis-15-0/margin-analysis-15-0-account_invoice_margin_sale
+    :target: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale
     :alt: Translate me on Weblate
 .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
-    :target: https://runbot.odoo-community.org/runbot/132/15.0
+    :target: https://runbot.odoo-community.org/runbot/132/16.0
     :alt: Try me on Runbot
 
 |badge1| |badge2| |badge3| |badge4| |badge5| 
 
-This module allows transfer purchase price from sale order line to invoice.
+This module propagates purchase price from sale order line to invoice and discards the
+invoice lines coming from sale order lines with down-payment when computing the margin.
 
 **Table of contents**
 
@@ -37,13 +38,21 @@ Installation
 
 This module is autoinstalable.
 
+Usage
+=====
+
+This module also needs a security group to show margins.
+
+#. To activate it go to user and active "Show Invoice Margin" in
+   security options.
+
 Bug Tracker
 ===========
 
 Bugs are tracked on `GitHub Issues <https://github.com/OCA/margin-analysis/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 <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
+`feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
 
 Do not contact contributors directly about support or help with technical issues.
 
@@ -68,6 +77,10 @@ Contributors
 
   * Bhavesh Odedra
 
+* `Factor Libre <https://www.factorlibre.com>`__:
+
+  * Luis J. Salvatierra
+
 Maintainers
 ~~~~~~~~~~~
 
@@ -92,6 +105,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
 
 |maintainer-sergio-teruel| |maintainer-carlosdauden| 
 
-This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/15.0/account_invoice_margin_sale>`_ project on GitHub.
+This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale>`_ project on GitHub.
 
 You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index d060ae36c..06cc001a1 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -367,17 +367,19 @@ <h1 class="title">Account Invoice Margin Sale</h1>
 !! This file is generated by oca-gen-addon-readme !!
 !! changes will be overwritten.                   !!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/15.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/margin-analysis-15-0/margin-analysis-15-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/132/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
-<p>This module allows transfer purchase price from sale order line to invoice.</p>
+<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/132/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
+<p>This module propagates purchase price from sale order line to invoice and discards the
+invoice lines coming from sale order lines with down-payment when computing the margin.</p>
 <p><strong>Table of contents</strong></p>
 <div class="contents local topic" id="contents">
 <ul class="simple">
 <li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
-<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
-<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
-<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
-<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
-<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
+<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
+<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
+<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
+<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
+<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
+<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
 </ul>
 </li>
 </ul>
@@ -386,24 +388,32 @@ <h1 class="title">Account Invoice Margin Sale</h1>
 <h1><a class="toc-backref" href="#id1">Installation</a></h1>
 <p>This module is autoinstalable.</p>
 </div>
+<div class="section" id="usage">
+<h1><a class="toc-backref" href="#id2">Usage</a></h1>
+<p>This module also needs a security group to show margins.</p>
+<ol class="arabic simple">
+<li>To activate it go to user and active “Show Invoice Margin” in
+security options.</li>
+</ol>
+</div>
 <div class="section" id="bug-tracker">
-<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
+<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
 <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/margin-analysis/issues">GitHub Issues</a>.
 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
-<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
+<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
 <p>Do not contact contributors directly about support or help with technical issues.</p>
 </div>
 <div class="section" id="credits">
-<h1><a class="toc-backref" href="#id3">Credits</a></h1>
+<h1><a class="toc-backref" href="#id4">Credits</a></h1>
 <div class="section" id="authors">
-<h2><a class="toc-backref" href="#id4">Authors</a></h2>
+<h2><a class="toc-backref" href="#id5">Authors</a></h2>
 <ul class="simple">
 <li>Tecnativa</li>
 </ul>
 </div>
 <div class="section" id="contributors">
-<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
+<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
 <ul class="simple">
 <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
 <li>Sergio Teruel</li>
@@ -415,10 +425,14 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
 <li>Bhavesh Odedra</li>
 </ul>
 </li>
+<li><a class="reference external" href="https://www.factorlibre.com">Factor Libre</a>:<ul>
+<li>Luis J. Salvatierra</li>
+</ul>
+</li>
 </ul>
 </div>
 <div class="section" id="maintainers">
-<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
+<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
 <p>This module is maintained by the OCA.</p>
 <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
 <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
@@ -426,7 +440,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
 promote its widespread use.</p>
 <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
 <p><a class="reference external" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a> <a class="reference external" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a></p>
-<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/15.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
+<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
 <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
 </div>
 </div>

From 7bda5557fe8b58e38907c7e942481b3310477e83 Mon Sep 17 00:00:00 2001
From: Weblate <noreply@weblate.org>
Date: Mon, 5 Jun 2023 15:13:49 +0000
Subject: [PATCH 14/26] Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: margin-analysis-16.0/margin-analysis-16.0-account_invoice_margin_sale
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale/
---
 account_invoice_margin_sale/i18n/es.po | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/account_invoice_margin_sale/i18n/es.po b/account_invoice_margin_sale/i18n/es.po
index ca476b32e..997244a3c 100644
--- a/account_invoice_margin_sale/i18n/es.po
+++ b/account_invoice_margin_sale/i18n/es.po
@@ -18,8 +18,8 @@ msgstr ""
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move
-msgid "Journal Entries"
-msgstr "Entradas de diario"
+msgid "Journal Entry"
+msgstr ""
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move_line
@@ -30,3 +30,6 @@ msgstr "Apunte contable"
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
 msgid "Sales Order Line"
 msgstr "Línea de pedido de venta"
+
+#~ msgid "Journal Entries"
+#~ msgstr "Entradas de diario"

From 965186e8444f31e6ac0af13edf31830b384a4caf Mon Sep 17 00:00:00 2001
From: "Sandrine (ACSONE)" <sandrine.ravet@acsone.eu>
Date: Mon, 5 Jun 2023 15:40:56 +0000
Subject: [PATCH 15/26] Added translation using Weblate (French (France)
 (fr_FR))

---
 account_invoice_margin_sale/i18n/fr_FR.po | 30 +++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 account_invoice_margin_sale/i18n/fr_FR.po

diff --git a/account_invoice_margin_sale/i18n/fr_FR.po b/account_invoice_margin_sale/i18n/fr_FR.po
new file mode 100644
index 000000000..3ff28b174
--- /dev/null
+++ b/account_invoice_margin_sale/i18n/fr_FR.po
@@ -0,0 +1,30 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* account_invoice_margin_sale
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: fr_FR\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: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_account_move
+msgid "Journal Entry"
+msgstr ""
+
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_account_move_line
+msgid "Journal Item"
+msgstr ""
+
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
+msgid "Sales Order Line"
+msgstr ""

From fd0399e34a7d4aea37cb8e453843805c229239db Mon Sep 17 00:00:00 2001
From: "Sandrine (ACSONE)" <sandrine.ravet@acsone.eu>
Date: Mon, 5 Jun 2023 15:41:41 +0000
Subject: [PATCH 16/26] Translated using Weblate (French (France) (fr_FR))

Currently translated at 100.0% (3 of 3 strings)

Translation: margin-analysis-16.0/margin-analysis-16.0-account_invoice_margin_sale
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale/fr_FR/
---
 account_invoice_margin_sale/i18n/fr_FR.po | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/account_invoice_margin_sale/i18n/fr_FR.po b/account_invoice_margin_sale/i18n/fr_FR.po
index 3ff28b174..cf2ec905d 100644
--- a/account_invoice_margin_sale/i18n/fr_FR.po
+++ b/account_invoice_margin_sale/i18n/fr_FR.po
@@ -6,25 +6,27 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Odoo Server 16.0\n"
 "Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2023-06-05 18:09+0000\n"
+"Last-Translator: \"Sandrine (ACSONE)\" <sandrine.ravet@acsone.eu>\n"
 "Language-Team: none\n"
 "Language: fr_FR\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.17\n"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move
 msgid "Journal Entry"
-msgstr ""
+msgstr "Pièce comptable"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move_line
 msgid "Journal Item"
-msgstr ""
+msgstr "Ecriture comptable"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
 msgid "Sales Order Line"
-msgstr ""
+msgstr "Ligne de commande client"

From ba961bf63917e4d2619cf3e4fcd70d1c02a27546 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?gelo=20joga=20Rodr=C3=ADguez?= <gelo.joga@factorlibre.com>
Date: Wed, 7 Jun 2023 16:27:21 +0000
Subject: [PATCH 17/26] Translated using Weblate (Spanish)

Currently translated at 100.0% (3 of 3 strings)

Translation: margin-analysis-16.0/margin-analysis-16.0-account_invoice_margin_sale
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale/es/
---
 account_invoice_margin_sale/i18n/es.po | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/account_invoice_margin_sale/i18n/es.po b/account_invoice_margin_sale/i18n/es.po
index 997244a3c..88e865fc8 100644
--- a/account_invoice_margin_sale/i18n/es.po
+++ b/account_invoice_margin_sale/i18n/es.po
@@ -6,20 +6,20 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Odoo Server 13.0\n"
 "Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2022-02-27 13:17+0000\n"
-"Last-Translator: Rafa Martínez <rmartinez@puntsistemes.es>\n"
+"PO-Revision-Date: 2023-06-07 19:09+0000\n"
+"Last-Translator: gelo joga Rodríguez <gelo.joga@factorlibre.com>\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 4.3.2\n"
+"X-Generator: Weblate 4.17\n"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move
 msgid "Journal Entry"
-msgstr ""
+msgstr "Asiento contable"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move_line

From 49c110d7c8507150d1b980aa17bd67213a287d1a Mon Sep 17 00:00:00 2001
From: OCA-git-bot <oca-git-bot@odoo-community.org>
Date: Sun, 3 Sep 2023 14:37:30 +0000
Subject: [PATCH 18/26] [UPD] README.rst

---
 account_invoice_margin_sale/README.rst        | 15 ++++---
 .../static/description/index.html             | 44 ++++++++++---------
 2 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
index f57a2073e..d1df569fe 100644
--- a/account_invoice_margin_sale/README.rst
+++ b/account_invoice_margin_sale/README.rst
@@ -2,10 +2,13 @@
 Account Invoice Margin Sale
 ===========================
 
-.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+.. 
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    !! This file is generated by oca-gen-addon-readme !!
    !! changes will be overwritten.                   !!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+   !! source digest: sha256:0af22cebda1276cda900bc93c7752c6c1e101b4d93f82083104ca9d2208f2c11
+   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
     :target: https://odoo-community.org/page/development-status
@@ -19,11 +22,11 @@ Account Invoice Margin Sale
 .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
     :target: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale
     :alt: Translate me on Weblate
-.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
-    :target: https://runbot.odoo-community.org/runbot/132/16.0
-    :alt: Try me on Runbot
+.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
+    :target: https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&target_branch=16.0
+    :alt: Try me on Runboat
 
-|badge1| |badge2| |badge3| |badge4| |badge5| 
+|badge1| |badge2| |badge3| |badge4| |badge5|
 
 This module propagates purchase price from sale order line to invoice and discards the
 invoice lines coming from sale order lines with down-payment when computing the margin.
@@ -51,7 +54,7 @@ Bug Tracker
 
 Bugs are tracked on `GitHub Issues <https://github.com/OCA/margin-analysis/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
+If you spotted it first, help us to smash it by providing a detailed and welcomed
 `feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
 
 Do not contact contributors directly about support or help with technical issues.
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index 06cc001a1..46e10d4cb 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
+<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
 <title>Account Invoice Margin Sale</title>
 <style type="text/css">
 
 /*
 :Author: David Goodger (goodger@python.org)
-:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
+:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
 :Copyright: This stylesheet has been placed in the public domain.
 
 Default cascading style sheet for the HTML output of Docutils.
 
-See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
 customize this style sheet.
 */
 
@@ -366,30 +366,32 @@ <h1 class="title">Account Invoice Margin Sale</h1>
 <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !! This file is generated by oca-gen-addon-readme !!
 !! changes will be overwritten.                   !!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!! source digest: sha256:0af22cebda1276cda900bc93c7752c6c1e101b4d93f82083104ca9d2208f2c11
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/132/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
+<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
 <p>This module propagates purchase price from sale order line to invoice and discards the
 invoice lines coming from sale order lines with down-payment when computing the margin.</p>
 <p><strong>Table of contents</strong></p>
 <div class="contents local topic" id="contents">
 <ul class="simple">
-<li><a class="reference internal" href="#installation" id="id1">Installation</a></li>
-<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
-<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
-<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
-<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
-<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
-<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
+<li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li>
+<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
+<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
+<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
+<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
+<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
+<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
 </ul>
 </li>
 </ul>
 </div>
 <div class="section" id="installation">
-<h1><a class="toc-backref" href="#id1">Installation</a></h1>
+<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
 <p>This module is autoinstalable.</p>
 </div>
 <div class="section" id="usage">
-<h1><a class="toc-backref" href="#id2">Usage</a></h1>
+<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
 <p>This module also needs a security group to show margins.</p>
 <ol class="arabic simple">
 <li>To activate it go to user and active “Show Invoice Margin” in
@@ -397,23 +399,23 @@ <h1><a class="toc-backref" href="#id2">Usage</a></h1>
 </ol>
 </div>
 <div class="section" id="bug-tracker">
-<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
+<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
 <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/margin-analysis/issues">GitHub Issues</a>.
 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
+If you spotted it first, help us to smash it by providing a detailed and welcomed
 <a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
 <p>Do not contact contributors directly about support or help with technical issues.</p>
 </div>
 <div class="section" id="credits">
-<h1><a class="toc-backref" href="#id4">Credits</a></h1>
+<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
 <div class="section" id="authors">
-<h2><a class="toc-backref" href="#id5">Authors</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
 <ul class="simple">
 <li>Tecnativa</li>
 </ul>
 </div>
 <div class="section" id="contributors">
-<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
 <ul class="simple">
 <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
 <li>Sergio Teruel</li>
@@ -432,14 +434,14 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
 </ul>
 </div>
 <div class="section" id="maintainers">
-<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
+<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
 <p>This module is maintained by the OCA.</p>
 <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
 <p>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.</p>
 <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
-<p><a class="reference external" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a> <a class="reference external" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a></p>
+<p><a class="reference external image-reference" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a></p>
 <p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
 <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
 </div>

From d3d1e2ebffa1b189a688554aff5e69ce6129a275 Mon Sep 17 00:00:00 2001
From: josep-tecnativa <josep.guardiola@tecnativa.com>
Date: Fri, 20 Oct 2023 12:32:40 +0200
Subject: [PATCH 19/26] [IMP] account_invoice_margin_sale: test performance
 improvement - Include context keys for avoiding mail operations overhead.

---
 .../tests/test_account_invoice_margin_sale.py       | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
index 18c44aa6a..15328eaed 100644
--- a/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
+++ b/account_invoice_margin_sale/tests/test_account_invoice_margin_sale.py
@@ -4,21 +4,14 @@
 
 from odoo.tests.common import TransactionCase
 
+from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
+
 
 class TestAccountInvoiceMargin(TransactionCase):
     @classmethod
     def setUpClass(cls):
         super().setUpClass()
-        cls.env = cls.env(
-            context=dict(
-                cls.env.context,
-                mail_create_nolog=True,
-                mail_create_nosubscribe=True,
-                mail_notrack=True,
-                no_reset_password=True,
-                tracking_disable=True,
-            )
-        )
+        cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
         cls.journal = cls.env["account.journal"].create(
             {"name": "Test journal", "type": "sale", "code": "TEST_J"}
         )

From afeb532d14a528d94f7996647a3268b4792956ae Mon Sep 17 00:00:00 2001
From: OCA-git-bot <oca-git-bot@odoo-community.org>
Date: Mon, 23 Oct 2023 10:12:15 +0000
Subject: [PATCH 20/26] [BOT] post-merge updates

---
 account_invoice_margin_sale/README.rst                    | 2 +-
 account_invoice_margin_sale/__manifest__.py               | 2 +-
 account_invoice_margin_sale/static/description/index.html | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
index d1df569fe..08d635f02 100644
--- a/account_invoice_margin_sale/README.rst
+++ b/account_invoice_margin_sale/README.rst
@@ -7,7 +7,7 @@ Account Invoice Margin Sale
    !! This file is generated by oca-gen-addon-readme !!
    !! changes will be overwritten.                   !!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! source digest: sha256:0af22cebda1276cda900bc93c7752c6c1e101b4d93f82083104ca9d2208f2c11
+   !! source digest: sha256:68e6ec3e54aacd1d1ec0fb0da06bf432c2896c160834558f18bd26674445a1d1
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
diff --git a/account_invoice_margin_sale/__manifest__.py b/account_invoice_margin_sale/__manifest__.py
index 378a43abf..26342d83d 100644
--- a/account_invoice_margin_sale/__manifest__.py
+++ b/account_invoice_margin_sale/__manifest__.py
@@ -5,7 +5,7 @@
 {
     "name": "Account Invoice Margin Sale",
     "summary": "Set margin in invoices from sale orders",
-    "version": "16.0.1.0.0",
+    "version": "16.0.1.0.1",
     "development_status": "Production/Stable",
     "maintainers": ["sergio-teruel", "carlosdauden"],
     "category": "Account",
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index 46e10d4cb..3805aed68 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -367,7 +367,7 @@ <h1 class="title">Account Invoice Margin Sale</h1>
 !! This file is generated by oca-gen-addon-readme !!
 !! changes will be overwritten.                   !!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! source digest: sha256:0af22cebda1276cda900bc93c7752c6c1e101b4d93f82083104ca9d2208f2c11
+!! source digest: sha256:68e6ec3e54aacd1d1ec0fb0da06bf432c2896c160834558f18bd26674445a1d1
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
 <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
 <p>This module propagates purchase price from sale order line to invoice and discards the

From 11115889f3b647ec56e4f0460c73d022a2265972 Mon Sep 17 00:00:00 2001
From: Daniel Reis <dreis@opensourceintegrators.com>
Date: Mon, 8 Jan 2024 07:26:42 -0500
Subject: [PATCH 21/26] [FIX] account_invoice_margin_sale: error creating
 invoice from sale order

When sale_margin_security is also installed.
Closes https://github.com/OCA/margin-analysis/issues/194
---
 account_invoice_margin_sale/models/sale.py          | 2 +-
 account_invoice_margin_sale/readme/CONTRIBUTORS.rst | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/account_invoice_margin_sale/models/sale.py b/account_invoice_margin_sale/models/sale.py
index c590a399e..0ee4ccb46 100644
--- a/account_invoice_margin_sale/models/sale.py
+++ b/account_invoice_margin_sale/models/sale.py
@@ -10,5 +10,5 @@ class SaleOrderLine(models.Model):
 
     def _prepare_invoice_line(self, **optional_values):
         vals = super()._prepare_invoice_line(**optional_values)
-        vals["purchase_price"] = self.purchase_price
+        vals["purchase_price"] = self.sudo().purchase_price
         return vals
diff --git a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
index 684550f4a..79af01f4e 100644
--- a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
+++ b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
@@ -7,6 +7,7 @@
 * `Open Source Integrators <https://www.opensourceintegrators.com>`__:
 
   * Bhavesh Odedra
+  * Daniel Reis <dreis@opensourceintegrators.com>
 
 * `Factor Libre <https://www.factorlibre.com>`__:
 

From d76418cdc1e30b1f2497b6429634bc1880d22a32 Mon Sep 17 00:00:00 2001
From: OCA-git-bot <oca-git-bot@odoo-community.org>
Date: Mon, 8 Jan 2024 14:43:03 +0000
Subject: [PATCH 22/26] [BOT] post-merge updates

---
 account_invoice_margin_sale/README.rst                    | 3 ++-
 account_invoice_margin_sale/__manifest__.py               | 2 +-
 account_invoice_margin_sale/static/description/index.html | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
index 08d635f02..ca957d310 100644
--- a/account_invoice_margin_sale/README.rst
+++ b/account_invoice_margin_sale/README.rst
@@ -7,7 +7,7 @@ Account Invoice Margin Sale
    !! This file is generated by oca-gen-addon-readme !!
    !! changes will be overwritten.                   !!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   !! source digest: sha256:68e6ec3e54aacd1d1ec0fb0da06bf432c2896c160834558f18bd26674445a1d1
+   !! source digest: sha256:7e9e8ecc5cfc7eb80aaf4fc2b4d408409b3474c6a584f2e18c2cc6145c648807
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
@@ -79,6 +79,7 @@ Contributors
 * `Open Source Integrators <https://www.opensourceintegrators.com>`__:
 
   * Bhavesh Odedra
+  * Daniel Reis <dreis@opensourceintegrators.com>
 
 * `Factor Libre <https://www.factorlibre.com>`__:
 
diff --git a/account_invoice_margin_sale/__manifest__.py b/account_invoice_margin_sale/__manifest__.py
index 26342d83d..e701b5d15 100644
--- a/account_invoice_margin_sale/__manifest__.py
+++ b/account_invoice_margin_sale/__manifest__.py
@@ -5,7 +5,7 @@
 {
     "name": "Account Invoice Margin Sale",
     "summary": "Set margin in invoices from sale orders",
-    "version": "16.0.1.0.1",
+    "version": "16.0.1.0.2",
     "development_status": "Production/Stable",
     "maintainers": ["sergio-teruel", "carlosdauden"],
     "category": "Account",
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index 3805aed68..abb6d18af 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
@@ -367,7 +366,7 @@ <h1 class="title">Account Invoice Margin Sale</h1>
 !! This file is generated by oca-gen-addon-readme !!
 !! changes will be overwritten.                   !!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!! source digest: sha256:68e6ec3e54aacd1d1ec0fb0da06bf432c2896c160834558f18bd26674445a1d1
+!! source digest: sha256:7e9e8ecc5cfc7eb80aaf4fc2b4d408409b3474c6a584f2e18c2cc6145c648807
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
 <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
 <p>This module propagates purchase price from sale order line to invoice and discards the
@@ -425,6 +424,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
 </li>
 <li><a class="reference external" href="https://www.opensourceintegrators.com">Open Source Integrators</a>:<ul>
 <li>Bhavesh Odedra</li>
+<li>Daniel Reis &lt;<a class="reference external" href="mailto:dreis&#64;opensourceintegrators.com">dreis&#64;opensourceintegrators.com</a>&gt;</li>
 </ul>
 </li>
 <li><a class="reference external" href="https://www.factorlibre.com">Factor Libre</a>:<ul>

From fdbece0e4e9da3153430b3a9233c6d59ddc49546 Mon Sep 17 00:00:00 2001
From: mymage <stefano.consolaro@mymage.it>
Date: Mon, 22 Jan 2024 07:27:36 +0000
Subject: [PATCH 23/26] Added translation using Weblate (Italian)

---
 account_invoice_margin_sale/i18n/it.po | 30 ++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 account_invoice_margin_sale/i18n/it.po

diff --git a/account_invoice_margin_sale/i18n/it.po b/account_invoice_margin_sale/i18n/it.po
new file mode 100644
index 000000000..b87f45421
--- /dev/null
+++ b/account_invoice_margin_sale/i18n/it.po
@@ -0,0 +1,30 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* account_invoice_margin_sale
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 16.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: it\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: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_account_move
+msgid "Journal Entry"
+msgstr ""
+
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_account_move_line
+msgid "Journal Item"
+msgstr ""
+
+#. module: account_invoice_margin_sale
+#: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
+msgid "Sales Order Line"
+msgstr ""

From dbb5c369e74d4046d0bb2861b22676e03bf3e30b Mon Sep 17 00:00:00 2001
From: mymage <stefano.consolaro@mymage.it>
Date: Mon, 29 Jan 2024 15:04:50 +0000
Subject: [PATCH 24/26] Translated using Weblate (Italian)

Currently translated at 100.0% (3 of 3 strings)

Translation: margin-analysis-16.0/margin-analysis-16.0-account_invoice_margin_sale
Translate-URL: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale/it/
---
 account_invoice_margin_sale/i18n/it.po | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/account_invoice_margin_sale/i18n/it.po b/account_invoice_margin_sale/i18n/it.po
index b87f45421..4291d58d5 100644
--- a/account_invoice_margin_sale/i18n/it.po
+++ b/account_invoice_margin_sale/i18n/it.po
@@ -6,25 +6,27 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Odoo Server 16.0\n"
 "Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2024-01-29 17:38+0000\n"
+"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
 "Language-Team: none\n"
 "Language: it\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.17\n"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move
 msgid "Journal Entry"
-msgstr ""
+msgstr "Registrazione contabile"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_account_move_line
 msgid "Journal Item"
-msgstr ""
+msgstr "Movimento contabile"
 
 #. module: account_invoice_margin_sale
 #: model:ir.model,name:account_invoice_margin_sale.model_sale_order_line
 msgid "Sales Order Line"
-msgstr ""
+msgstr "Riga ordine di vendita"

From d616c63741bb052cc39d6dd041d0872972b85db0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nedas=20=C5=BDilinskas?= <nedas.zilinskas@avoin.systems>
Date: Mon, 19 Feb 2024 16:39:52 +0200
Subject: [PATCH 25/26] [IMP] account_invoice_margin_sale: pre-commit auto
 fixes

---
 account_invoice_margin_sale/README.rst        |  41 +++++++++---------
 account_invoice_margin_sale/pyproject.toml    |   3 ++
 .../readme/CONTRIBUTORS.md                    |   9 ++++
 .../readme/CONTRIBUTORS.rst                   |  14 ------
 .../readme/DESCRIPTION.md                     |   3 ++
 .../readme/DESCRIPTION.rst                    |   2 -
 .../readme/{INSTALL.rst => INSTALL.md}        |   0
 account_invoice_margin_sale/readme/USAGE.md   |   4 ++
 account_invoice_margin_sale/readme/USAGE.rst  |   4 --
 .../static/description/index.html             |  12 ++---
 pandoc-3.1.12.1-x86_64-macOS.pkg              | Bin 0 -> 21521118 bytes
 11 files changed, 47 insertions(+), 45 deletions(-)
 create mode 100644 account_invoice_margin_sale/pyproject.toml
 create mode 100644 account_invoice_margin_sale/readme/CONTRIBUTORS.md
 delete mode 100644 account_invoice_margin_sale/readme/CONTRIBUTORS.rst
 create mode 100644 account_invoice_margin_sale/readme/DESCRIPTION.md
 delete mode 100644 account_invoice_margin_sale/readme/DESCRIPTION.rst
 rename account_invoice_margin_sale/readme/{INSTALL.rst => INSTALL.md} (100%)
 create mode 100644 account_invoice_margin_sale/readme/USAGE.md
 delete mode 100644 account_invoice_margin_sale/readme/USAGE.rst
 create mode 100644 pandoc-3.1.12.1-x86_64-macOS.pkg

diff --git a/account_invoice_margin_sale/README.rst b/account_invoice_margin_sale/README.rst
index ca957d310..5cbf3b22a 100644
--- a/account_invoice_margin_sale/README.rst
+++ b/account_invoice_margin_sale/README.rst
@@ -17,19 +17,20 @@ Account Invoice Margin Sale
     :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
     :alt: License: AGPL-3
 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github
-    :target: https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale
+    :target: https://github.com/OCA/margin-analysis/tree/17.0/account_invoice_margin_sale
     :alt: OCA/margin-analysis
 .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
-    :target: https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale
+    :target: https://translation.odoo-community.org/projects/margin-analysis-17-0/margin-analysis-17-0-account_invoice_margin_sale
     :alt: Translate me on Weblate
 .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
-    :target: https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&target_branch=16.0
+    :target: https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&target_branch=17.0
     :alt: Try me on Runboat
 
 |badge1| |badge2| |badge3| |badge4| |badge5|
 
-This module propagates purchase price from sale order line to invoice and discards the
-invoice lines coming from sale order lines with down-payment when computing the margin.
+This module propagates purchase price from sale order line to invoice
+and discards the invoice lines coming from sale order lines with
+down-payment when computing the margin.
 
 **Table of contents**
 
@@ -46,7 +47,7 @@ Usage
 
 This module also needs a security group to show margins.
 
-#. To activate it go to user and active "Show Invoice Margin" in
+1. To activate it go to user and active "Show Invoice Margin" in
    security options.
 
 Bug Tracker
@@ -55,7 +56,7 @@ Bug Tracker
 Bugs are tracked on `GitHub Issues <https://github.com/OCA/margin-analysis/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 <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
+`feedback <https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
 
 Do not contact contributors directly about support or help with technical issues.
 
@@ -63,30 +64,30 @@ Credits
 =======
 
 Authors
-~~~~~~~
+-------
 
 * Tecnativa
 
 Contributors
-~~~~~~~~~~~~
+------------
 
-* `Tecnativa <https://www.tecnativa.com>`__:
+-  `Tecnativa <https://www.tecnativa.com>`__:
 
-  * Sergio Teruel
-  * Carlos Dauden
-  * Víctor Martínez
+   -  Sergio Teruel
+   -  Carlos Dauden
+   -  Víctor Martínez
 
-* `Open Source Integrators <https://www.opensourceintegrators.com>`__:
+-  `Open Source Integrators <https://www.opensourceintegrators.com>`__:
 
-  * Bhavesh Odedra
-  * Daniel Reis <dreis@opensourceintegrators.com>
+   -  Bhavesh Odedra
+   -  Daniel Reis <dreis@opensourceintegrators.com>
 
-* `Factor Libre <https://www.factorlibre.com>`__:
+-  `Factor Libre <https://www.factorlibre.com>`__:
 
-  * Luis J. Salvatierra
+   -  Luis J. Salvatierra
 
 Maintainers
-~~~~~~~~~~~
+-----------
 
 This module is maintained by the OCA.
 
@@ -109,6 +110,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
 
 |maintainer-sergio-teruel| |maintainer-carlosdauden| 
 
-This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale>`_ project on GitHub.
+This module is part of the `OCA/margin-analysis <https://github.com/OCA/margin-analysis/tree/17.0/account_invoice_margin_sale>`_ project on GitHub.
 
 You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/account_invoice_margin_sale/pyproject.toml b/account_invoice_margin_sale/pyproject.toml
new file mode 100644
index 000000000..4231d0ccc
--- /dev/null
+++ b/account_invoice_margin_sale/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["whool"]
+build-backend = "whool.buildapi"
diff --git a/account_invoice_margin_sale/readme/CONTRIBUTORS.md b/account_invoice_margin_sale/readme/CONTRIBUTORS.md
new file mode 100644
index 000000000..c13ca34c2
--- /dev/null
+++ b/account_invoice_margin_sale/readme/CONTRIBUTORS.md
@@ -0,0 +1,9 @@
+- [Tecnativa](https://www.tecnativa.com):
+  - Sergio Teruel
+  - Carlos Dauden
+  - Víctor Martínez
+- [Open Source Integrators](https://www.opensourceintegrators.com):
+  - Bhavesh Odedra
+  - Daniel Reis \<<dreis@opensourceintegrators.com>\>
+- [Factor Libre](https://www.factorlibre.com):
+  - Luis J. Salvatierra
diff --git a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst b/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
deleted file mode 100644
index 79af01f4e..000000000
--- a/account_invoice_margin_sale/readme/CONTRIBUTORS.rst
+++ /dev/null
@@ -1,14 +0,0 @@
-* `Tecnativa <https://www.tecnativa.com>`__:
-
-  * Sergio Teruel
-  * Carlos Dauden
-  * Víctor Martínez
-
-* `Open Source Integrators <https://www.opensourceintegrators.com>`__:
-
-  * Bhavesh Odedra
-  * Daniel Reis <dreis@opensourceintegrators.com>
-
-* `Factor Libre <https://www.factorlibre.com>`__:
-
-  * Luis J. Salvatierra
diff --git a/account_invoice_margin_sale/readme/DESCRIPTION.md b/account_invoice_margin_sale/readme/DESCRIPTION.md
new file mode 100644
index 000000000..c04ef5301
--- /dev/null
+++ b/account_invoice_margin_sale/readme/DESCRIPTION.md
@@ -0,0 +1,3 @@
+This module propagates purchase price from sale order line to invoice
+and discards the invoice lines coming from sale order lines with
+down-payment when computing the margin.
diff --git a/account_invoice_margin_sale/readme/DESCRIPTION.rst b/account_invoice_margin_sale/readme/DESCRIPTION.rst
deleted file mode 100644
index f798a9caa..000000000
--- a/account_invoice_margin_sale/readme/DESCRIPTION.rst
+++ /dev/null
@@ -1,2 +0,0 @@
-This module propagates purchase price from sale order line to invoice and discards the
-invoice lines coming from sale order lines with down-payment when computing the margin.
diff --git a/account_invoice_margin_sale/readme/INSTALL.rst b/account_invoice_margin_sale/readme/INSTALL.md
similarity index 100%
rename from account_invoice_margin_sale/readme/INSTALL.rst
rename to account_invoice_margin_sale/readme/INSTALL.md
diff --git a/account_invoice_margin_sale/readme/USAGE.md b/account_invoice_margin_sale/readme/USAGE.md
new file mode 100644
index 000000000..422be6bbb
--- /dev/null
+++ b/account_invoice_margin_sale/readme/USAGE.md
@@ -0,0 +1,4 @@
+This module also needs a security group to show margins.
+
+1.  To activate it go to user and active "Show Invoice Margin" in
+    security options.
diff --git a/account_invoice_margin_sale/readme/USAGE.rst b/account_invoice_margin_sale/readme/USAGE.rst
deleted file mode 100644
index 51b56a21d..000000000
--- a/account_invoice_margin_sale/readme/USAGE.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-This module also needs a security group to show margins.
-
-#. To activate it go to user and active "Show Invoice Margin" in
-   security options.
diff --git a/account_invoice_margin_sale/static/description/index.html b/account_invoice_margin_sale/static/description/index.html
index abb6d18af..11eb559dd 100644
--- a/account_invoice_margin_sale/static/description/index.html
+++ b/account_invoice_margin_sale/static/description/index.html
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
@@ -368,9 +369,10 @@ <h1 class="title">Account Invoice Margin Sale</h1>
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !! source digest: sha256:7e9e8ecc5cfc7eb80aaf4fc2b4d408409b3474c6a584f2e18c2cc6145c648807
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/margin-analysis-16-0/margin-analysis-16-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
-<p>This module propagates purchase price from sale order line to invoice and discards the
-invoice lines coming from sale order lines with down-payment when computing the margin.</p>
+<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/margin-analysis/tree/17.0/account_invoice_margin_sale"><img alt="OCA/margin-analysis" src="https://img.shields.io/badge/github-OCA%2Fmargin--analysis-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/margin-analysis-17-0/margin-analysis-17-0-account_invoice_margin_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/margin-analysis&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
+<p>This module propagates purchase price from sale order line to invoice
+and discards the invoice lines coming from sale order lines with
+down-payment when computing the margin.</p>
 <p><strong>Table of contents</strong></p>
 <div class="contents local topic" id="contents">
 <ul class="simple">
@@ -402,7 +404,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
 <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/margin-analysis/issues">GitHub Issues</a>.
 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
-<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
+<a class="reference external" href="https://github.com/OCA/margin-analysis/issues/new?body=module:%20account_invoice_margin_sale%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
 <p>Do not contact contributors directly about support or help with technical issues.</p>
 </div>
 <div class="section" id="credits">
@@ -442,7 +444,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
 promote its widespread use.</p>
 <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
 <p><a class="reference external image-reference" href="https://github.com/sergio-teruel"><img alt="sergio-teruel" src="https://github.com/sergio-teruel.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a></p>
-<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/16.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
+<p>This module is part of the <a class="reference external" href="https://github.com/OCA/margin-analysis/tree/17.0/account_invoice_margin_sale">OCA/margin-analysis</a> project on GitHub.</p>
 <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
 </div>
 </div>
diff --git a/pandoc-3.1.12.1-x86_64-macOS.pkg b/pandoc-3.1.12.1-x86_64-macOS.pkg
new file mode 100644
index 0000000000000000000000000000000000000000..61f409162f2e469b03eb73199a36b6c3dd72b450
GIT binary patch

From 99c95e48f0c67f9a833a260d80e4d003ede27599 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nedas=20=C5=BDilinskas?= <nedas.zilinskas@avoin.systems>
Date: Mon, 19 Feb 2024 18:29:39 +0200
Subject: [PATCH 26/26] [MIG] account_invoice_margin_sale: Migration to 17.0

---
 account_invoice_margin_sale/__manifest__.py        | 2 +-
 account_invoice_margin_sale/readme/CONTRIBUTORS.md | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/account_invoice_margin_sale/__manifest__.py b/account_invoice_margin_sale/__manifest__.py
index e701b5d15..0c2cfc80d 100644
--- a/account_invoice_margin_sale/__manifest__.py
+++ b/account_invoice_margin_sale/__manifest__.py
@@ -5,7 +5,7 @@
 {
     "name": "Account Invoice Margin Sale",
     "summary": "Set margin in invoices from sale orders",
-    "version": "16.0.1.0.2",
+    "version": "17.0.1.0.0",
     "development_status": "Production/Stable",
     "maintainers": ["sergio-teruel", "carlosdauden"],
     "category": "Account",
diff --git a/account_invoice_margin_sale/readme/CONTRIBUTORS.md b/account_invoice_margin_sale/readme/CONTRIBUTORS.md
index c13ca34c2..9aeaf9f05 100644
--- a/account_invoice_margin_sale/readme/CONTRIBUTORS.md
+++ b/account_invoice_margin_sale/readme/CONTRIBUTORS.md
@@ -7,3 +7,5 @@
   - Daniel Reis \<<dreis@opensourceintegrators.com>\>
 - [Factor Libre](https://www.factorlibre.com):
   - Luis J. Salvatierra
+- [Avoin.Systems](https://avoin.systems/):
+  - Nedas Żilinskas
