Skip to content

Commit

Permalink
[ADD] purchase_order_line_number: numbering purchase order lines
Browse files Browse the repository at this point in the history
closes #206

Signed-off-by: Juan Carreras <[email protected]>
  • Loading branch information
ced-adhoc committed Jul 23, 2024
1 parent a858490 commit fbdf71a
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 0 deletions.
71 changes: 71 additions & 0 deletions purchase_order_line_number/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.. |company| replace:: ADHOC SA

.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png
:alt: ADHOC SA
:target: https://www.adhoc.com.ar

.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png

.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

==========================
Purchase Order Line Number
==========================

This module adds a sequential number for each line in the purchase order.


Installation
============

To install this module, you need to:

#. Only need to install the module

Configuration
=============

To configure this module, you need to:

#. Nothing to configure

Usage
=====

To use this module, you need to:

#. You can see the sequence in the lines of the purchase order.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: http://runbot.adhoc.com.ar/

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

Bugs are tracked on `GitHub Issues
<https://github.com/ingadhoc/purchase/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
=======

Images
------

* |company| |icon|

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

Maintainer
----------

|company_logo|

This module is maintained by the |company|.

To contribute to this module, please visit https://www.adhoc.com.ar.
5 changes: 5 additions & 0 deletions purchase_order_line_number/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from . import models
40 changes: 40 additions & 0 deletions purchase_order_line_number/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##############################################################################
#
# Copyright (C) 2024 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# 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': 'Purchase Order Line Number',
'version': "16.0.0.1.0",
'category': 'Purchase',
'sequence': 14,
'summary': 'Add line numbers to purchase orders for better control and communication',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'images': [
],
'depends': [
'purchase',
],
'data': [
'views/purchase_order_views.xml',
],
'installable': True,
'auto_install': False,
'application': False,
}
32 changes: 32 additions & 0 deletions purchase_order_line_number/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_order_line_number
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-01 00:00+0000\n"
"PO-Revision-Date: 2024-07-01 00:00+0000\n"
"Last-Translator: ced <[email protected]>, 2024\n"
"Language-Team: Spanish (https://www.transifex.com/adhoc/teams/46451/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"

#. module: purchase_order_line_number
#: model_terms:ir.ui.view,arch_db:purchase_order_line_number.purchase_order_form_view
msgid "Nbr"
msgstr "Nro"

#. module: purchase_order_line_number
#: model:ir.model.fields,field_description:purchase_order_line_number.field_purchase_order_line__number
msgid "Number"
msgstr "Número"

#. module: purchase_order_line_number
#: model:ir.model,name:purchase_order_line_number.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea de pedido de compra"
1 change: 1 addition & 0 deletions purchase_order_line_number/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_order_line
25 changes: 25 additions & 0 deletions purchase_order_line_number/models/purchase_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields


class PurchaseOrderLine(models.Model):

_inherit = 'purchase.order.line'

number = fields.Integer(
compute='_compute_get_number',
)

def _compute_get_number(self):
self.number = False
if self and not isinstance(self[0].id, int):
return
for order in self.mapped('order_id'):
number = 1
for line in order.order_line.sorted("sequence"):
line.number = number
number += 1

13 changes: 13 additions & 0 deletions purchase_order_line_number/views/purchase_order_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<odoo>
<record model="ir.ui.view" id="purchase_order_form_view">
<field name="name">purchase.order.inherit</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree//field[@name='sequence']" position="after">
<field name="number" string="Nbr"/>
</xpath>
</field>
</record>
</odoo>

0 comments on commit fbdf71a

Please sign in to comment.