Skip to content

Commit

Permalink
Merge PR #2196 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Mar 6, 2024
2 parents 6ea3e2f + 63557f0 commit 7337feb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 30 deletions.
3 changes: 2 additions & 1 deletion purchase_requisition_grouped_by_procurement/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Purchase Requisition Grouped by Procurement
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e1486343ef6f45b9f4629199e69e67c315e822f2008036c9e81b16a7a3210b86
!! source digest: sha256:cdabbc9fea9e15624cd31c1d28f40a44da1319d0eeb03e5eb9de0cecdbdb5505
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -80,6 +80,7 @@ Contributors

* Víctor Martínez
* Pedro M. Baeza
* Sergio Teruel

Maintainers
~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,22 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
from odoo import api, models


class PurchaseRequisition(models.Model):
_inherit = "purchase.requisition"

group_id = fields.Many2one(comodel_name="procurement.group", string="Group")

def _prepare_tender_values(
self,
product_id,
product_qty,
product_uom,
location_id,
name,
origin,
company_id,
values,
):
res = super()._prepare_tender_values(
product_id,
product_qty,
product_uom,
location_id,
name,
origin,
company_id,
values,
)
res["group_id"] = values.get("group_id").id or False
return res

@api.model
def create(self, vals):
"""It is not possible to intercept _run_buy() to add lines instead of creating
multiple records.
This method is used to find if there is any previously created record with
the same values to add the line instead of creating a new record.
"""
if self.env.context.get("grouped_by_procurement") and vals.get("group_id"):
if self.env.context.get("grouped_by_procurement") and vals.get(
"procurement_group_id"
):
domain = []
for key in vals:
if key == "line_ids":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

* Víctor Martínez
* Pedro M. Baeza
* Sergio Teruel
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Purchase Requisition Grouped by Procurement</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e1486343ef6f45b9f4629199e69e67c315e822f2008036c9e81b16a7a3210b86
!! source digest: sha256:cdabbc9fea9e15624cd31c1d28f40a44da1319d0eeb03e5eb9de0cecdbdb5505
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/OCA/purchase-workflow/tree/15.0/purchase_requisition_grouped_by_procurement"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_requisition_grouped_by_procurement"><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/purchase-workflow&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to group procurements in the same purchase requisitions according to procurement group.</p>
Expand Down Expand Up @@ -427,6 +427,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Víctor Martínez</li>
<li>Pedro M. Baeza</li>
<li>Sergio Teruel</li>
</ul>
</li>
</ul>
Expand Down

0 comments on commit 7337feb

Please sign in to comment.