Skip to content

Commit

Permalink
Merge pull request OCA#76 from OCA/revert-75-revert-57-8.0
Browse files Browse the repository at this point in the history
Revert "Revert "Port sale_quotation_number to v8""
  • Loading branch information
nbessi committed Nov 26, 2014
2 parents 3b3dafb + 3d5a027 commit bd3d4cf
Show file tree
Hide file tree
Showing 8 changed files with 260 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sale_quotation_number/AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Andy Lu <[email protected]>
Lorenzo Battistini <[email protected]>
22 changes: 22 additions & 0 deletions sale_quotation_number/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#
#
# Copyright (c) 2010-2012 Elico Corp. All Rights Reserved.
# Author: Andy Lu <[email protected]>
# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
from . import model
89 changes: 89 additions & 0 deletions sale_quotation_number/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# -*- coding: utf-8 -*-
#
#
# Copyright (c) 2010-2012 Elico Corp. All Rights Reserved.
# Author: Andy Lu <[email protected]>
# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
# Author: Lorenzo Battistini <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#


{
'name': 'Sale Quotation Numeration',
'version': '1.1',
'category': 'Sales Management',
'summary': "Different sequence for sale quotations",
'description': """
This module adds a sale quotation sequence.
===========================================
Defining.
*Sale Quotation:* Sale process in draft stage just informing prices and element
of communication.
*Sale Order:* Sale process confirmed, the customer already have a compromise
with us in terms of pay an invoice and receive our product or service.
Originally OpenERP manage only 1 sequence for this 2 documents, then the sales
order won and lost manage the same sequence losting almost all lost quotations
in terms of sequences, making so difficult understand qith a quick view if we
are good or bad in terms of logistic and sale process already confirmed.
Technical Explanation:
When you create a quotation, it is numbered using the 'sale.quotation'
sequence. When you confirm a quotation, its orginal number is saved in the
'origin' field and the sale order gets a new number, retrieving it from
'sale.order' sequence.
With Openerp Base.
Sale Quotation 1 Number = SO001
Sale Quotation 2 Number = SO002
Sale Quotation 3 Number = SO003
Sale Quotation 4 Number = SO004
Sale Quotation 2 Confirmed = Number for Sale Order SO004
With Openerp + This Module.
Sale Quotation 1 Number = SQ001
Sale Quotation 2 Number = SQ002
Sale Quotation 3 Number = SQ003
Sale Quotation 4 Number = SQ004
Sale Quotation 2 Confirmed = Number for Sale Order SO001 from Sale Quotation
SQ002
Sale Quotation 1 Confirmed = Number for Sale Order SO002 from Sale Quotation
SQ001
Sale Quotation 4 Confirmed = Number for Sale Order SO003 from Sale Quotation
SQ004
""",
'author': ['Elico Corp', 'Agile Business Group'],
'website': 'http://www.openerp.net.cn',
'depends': ['sale'],
'data': [
'data/data.xml',
],
'demo': [],
'test': [],
'installable': True,
'active': False,
}
19 changes: 19 additions & 0 deletions sale_quotation_number/data/data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">

<!-- Sequences for sale.quotation -->
<record id="seq_type_sale_quotation" model="ir.sequence.type">
<field name="name">Sales Quotation</field>
<field name="code">sale.quotation</field>
</record>

<record id="seq_sale_quotation" model="ir.sequence">
<field name="name">Sales Quotation</field>
<field name="code">sale.quotation</field>
<field name="prefix">SQ</field>
<field name="padding">3</field>
</record>

</data>
</openerp>
27 changes: 27 additions & 0 deletions sale_quotation_number/i18n/en_US.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * sale_quotation_apem
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.3\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2012-04-17 08:12+0000\n"
"PO-Revision-Date: 2012-04-17 08:12+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: sale_quotation_apem
#: sql_constraint:sale.order:0
msgid "Order Reference must be unique !"
msgstr "Order Reference must be unique !"

#. module: sale_quotation_apem
#: model:ir.model,name:sale_quotation_apem.model_sale_order
msgid "Sales Order"
msgstr "Sales Order"

27 changes: 27 additions & 0 deletions sale_quotation_number/i18n/zh_CN.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * sale_quotation_apem
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 6.0.3\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2012-04-17 08:12+0000\n"
"PO-Revision-Date: 2012-04-17 08:12+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: sale_quotation_apem
#: sql_constraint:sale.order:0
msgid "Order Reference must be unique !"
msgstr "订单号码必须唯一 !"

#. module: sale_quotation_apem
#: model:ir.model,name:sale_quotation_apem.model_sale_order
msgid "Sales Order"
msgstr "销售订单"

22 changes: 22 additions & 0 deletions sale_quotation_number/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#
#
# Copyright (c) 2010-2012 Elico Corp. All Rights Reserved.
# Author: Andy Lu <[email protected]>
# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
from . import sale_order
52 changes: 52 additions & 0 deletions sale_quotation_number/model/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#

from openerp import models, api


class SaleOrder(models.Model):
_inherit = "sale.order"

@api.one
def copy(self, default=None):
if default is None:
default = {}
default['name'] = '/'
return super(SaleOrder, self).copy(default=default)

@api.model
def create(self, vals):
if vals.get('name', '/') == '/':
vals['name'] = self.env['ir.sequence'].next_by_code(
'sale.quotation') or '/'
return super(SaleOrder, self).create(vals)

@api.multi
def action_wait(self):
if super(SaleOrder, self).action_wait():
for sale in self:
quo = sale.name
sale.write({
'origin': quo,
'name': self.env['ir.sequence'].next_by_code(
'sale.order')
})
return True

0 comments on commit bd3d4cf

Please sign in to comment.