Arbore/arbore#134 add purchase_subtotal_undiscounted

This commit is contained in:
Luis 2025-05-12 10:28:04 +02:00
parent 08fca37c6d
commit ebb6b6efce
8 changed files with 130 additions and 0 deletions

View file

@ -0,0 +1 @@
from . import models

View file

@ -0,0 +1,15 @@
{
"name": "Purchase Subtotal Undiscounted",
"version": "16.0.1.0.0",
"depends": ["purchase_discount"],
"author": "Criptomart",
"category": "Purchases",
"description": "Show subtotal undiscounted in purchase order lines",
"data": [
"views/purchase_order_line.xml",
],
"license": "AGPL-3",
"installable": True,
"application": False,
"auto_install": False,
}

View file

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_subtotal_undiscounted
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-12 08:22+0000\n"
"PO-Revision-Date: 2025-05-12 10:23+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.6\n"
#. module: purchase_subtotal_undiscounted
#: model:ir.model,name:purchase_subtotal_undiscounted.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea de pedido de compra"
#. module: purchase_subtotal_undiscounted
#: model:ir.model.fields,field_description:purchase_subtotal_undiscounted.field_purchase_order_line__price_subtotal_undiscounted
msgid "Subtotal witout Discount"
msgstr "Subtotal sin descuentos"

View file

@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_subtotal_undiscounted
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-12 08:22+0000\n"
"PO-Revision-Date: 2025-05-12 10:26+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: gl_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.6\n"
#. module: purchase_subtotal_undiscounted
#: model:ir.model,name:purchase_subtotal_undiscounted.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Liña pedido de compra"
#. module: purchase_subtotal_undiscounted
#: model:ir.model.fields,field_description:purchase_subtotal_undiscounted.field_purchase_order_line__price_subtotal_undiscounted
msgid "Subtotal witout Discount"
msgstr "Subtotal sen Descontos"

View file

@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_subtotal_undiscounted
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-05-12 08:21+0000\n"
"PO-Revision-Date: 2025-05-12 08:21+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: purchase_subtotal_undiscounted
#: model:ir.model,name:purchase_subtotal_undiscounted.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""
#. module: purchase_subtotal_undiscounted
#: model:ir.model.fields,field_description:purchase_subtotal_undiscounted.field_purchase_order_line__price_subtotal_undiscounted
msgid "Subtotal witout Discount"
msgstr ""

View file

@ -0,0 +1 @@
from . import purchase_order_line

View file

@ -0,0 +1,16 @@
from odoo import models, fields, api
class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"
price_subtotal_undiscounted = fields.Monetary(
string="Subtotal witout Discount",
compute="_compute_price_subtotal_undiscounted",
currency_field="currency_id",
)
@api.depends("product_qty", "price_unit")
def _compute_price_subtotal_undiscounted(self):
for line in self:
line.price_subtotal_undiscounted = line.product_qty * line.price_unit

View file

@ -0,0 +1,15 @@
<odoo>
<record id="view_order_form_inherit_undiscounted" model="ir.ui.view">
<field name="name">purchase.order.form.undiscounted</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase_discount.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree/field[@name='price_subtotal']" position="before">
<field name="price_subtotal_undiscounted" optional="show" />
</xpath>
<xpath expr="//field[@name='order_line']//tree//field[@name='discount']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
</odoo>