Skip to content

Commit

Permalink
Rename module name and field name
Browse files Browse the repository at this point in the history
  • Loading branch information
kanda999 committed Dec 28, 2022
1 parent 078417b commit 0476492
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
================
Product ESC Code
================
========================
Product Alternative Code
========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
Expand All @@ -14,13 +14,14 @@ Product ESC Code
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-qrtl%2Faxls--custom-lightgray.png?logo=github
:target: https://github.com/qrtl/axls-custom/tree/16.0/product_esc_code
:target: https://github.com/qrtl/axls-custom/tree/16.0/product_alternative_code
:alt: qrtl/axls-custom

|badge1| |badge2| |badge3|

This module does the following:
- Give the product an ESC code so that it can be searched by ESC code.

* Adds the alternative code field to the product, which should be part of the product display name presentation and can also be used in product search.

**Table of contents**

Expand All @@ -33,7 +34,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/qrtl/axls-custom/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/qrtl/axls-custom/issues/new?body=module:%20product_esc_code%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/qrtl/axls-custom/issues/new?body=module:%20product_alternative_code%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.

Expand All @@ -48,6 +49,6 @@ Authors
Maintainers
~~~~~~~~~~~

This module is part of the `qrtl/axls-custom <https://github.com/qrtl/axls-custom/tree/16.0/product_esc_code>`_ project on GitHub.
This module is part of the `qrtl/axls-custom <https://github.com/qrtl/axls-custom/tree/16.0/product_alternative_code>`_ project on GitHub.

You are welcome to contribute.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2022 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Product ESC Code",
"name": "Product Alternative Code",
"version": "16.0.1.0.0",
"author": "Quartile Limited",
"website": "https://www.quartile.co",
Expand Down
38 changes: 38 additions & 0 deletions product_alternative_code/i18n/ja.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_alternative_code
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-28 08:47+0000\n"
"PO-Revision-Date: 2022-12-28 08:47+0000\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: product_alternative_code
#: model:ir.model.fields,field_description:product_alternative_code.field_product_product__alt_code
#: model:ir.model.fields,field_description:product_alternative_code.field_product_template__alt_code
msgid "Alternative Code"
msgstr "オルタナティブコード"

#. module: product_alternative_code
#: model:ir.model.fields,help:product_alternative_code.field_product_product__alt_code
#: model:ir.model.fields,help:product_alternative_code.field_product_template__alt_code
msgid "Alternative product code."
msgstr "別のプロダクトコード"

#. module: product_alternative_code
#: model:ir.model,name:product_alternative_code.model_product_template
msgid "Product"
msgstr "プロダクト"

#. module: product_alternative_code
#: model:ir.model,name:product_alternative_code.model_product_product
msgid "Product Variant"
msgstr "プロダクトバリアント"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
# Copyright 2022 Quartile Limited
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

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


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

esc_code = fields.Char(related="product_tmpl_id.esc_code")

def name_get(self):
res = super().name_get()
name_list = []
for rec in res:
product = self.browse(rec[0])
esc_code = product.esc_code
if not esc_code:
alt_code = product.alt_code
if not alt_code:
name_list.append(rec)
continue
name = rec[1]
if not product.default_code:
name = "[" + esc_code + "] " + name
name = "[" + alt_code + "] " + name
name_list.append((rec[0], name))
continue
pos = name.find("]")
name = name[:pos] + "/" + esc_code + name[pos:]
name = name[:pos] + "/" + alt_code + name[pos:]
name_list.append((rec[0], name))
return name_list

Expand All @@ -38,7 +36,7 @@ def _name_search(
"|",
"|",
("name", operator, name),
("esc_code", operator, name),
("alt_code", operator, name),
("default_code", operator, name),
]
product_ids = self._search(args, limit=limit, access_rights_uid=name_get_uid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
class ProductTemplate(models.Model):
_inherit = "product.template"

esc_code = fields.Char()
alt_code = fields.Char("Alternative Code", help="Alternative product code.")
3 changes: 3 additions & 0 deletions product_alternative_code/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module does the following:

* Adds the alternative code field to the product, which should be part of the product display name presentation and can also be used in product search.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Product ESC Code</title>
<title>Product Alternative Code</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,16 +360,18 @@
</style>
</head>
<body>
<div class="document" id="product-esc-code">
<h1 class="title">Product ESC Code</h1>
<div class="document" id="product-alternative-code">
<h1 class="title">Product Alternative Code</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="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/qrtl/axls-custom/tree/16.0/product_esc_code"><img alt="qrtl/axls-custom" src="https://img.shields.io/badge/github-qrtl%2Faxls--custom-lightgray.png?logo=github" /></a></p>
<p>This module does the following:
- Give the product an ESC code so that it can be searched by ESC code.</p>
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/qrtl/axls-custom/tree/16.0/product_alternative_code"><img alt="qrtl/axls-custom" src="https://img.shields.io/badge/github-qrtl%2Faxls--custom-lightgray.png?logo=github" /></a></p>
<p>This module does the following:</p>
<ul class="simple">
<li>Adds the alternative code field to the product, which should be part of the product display name presentation and can also be used in product search.</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -386,7 +388,7 @@ <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/qrtl/axls-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/qrtl/axls-custom/issues/new?body=module:%20product_esc_code%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/qrtl/axls-custom/issues/new?body=module:%20product_alternative_code%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">
Expand All @@ -399,7 +401,7 @@ <h2><a class="toc-backref" href="#id3">Authors</a></h2>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id4">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/qrtl/axls-custom/tree/16.0/product_esc_code">qrtl/axls-custom</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/qrtl/axls-custom/tree/16.0/product_alternative_code">qrtl/axls-custom</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<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="esc_code" />
<field name="alt_code" optional="show" />
</xpath>
</field>
</record>
Expand All @@ -16,7 +16,7 @@
<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="esc_code" />
<field name="alt_code" />
</xpath>
</field>
</record>
Expand Down
Empty file removed product_esc_code/i18n/ja.po
Empty file.
2 changes: 0 additions & 2 deletions product_esc_code/readme/DESCRIPTION.rst

This file was deleted.

File renamed without changes.
1 change: 0 additions & 1 deletion setup/product_esc_code/odoo/addons/product_esc_code

This file was deleted.

0 comments on commit 0476492

Please sign in to comment.