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 shivam pre commit issues fix #159

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
2 changes: 1 addition & 1 deletion g2p_enumerator/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ G2P Enumerator
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:925a4bc0a62b70aa19178851792a6a4900f707189dd64fbe37d9323cf52de1d7
!! source digest: sha256:0fdb0a254dfd3fc7fbb19e4eb7d6cde8ab7e54049dd55bc60618b0b41893d8bf
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
10 changes: 8 additions & 2 deletions g2p_enumerator/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@
"author": "OpenG2P",
"website": "https://openg2p.org",
"license": "Other OSI approved licence",
"depends": ["g2p_registry_group"],
"data": ["security/ir.model.access.csv", "views/g2p_enumerator_view.xml", "views/group_view.xml"],
"depends": ["g2p_registry_group", "base"],
"data": [
"security/ir.model.access.csv",
"data/sequence.xml",
"views/g2p_enumerator_view.xml",
"views/group_view.xml",
"views/registration_portal_view.xml",
],
"assets": {
"web.assets_frontend": [],
"web.assets_common": [],
Expand Down
10 changes: 10 additions & 0 deletions g2p_enumerator/data/sequence.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="seq_enumerator_code" model="ir.sequence">
<field name="name">EID</field>
<field name="code">enumeratorCode</field>
<field name="prefix">EID-</field>
<field name="padding">5</field>
<field name="company_id" eval="False" />
</record>
</odoo>
26 changes: 25 additions & 1 deletion g2p_enumerator/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Part of OpenG2P Registry. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
from odoo import api, fields, models


class G2PRegistrant(models.Model):
Expand All @@ -9,3 +9,27 @@ class G2PRegistrant(models.Model):
enumerator_user_id = fields.Char(related="enumerator_id.enumerator_user_id")

data_collection_date = fields.Date(related="enumerator_id.data_collection_date")

eid = fields.Char(string="EID", copy=False, readonly=True, index=True)
creator_eid = fields.Char(string="Creator's EID", compute="_compute_creator_eid")

@api.model
def create(self, vals):
if not vals.get("eid"):
vals["eid"] = "New"
res = super().create(vals)
if res.eid == "New" and res.supplier_rank > 0:
res.eid = res.generate_eid()
return res

def generate_eid(self):
return self.env["ir.sequence"].next_by_code("enumeratorCode") or "New"

@api.depends("create_uid")
def _compute_creator_eid(self):
for partner in self:
if partner.create_uid:
creator = partner.create_uid.partner_id
partner.creator_eid = creator.eid if creator else False
else:
partner.creator_eid = False
36 changes: 18 additions & 18 deletions g2p_enumerator/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>G2P Enumerator</title>
<style type="text/css">

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: gray; } /* line numbers */
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic, pre.problematic {
span.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -367,44 +367,44 @@ <h1 class="title">G2P Enumerator</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:925a4bc0a62b70aa19178851792a6a4900f707189dd64fbe37d9323cf52de1d7
!! source digest: sha256:0fdb0a254dfd3fc7fbb19e4eb7d6cde8ab7e54049dd55bc60618b0b41893d8bf
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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="https://github.com/OpenG2P/openg2p-registry/tree/17.0-develop/g2p_enumerator"><img alt="OpenG2P/openg2p-registry" src="https://img.shields.io/badge/github-OpenG2P%2Fopeng2p--registry-lightgray.png?logo=github" /></a></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="https://github.com/OpenG2P/openg2p-registry/tree/17.0-develop/g2p_enumerator"><img alt="OpenG2P/openg2p-registry" src="https://img.shields.io/badge/github-OpenG2P%2Fopeng2p--registry-lightgray.png?logo=github" /></a></p>
<p>G2P Enumerator</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OpenG2P/openg2p-registry/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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OpenG2P/openg2p-registry/issues/new?body=module:%20g2p_enumerator%0Aversion:%2017.0-develop%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">
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>OpenG2P</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<p><a class="reference external" href="https://openg2p.org">OpenG2P</a> donated the original code to the project.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/OpenG2P/openg2p-registry/tree/17.0-develop/g2p_enumerator">OpenG2P/openg2p-registry</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
Expand Down
3 changes: 1 addition & 2 deletions g2p_enumerator/views/g2p_enumerator_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
</tree>
</field>
</record>

<record id="view_enumerator_config_fomr" model="ir.ui.view">
<record id="view_enumerator_config_form" model="ir.ui.view">
<field name="name">view_enumerator_config_form</field>
<field name="model">g2p.enumerator</field>
<field name="arch" type="xml">
Expand Down
2 changes: 2 additions & 0 deletions g2p_enumerator/views/group_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<xpath expr="//page[@name='other']" position="after">
<page string="Enumerator Details" name="enumerator_details">
<group>
<field name="create_uid" string="Created by" readonly="1" />
<field name="creator_eid" string="Creator's EID" readonly="1" />
<field name="enumerator_id" string="Enumerator" />
<field name="enumerator_user_id" string="Enumerator User ID" />
<field name="data_collection_date" />
Expand Down
36 changes: 36 additions & 0 deletions g2p_enumerator/views/registration_portal_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<odoo>
<record id="view_res_partner_eid_form" model="ir.ui.view">
<field name="name">res.partner.eid.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="after">
<field name="eid" context="{'default_supplier_rank': active_id and active_id or 1}" />
</xpath>
</field>
</record>

<record id="view_res_partner_eid_tree" model="ir.ui.view">
<field name="name">res.partner.tree</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='display_name']" position="after">
<field name="eid" context="{'default_supplier_rank': active_id and active_id or 1}" />
</xpath>
</field>
</record>

<record id="view_groups_form_inherit_eid" model="ir.ui.view">
<field name="name">view.groups.form.inherit.eid</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="g2p_registry_group.view_groups_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='create_uid']" position="after">
<field name="creator_eid" readonly="1" />
</xpath>
</field>
</record>

</odoo>
<!-- invisible="context.get('default_supplier_rank') &lt; 1" -->
Loading