Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0] [MIG] product_supplier_ref: Migration to 17.0 #489

Closed
wants to merge 5 commits into from
Closed
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
4 changes: 2 additions & 2 deletions partner_lang_required/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Partner language required

|badge1| |badge2| |badge3|

This module convert the lang partner attribute to required by adding
arestriction to it
This module convert the lang partner attribute to required by adding a
restriction to it

**Table of contents**

Expand Down
4 changes: 2 additions & 2 deletions partner_lang_required/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ <h1 class="title">Partner language required</h1>
!! source digest: sha256:bad01f3c88a6cffe5a9db6fb5cbbeb1188bd600f8c28504b4547c3dd74ccce4d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/NuoBiT/odoo-addons/tree/17.0/partner_lang_required"><img alt="NuoBiT/odoo-addons" src="https://img.shields.io/badge/github-NuoBiT%2Fodoo--addons-lightgray.png?logo=github" /></a></p>
<p>This module convert the lang partner attribute to required by adding
arestriction to it</p>
<p>This module convert the lang partner attribute to required by adding a
restriction to it</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand Down
27 changes: 27 additions & 0 deletions product_supplier_ref/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

====================
Product Supplier Ref
====================

* Use the product name if the supplier product name is empty instead
of the product default_code.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/nuobit/odoo-addons/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.

Credits
=======

Contributors
------------

* `NuoBiT Solutions, S.L.`:
* Eric Antones <eantones@nuobit.com>
1 change: 1 addition & 0 deletions product_supplier_ref/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions product_supplier_ref/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright NuoBiT Solutions, S.L. (<https://www.nuobit.com>)
# Eric Antones <eantones@nuobit.com
# Bijaya Kumal <bkumal@nuobit.com >
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

{
"name": "Product Supplier Ref",
"summary": "Use the product name if the supplier product name is "
"empty instead of the product default_code.",
"version": "17.0.1.0.0",
"category": "Purchase",
"author": "NuoBiT Solutions SL",
"website": "https://github.com/NuoBiT/odoo-addons",
"license": "AGPL-3",
"depends": [
"product",
],
"data": [
"views/product_supplier_ref_views.xml",
],
"installable": True,
"application": False,
}
1 change: 1 addition & 0 deletions product_supplier_ref/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product
23 changes: 23 additions & 0 deletions product_supplier_ref/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright NuoBiT Solutions, S.L. (<https://www.nuobit.com>)
# Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import api, models


class ProductProduct(models.Model):
_inherit = "product.product"

@api.depends_context("partner_id")
def _compute_partner_ref(self):
super()._compute_partner_ref()
for product in self:
for supplier_info in product.seller_ids:
if supplier_info.name.id == product._context.get("partner_id"):
product_name = supplier_info.product_name or product.name
partner_ref_l = [product_name]
if product.code:
partner_ref_l.insert(0, "[%s] " % product.code)
product.partner_ref = " ".join(partner_ref_l)
break
return
3 changes: 3 additions & 0 deletions product_supplier_ref/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Binary file added product_supplier_ref/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions product_supplier_ref/views/product_supplier_ref_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_product_form_supplier_ref" model="ir.ui.view">
<field name="name">product.product.form.supplier.ref</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='default_code']" position="after">
<field name="partner_ref" string="Partner Reference"/>
</xpath>
</field>
</record>

<record id="view_product_tree_supplier_ref" model="ir.ui.view">
<field name="name">product.product.tree.supplier.ref</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='default_code']" position="after">
<field name="partner_ref" string="Partner Reference"/>
</xpath>
</field>
</record>
</odoo>
Loading