Author: |
GRAP |
License: |
AGPL-3 |
Branch: |
12.0-REF-replace-purchase_package_qty-by-product_supplierinfo_qty_multiplier |
Repository: |
legalsylvain/grap-odoo-custom |
Dependencies: |
base_product_mass_addition,
onchange_helper,
product_supplierinfo_qty_multiplier,
purchase_discount,
purchase_quick,
and
purchase_triple_discount |
Languages: |
PO File (40, 15.7%),
Python (119, 46.7%),
XML (35, 13.7%),
and
reStructuredText (61, 23.9%) |
Other branches: |
12.0-ADD-NEW-FEATURE-1,
12.0-ADD-account_move-taxes,
12.0-ADD-demo-file,
12.0-ADD-grap-change-views,
12.0-ADD-grap_change_default,
12.0-ADD-grap_change_views_account-account-tax-group-active,
12.0-ADD-grap_change_views_account-action_post_no_check,
12.0-ADD-grap_change_views_product-display-price-surcharge-margin-classification,
12.0-ADD-grap_change_views_project,
12.0-ADD-grap_cooperative-leads,
12.0-ADD-grap_custom_import,
12.0-ADD-grap_grap_change_base_product_mass_addition,
12.0-ADD-grap_must_have,
12.0-ADD-product-admin-view,
12.0-ADD-stock_fix_stock_move_line,
12.0-ADD-stock_merge_quant,
12.0-CAAP-hide-delivery-product,
12.0-CI-FIX-flake-gitlab-github,
12.0-DISABLE-delivery-product,
12.0-DISABLE-mail-systray,
12.0-FIX-VARIOUS-invoicing-policy,
12.0-FIX-accounting-menu-basic-users,
12.0-FIX-copier,
12.0-FIX-display-tax-account-invoice-customer,
12.0-FIX-eshop-allow-unlink-sale-order,
12.0-FIX-grap_change_access-allow-user-to-unreconcile-and-access-fiscal-year,
12.0-FIX-grap_change_access-dependency,
12.0-FIX-grap_change_access-restaurant-models,
12.0-FIX-grap_change_base_product_mass_addition-correct-name,
12.0-FIX-grap_change_base_product_mass_addition-purchase-order-line-name,
12.0-FIX-grap_change_base_product_mass_addition-return-if-not-context,
12.0-FIX-grap_change_data-product-category,
12.0-FIX-grap_change_data-uom-translation,
12.0-FIX-grap_change_data-uom_uom,
12.0-FIX-grap_change_views-bad-menuitem-names,
12.0-FIX-grap_change_views_account,
12.0-FIX-grap_change_views_account-dont-duplicate-partner-field-invoice-tree,
12.0-FIX-grap_change_views_account-duplicated-field-company-on-supplier-invoice-tree-view,
12.0-FIX-grap_change_views_account-rem_company_id-invoice-tree,
12.0-FIX-grap_change_views_account_domain,
12.0-FIX-grap_change_views_pos-available_in_pos-default-true,
12.0-FIX-grap_change_views_pos-fix-search-customer-buttons,
12.0-FIX-grap_change_views_pos-hide-bad-translated-balance-field,
12.0-FIX-grap_change_views_product-lst_price-null-if_product_food,
12.0-FIX-grap_change_views_product-replace-list_price-by-lst_price,
12.0-FIX-grap_cooperative-naming-interlocutors,
12.0-FIX-grap_cooperative-priority-editable-view,
12.0-FIX-grap_qweb_report-correct-rib-on-main-layout,
12.0-FIX-grap_qweb_report-display-vat-detail-no-vat,
12.0-FIX-grap_theme_web_favorite,
12.0-FIX-minor-grap_change_views,
12.0-FIX-mrp_business-remove-constant-field,
12.0-FIX-mrp_food-compute_sudo-for-not-accessible-fields,
12.0-FIX-product_access-for-non-admin,
12.0-FIX-product_main_supplier-remove-useless-fields,
12.0-FIX-purchase-date_planned-required,
12.0-FIX-remove-useless-product-menu,
12.0-FIX-sale-todo-and-hide-pos-cash-rounding,
12.0-FIX-sale_order_form,
12.0-FIX-save-readonly-taxes-fields,
12.0-FIX-server_environment_files-prod-folder,
12.0-FIX-supplierinfo-access,
12.0-FIX-use-correct-invoice-mail-template,
12.0-FIX-various,
12.0-FIX-various-fixes-joint-buying,
12.0-IMP-LOG-various,
12.0-IMP-TIME-remove-sales_count,
12.0-IMP-barcode-nomenclature-access,
12.0-IMP-cest-la-rentree-2021,
12.0-IMP-grap_change_access-access-for-sale_order_template,
12.0-IMP-grap_change_access-limit-access-for-res-country-and-co,
12.0-IMP-grap_change_base_product_mass_addition,
12.0-IMP-grap_change_default-pos-config,
12.0-IMP-grap_change_views_account-default-value-account_subsequence_method,
12.0-IMP-grap_change_views_account-journal-tree-view-add-code,
12.0-IMP-grap_change_views_base-action-and-module-view,
12.0-IMP-grap_change_views_base-and-partner-hide-partner-triple-discount,
12.0-IMP-grap_change_views_base-menu-sql_export,
12.0-IMP-grap_change_views_base-show-disabled-sequence-tree-view,
12.0-IMP-grap_change_views_partner-payment-term-inline-editable,
12.0-IMP-grap_change_views_pos-clean-pos-order-line-tree-view,
12.0-IMP-grap_change_views_pos-disable_switch_user,
12.0-IMP-grap_change_views_pos-front-end-visibility,
12.0-IMP-grap_change_views_pos-reduce-space-between-order-parts,
12.0-IMP-grap_change_views_pos-responsive-width,
12.0-IMP-grap_change_views_pos-search-box,
12.0-IMP-grap_change_views_product-adapt-pos_customer_wallet,
12.0-IMP-grap_change_views_product-adapt-product_uom_po_domain,
12.0-IMP-grap_change_views_product-add-update-button-joint-buying,
12.0-IMP-grap_change_views_product-margin-features,
12.0-IMP-grap_change_views_product-restore_chatter_track_list_price,
12.0-IMP-grap_change_views_project-add-project-project-description,
12.0-IMP-grap_change_views_purchase-display-fiscal-position-purchase-order,
12.0-IMP-grap_change_views_purchase-purchase_method-onchange,
12.0-IMP-grap_change_views_sale-access-user_id,
12.0-IMP-grap_change_views_stock-product_uom_id-readonly,
12.0-IMP-grap_change_views_xxx-track-fiscal-position,
12.0-IMP-grap_cooperative-add-company-code-directory-kanban-view,
12.0-IMP-grap_cooperative-add-web_view_leaflet_map,
12.0-IMP-grap_must_have,
12.0-IMP-grap_qweb_report-adapt-pos_customer_wallet,
12.0-IMP-grap_qweb_report-customer-pricelist-no-trunked,
12.0-IMP-grap_qweb_report-possibility-add-custom-message,
12.0-IMP-grap_theme-improve-space-revert-border,
12.0-IMP-increase-limit-in-main-views-with-lines,
12.0-IMP-mrp_food-FEATURE-d,
12.0-IMP-project-various-improvment-planned-hours,
12.0-IMP-various-improvment-grap_change_views_xxx,
12.0-META-CI-reduce-execution,
12.0-REF-CI-use-github-actions,
12.0-REF-clean-oca_dependencies,
12.0-REF-company-code,
12.0-REF-grap_change_access-simplify-no-pos-restaurant-group,
12.0-REF-grap_change_default-compatibility-joint_buying,
12.0-REF-grap_change_translation-REM-crm,
12.0-REF-grap_change_views_partner-split-partner-inline-editable-views,
12.0-REF-grap_change_views_product-recurring_consignment-single-vat,
12.0-REF-improve-grap-theme,
12.0-REF-pin-ubuntu-20-pre-commit-test,
12.0-REF-pre-commit,
12.0-REF-try-use-copier,
12.0-REF-website-in-manifest,
12.0-REM-grap_change_default-native-uom-product-onchange,
12.0-REM-grap_change_ir_values,
12.0-REM-grap_change_views_base-obsolete-view,
12.0-REM-ref-to-stock_picking_report_summary,
12.0-TEST-CI,
12.0-finish-purchase-standard-price-precision,
12.0-grap_change_default-product-product-type,
12.0-grap_change_precision-dont-change-margin-type,
12.0-grap_change_translation,
12.0-grap_change_views_account-account_invoice_overdue_reminder,
12.0-grap_change_views_account-add-base-tax_line_ids,
12.0-grap_change_views_account-display-debug-info,
12.0-grap_change_views_account-hide-or-display-report-menu,
12.0-grap_change_views_pos-closing-date-for-cash-move-statement,
12.0-grap_change_views_product,
12.0-grap_change_views_product-alcohol,
12.0-grap_change_views_product-bis,
12.0-grap_change_views_product-depends-on-product_pricelist_margin,
12.0-grap_change_views_product-joint-buying-tree-view,
12.0-grap_change_views_product-pos_tare_weight,
12.0-grap_change_views_product-product_simple_pricelist-IMP-ADD-group-to-edit-dates,
12.0-grap_change_views_product-scale_group_id-selection,
12.0-grap_cooperative-editable-tree-view,
12.0-grap_qweb_report-invoice-pdf-name,
12.0-grap_theme-remove-dependency,
12.0_imp_grap_no_rfq,
and
grap_change_views_product-default-code-not-readonly-for-joint-buying |
Other repositories: |
grap/grap-odoo-custom,
and
quentinDupont/grap-odoo-custom |
<h1 class="title">GRAP - Change Base Product Mass Addition</h1>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/grap/grap-odoo-custom/tree/12.0/grap_change_base_product_mass_addition"><img alt="grap/grap-odoo-custom" src="https://img.shields.io/badge/github-grap%2Fgrap--odoo--custom-lightgray.png?logo=github" /></a></p>
<p>This module is a patch module, that overwrite the function <code>_inverse_set_process_qty</code>
of the model <code>product.product</code> of the module <code>base_product_mass_addition</code>.</p>
<p>It avoid to call the function <code>odoo.tests.Form</code> that is very slow, and that is making
the module <code>purchase_quick</code> unusable.</p>
<p><strong>Benchmark on a Production database, run locally</strong>
Without this module, for a purchase, calling <code>_inverse_set_process_qty</code> takes
- 12.469824 seconds (for a create)
- 13.837742 seconds (for an update)</p>
<p>With this module, the same call takes
- 0.121779 seconds (for a create)
- 0.110520 seconds (for an update)</p>
<p><strong>Benchmark on a Demo database, run locally</strong></p>
<p>Test Code show that time is divided by 12.</p>
<pre>
<code lang="python">import timeit
def test():
orders = env["purchase.order"].search([("partner_id", "=", env.ref("base.res_partner_1").id)])
for line in orders.mapped("order_line"):
product = line.product_id.with_context(parent_model="purchase.order", parent_id=line.order_id.id)
product.qty_to_process = line.product_qty * 2</code>
</pre>
<p>Without this module :</p>
<pre>
<code lang="python">>>> timeit.timeit(test, number=50)
70.18318000599902</code>
</pre>
<p>With this module :</p>
<pre>
<code lang="python">>>> timeit.timeit(test, number=50)
5.822203948999231</code>
</pre>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#known-issues-roadmap" id="id1">Known issues / Roadmap</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>
<a name="known-issues-roadmap"></a>
<h2><a class="toc-backref" href="#id1">Known issues / Roadmap</a></h2>
<ul class="simple">
<li>make the same work. (the <code>if parent_model == "purchase_order"</code>) for
the module <code>stock_picking_quick</code>. (if used)</li>
</ul>
<a name="bug-tracker"></a>
<h2><a class="toc-backref" href="#id2">Bug Tracker</a></h2>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/grap/grap-odoo-custom/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/grap/grap-odoo-custom/issues/new?body=module:%20grap_change_base_product_mass_addition%0Aversion:%2012.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>
<a name="credits"></a>
<h2><a class="toc-backref" href="#id3">Credits</a></h2>
<a name="authors"></a>
<h3><a class="toc-backref" href="#id4">Authors</a></h3>
<ul class="simple">
<li>GRAP</li>
</ul>
<a name="contributors"></a>
<h3><a class="toc-backref" href="#id5">Contributors</a></h3>
<ul class="simple">
<li>Sylvain LE GAL (<a class="reference external" href="https://www.twitter.com/legalsylvain">https://www.twitter.com/legalsylvain</a>)</li>
</ul>
<a name="maintainers"></a>
<h3><a class="toc-backref" href="#id6">Maintainers</a></h3>
<p>This module is part of the <a class="reference external" href="https://github.com/grap/grap-odoo-custom/tree/12.0/grap_change_base_product_mass_addition">grap/grap-odoo-custom</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>