Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions sale_purchase_force_vendor/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ To configure this module, you need to:
5. Go to *Sale -> Products -> Products*.
6. Create a new product with the following options:

- [Puchase tab] \`Vendors\`: Set different vendors (Vendor A + Vendor
B).
- [Iventory tab] \`Routes\`: Buy and MTO
- [Puchase tab] \`Vendors\`: Set different vendors (Vendor A +
Vendor B).
- [Iventory tab] \`Routes\`: Buy and MTO

Usage
=====

1. Go to *Sale -> Orders -> Quotations* and create a new Quotation.
2. Create a new line with the following options:

- \`Route\`: MTO.
- \`Vendor\`: Vendor B.
- \`Route\`: MTO.
- \`Vendor\`: Vendor B.

3. Confirm sale order.
4. A new purchase order will have been created to Vendor B.
Expand Down Expand Up @@ -91,10 +91,10 @@ Authors
Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

- Víctor Martínez
- Pedro M. Baeza
- Víctor Martínez
- Pedro M. Baeza

Maintainers
-----------
Expand Down
1 change: 1 addition & 0 deletions sale_purchase_force_vendor/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from . import report
1 change: 1 addition & 0 deletions sale_purchase_force_vendor/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"data": [
"views/res_config_settings_view.xml",
"views/sale_order_view.xml",
"report/sale_report_views.xml",
],
"maintainers": ["victoralmau"],
}
1 change: 1 addition & 0 deletions sale_purchase_force_vendor/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_report
24 changes: 24 additions & 0 deletions sale_purchase_force_vendor/report/sale_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2026 Tecnativa - Víctor Martínez
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import fields, models


class SaleReport(models.Model):
_inherit = "sale.report"

vendor_id = fields.Many2one(
comodel_name="res.partner",
string="Vendor",
readonly=True,
)

def _select_additional_fields(self):
res = super()._select_additional_fields()
res["vendor_id"] = "l.vendor_id"
return res

def _group_by_sale(self):
group_by = super()._group_by_sale()
group_by += ", l.vendor_id"
return group_by
20 changes: 20 additions & 0 deletions sale_purchase_force_vendor/report/sale_report_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_order_product_search" model="ir.ui.view">
<field name="name">sale.report.search</field>
<field name="model">sale.report</field>
<field name="inherit_id" ref="sale.view_order_product_search" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="vendor_id" />
</field>
<filter name="Customer" position="after">
<filter
string="Vendor"
name="vendor"
context="{'group_by':'vendor_id'}"
/>
</filter>
</field>
</record>
</odoo>
4 changes: 2 additions & 2 deletions sale_purchase_force_vendor/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
“Unarchived” MTO route.</li>
<li>Go to <em>Sale -&gt; Products -&gt; Products</em>.</li>
<li>Create a new product with the following options:<ul>
<li>[Puchase tab] `Vendors`: Set different vendors (Vendor A + Vendor
B).</li>
<li>[Puchase tab] `Vendors`: Set different vendors (Vendor A +
Vendor B).</li>
<li>[Iventory tab] `Routes`: Buy and MTO</li>
</ul>
</li>
Expand Down
14 changes: 14 additions & 0 deletions sale_purchase_force_vendor/views/sale_order_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,18 @@
</xpath>
</field>
</record>
<record id="view_sales_order_filter" model="ir.ui.view">
<field name="name">sale.order.list.select</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter" />
<field name="arch" type="xml">
<field name="order_line" position="after">
<field
name="order_line"
string="Vendor"
filter_domain="[('order_line.vendor_id', 'ilike', self)]"
/>
</field>
</field>
</record>
</odoo>