15 changed files with 263 additions and 0 deletions
			
			
		@ -0,0 +1,38 @@ | 
				
			|||||
 | 
					Customer Sequence v11 | 
				
			||||
 | 
					===================== | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					This module will give a unique code to each customer and supplier. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Configuration | 
				
			||||
 | 
					============= | 
				
			||||
 | 
					You should configure the company form for the proper working of this module. | 
				
			||||
 | 
					The supplier code will start from 0000,0001,.. and customer code start from the number you give in the company form | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Further information | 
				
			||||
 | 
					=================== | 
				
			||||
 | 
					I added a security file which gives access res.company for all users. | 
				
			||||
 | 
					if you not configure the company form then the customer code start with 1,2,..and supplier code always start with 0001,0002,.. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Installation | 
				
			||||
 | 
					============ | 
				
			||||
 | 
					- www.odoo.com/documentation/11.0/setup/install.html | 
				
			||||
 | 
					- Install our custom addon | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Bug Tracker | 
				
			||||
 | 
					=========== | 
				
			||||
 | 
					Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Credits | 
				
			||||
 | 
					======= | 
				
			||||
 | 
					Cybrosys Techno Solutions | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Author | 
				
			||||
 | 
					====== | 
				
			||||
 | 
					* Cybrosys Techno Solutions <https://www.cybrosys.com> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Maintainer | 
				
			||||
 | 
					---------- | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					This module is maintained by Cybrosys Technologies. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					For support and more information, please visit https://www.cybrosys.com. | 
				
			||||
@ -0,0 +1,3 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					from . import models | 
				
			||||
@ -0,0 +1,45 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					#    Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    you can modify it under the terms of the GNU LESSER | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    It is forbidden to publish, distribute, sublicense, or sell copies | 
				
			||||
 | 
					#    of the Software or modified copies of the Software. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    This program is distributed in the hope that it will be useful, | 
				
			||||
 | 
					#    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			||||
 | 
					#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			||||
 | 
					#    GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (LGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################## | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    'name': "Customer Sequence", | 
				
			||||
 | 
					    'version': '11.0.1.0.0', | 
				
			||||
 | 
					    'summary': """Unique Customer Code""", | 
				
			||||
 | 
					    'description': """ | 
				
			||||
 | 
					       Each customer have unique number code | 
				
			||||
 | 
					    """, | 
				
			||||
 | 
					    'author': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'company': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'website': "https://cybrosys.com/", | 
				
			||||
 | 
					    'category': 'Sales', | 
				
			||||
 | 
					    'depends': ['sale'], | 
				
			||||
 | 
					    'data': [ | 
				
			||||
 | 
					        'views/res_partner_fom.xml', | 
				
			||||
 | 
					        'views/res_company.xml', | 
				
			||||
 | 
					        'security/ir.model.access.csv', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'demo': [], | 
				
			||||
 | 
					    'images': ['static/description/banner.jpg'], | 
				
			||||
 | 
					    'license': 'LGPL-3', | 
				
			||||
 | 
					    'installable': True, | 
				
			||||
 | 
					    'application': False | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,4 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					from . import res_company | 
				
			||||
 | 
					from . import res_partner | 
				
			||||
@ -0,0 +1,11 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					from odoo import models, fields | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class CompanySequence(models.Model): | 
				
			||||
 | 
					    _inherit = 'res.company' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    customer_code = fields.Integer(string='Customer code', required=True) | 
				
			||||
 | 
					    supp_code = fields.Integer(string='Supplier code') | 
				
			||||
 | 
					    next_code = fields.Integer(string='Next code') | 
				
			||||
@ -0,0 +1,45 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					from odoo import models, fields, api | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class ResPartner(models.Model): | 
				
			||||
 | 
					    _inherit = 'res.partner' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    unique_id = fields.Char(string='Unique Id', help="The Unique Sequence no", readonly=True, default='/') | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.model | 
				
			||||
 | 
					    def create(self, values): | 
				
			||||
 | 
					        res = super(ResPartner, self).create(values) | 
				
			||||
 | 
					        company_seq = self.env['res.users'].browse(self._uid).company_id | 
				
			||||
 | 
					        if res.customer and res.unique_id == '/': | 
				
			||||
 | 
					            if company_seq.next_code: | 
				
			||||
 | 
					                res.unique_id = company_seq.next_code | 
				
			||||
 | 
					                res.name = '[' + str(company_seq.next_code) + ']' + str(res.name) | 
				
			||||
 | 
					                company_seq.write({'next_code': company_seq.next_code + 1}) | 
				
			||||
 | 
					            else: | 
				
			||||
 | 
					                res.unique_id = company_seq.customer_code | 
				
			||||
 | 
					                res.name = '[' + str(company_seq.customer_code) + ']' + str(res.name) | 
				
			||||
 | 
					                company_seq.write({'next_code': company_seq.customer_code + 1}) | 
				
			||||
 | 
					        if res.supplier == True and res.unique_id == '/': | 
				
			||||
 | 
					            if company_seq.supp_code < 10: | 
				
			||||
 | 
					                res.unique_id = '000' + str(company_seq.supp_code) | 
				
			||||
 | 
					                res.name = '[' + '000' + str(company_seq.supp_code) + ']' + str(res.name) | 
				
			||||
 | 
					                company_seq.write({'supp_code': company_seq.supp_code + 1}) | 
				
			||||
 | 
					            elif company_seq.supp_code < 100: | 
				
			||||
 | 
					                res.unique_id = '00' + str(company_seq.supp_code) | 
				
			||||
 | 
					                res.name = '[' + '00' + str(company_seq.supp_code) + ']' + str(res.name) | 
				
			||||
 | 
					                company_seq.write({'supp_code': company_seq.supp_code + 1}) | 
				
			||||
 | 
					            elif company_seq.supp_code < 1000: | 
				
			||||
 | 
					                res.unique_id = '0' + str(company_seq.supp_code) | 
				
			||||
 | 
					                res.name = '[' + '0' + str(company_seq.supp_code) + ']' + str(res.name) | 
				
			||||
 | 
					                company_seq.write({'supp_code': company_seq.supp_code + 1}) | 
				
			||||
 | 
					            elif company_seq.supp_code > 1000: | 
				
			||||
 | 
					                res.unique_id = company_seq.supp_code | 
				
			||||
 | 
					                res.name = '[' + str(company_seq.supp_code) + ']' + str(res.name) | 
				
			||||
 | 
					                company_seq.write({'supp_code': company_seq.supp_code + 1}) | 
				
			||||
 | 
					            else: | 
				
			||||
 | 
					                res.unique_id = company_seq.supp_code | 
				
			||||
 | 
					                res.name = '[' + '0001' + ']' + str(res.name) | 
				
			||||
 | 
					                company_seq.write({'supp_code': 2}) | 
				
			||||
 | 
					        return res | 
				
			||||
		
		
			
  | 
| 
		 After Width: | Height: | Size: 127 KiB  | 
| 
		 After Width: | Height: | Size: 39 KiB  | 
| 
		 After Width: | Height: | Size: 93 KiB  | 
| 
		 After Width: | Height: | Size: 50 KiB  | 
| 
		 After Width: | Height: | Size: 28 KiB  | 
@ -0,0 +1,72 @@ | 
				
			|||||
 | 
					<section class="oe_container oe_dark"> | 
				
			||||
 | 
					    <div class="oe_row oe_spaced"> | 
				
			||||
 | 
					        <h2 class="oe_slogan">Customer Sequence</h2> | 
				
			||||
 | 
					        <h2 class="oe_slogan">Give unique code to each customer</h2> | 
				
			||||
 | 
					        <h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a></h4> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<section class="oe_container oe_dark"> | 
				
			||||
 | 
					    <div class="oe_spaced"> | 
				
			||||
 | 
					        <div class="oe_picture"> | 
				
			||||
 | 
					            <h3 class="oe_slogan">Overview</h3> | 
				
			||||
 | 
					            <p class="oe_mt32"> | 
				
			||||
 | 
					                Now it is very easy to identify your customers with unique code. This module gives coding to the customers as well as to the supplier. | 
				
			||||
 | 
					            </p> | 
				
			||||
 | 
					        </div> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					<section class="oe_container"> | 
				
			||||
 | 
					    <div class="oe_spaced"> | 
				
			||||
 | 
					        <h4 class="oe_slogan">Company form</h4> | 
				
			||||
 | 
					        <div class="oe_span12"> | 
				
			||||
 | 
					            <p class='oe_mt32'> | 
				
			||||
 | 
					                ☛ Give the starting number of code.<br> | 
				
			||||
 | 
					                ☛ You can give separate starting for each company if it is a multi company.<br> | 
				
			||||
 | 
					            </p> | 
				
			||||
 | 
					            <div class="oe_demo oe_picture oe_screenshot" style="max-height: 100%;"> | 
				
			||||
 | 
					                <img src="company_form.png"> | 
				
			||||
 | 
					            </div> | 
				
			||||
 | 
					        </div> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					<section class="oe_container oe_dark"> | 
				
			||||
 | 
					    <div class="oe_spaced"> | 
				
			||||
 | 
					        <h4 class="oe_slogan">Customer Form</h4> | 
				
			||||
 | 
					        <div class="oe_span12"> | 
				
			||||
 | 
					            <p class='oe_mt32'> | 
				
			||||
 | 
					                ☛ Create a customer and the code will generate automatically as defined in the company form..<br> | 
				
			||||
 | 
					            </p> | 
				
			||||
 | 
					            <div class="oe_demo oe_picture oe_screenshot" style="max-height: 100%;"> | 
				
			||||
 | 
					                <img src="customer_form.png"> | 
				
			||||
 | 
					            </div> | 
				
			||||
 | 
					        </div> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					<section class="oe_container oe_dark"> | 
				
			||||
 | 
					    <h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> | 
				
			||||
 | 
					    <div class="oe_slogan" style="margin-top:10px !important;"> | 
				
			||||
 | 
					        <div> | 
				
			||||
 | 
					            <a  class="btn btn-primary btn-lg mt8" | 
				
			||||
 | 
					            style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i | 
				
			||||
 | 
					            class="fa fa-envelope"></i> Email </a> <a | 
				
			||||
 | 
					            class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" | 
				
			||||
 | 
					            href="https://www.cybrosys.com/contact/"><i | 
				
			||||
 | 
					            class="fa fa-phone"></i> Contact Us </a> <a | 
				
			||||
 | 
					            class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" | 
				
			||||
 | 
					            href="https://www.cybrosys.com/odoo-customization-and-installation/"><i | 
				
			||||
 | 
					            class="fa fa-check-square"></i> Request Customization </a> | 
				
			||||
 | 
					        </div> | 
				
			||||
 | 
					        <br> | 
				
			||||
 | 
					        <img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> | 
				
			||||
 | 
					        <div> | 
				
			||||
 | 
					          <a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> | 
				
			||||
 | 
					          <a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> | 
				
			||||
 | 
					          <a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> | 
				
			||||
 | 
					          <a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> | 
				
			||||
 | 
					          <a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> | 
				
			||||
 | 
					        </div> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</section> | 
				
			||||
 | 
					
 | 
				
			||||
@ -0,0 +1,16 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8" ?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
					    <data> | 
				
			||||
 | 
					        <record id="company_sequence_form" model="ir.ui.view"> | 
				
			||||
 | 
					            <field name="name">Company Sequence</field> | 
				
			||||
 | 
					            <field name="model">res.company</field> | 
				
			||||
 | 
					            <field name="inherit_id" ref="base.view_company_form"/> | 
				
			||||
 | 
					            <field name="arch" type="xml"> | 
				
			||||
 | 
					                <xpath expr="//field[@name='partner_id']" position="after"> | 
				
			||||
 | 
					                    <field name="customer_code"/> | 
				
			||||
 | 
					                    <field name="next_code"/> | 
				
			||||
 | 
					                </xpath> | 
				
			||||
 | 
					            </field> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					    </data> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,26 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
						<data> | 
				
			||||
 | 
							<record id="view_partner_form_inherit" model="ir.ui.view"> | 
				
			||||
 | 
					            <field name="name">res.partner.form.inherit</field> | 
				
			||||
 | 
					            <field name="model">res.partner</field> | 
				
			||||
 | 
					            <field name="inherit_id" ref="base.view_partner_form"/> | 
				
			||||
 | 
					            <field name="arch" type="xml"> | 
				
			||||
 | 
					                <field name="name" position="after"> | 
				
			||||
 | 
					                    <field name="unique_id"/> | 
				
			||||
 | 
					                </field> | 
				
			||||
 | 
								  </field> | 
				
			||||
 | 
							</record> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
							<record id="view_partner_tree_inherit" model="ir.ui.view"> | 
				
			||||
 | 
					            <field name="name">res.partner.form.inherit</field> | 
				
			||||
 | 
					            <field name="model">res.partner</field> | 
				
			||||
 | 
					            <field name="inherit_id" ref="base.view_partner_tree"/> | 
				
			||||
 | 
					            <field name="arch" type="xml"> | 
				
			||||
 | 
					                <field name="display_name" position="after"> | 
				
			||||
 | 
					                    <field name="unique_id"/> | 
				
			||||
 | 
					                </field> | 
				
			||||
 | 
								  </field> | 
				
			||||
 | 
							</record> | 
				
			||||
 | 
						</data> | 
				
			||||
 | 
					</odoo> | 
				
			||||
					Loading…
					
					
				
		Reference in new issue