Initial import from Docker volume

This commit is contained in:
root
2025-12-26 13:11:43 +00:00
commit 4998dc066a
13336 changed files with 1767801 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
from . import production, purchase
__all__ = ['register']
def register():
Pool.register(
production.Routing,
production.Production,
purchase.Line,
module='production_outsourcing', type_='model')
Pool.register(
module='production_outsourcing', type_='wizard')
Pool.register(
module='production_outsourcing', type_='report')

View File

@@ -0,0 +1,8 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.exceptions import UserWarning
class PurchaseWarning(UserWarning):
pass

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,67 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr "Línies de compra"
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "Proveïdor"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr "Quantitat"
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "Servei"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr "Servei del proveïdor"
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "Producció"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr "Les línies a afegir al cost de la producció."
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr "El proveïdor a qui externalitzar la producció."
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr "La quantitat a comprar per produir una quantitat de la LdM."
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr "El servei a comprar al proveïdor per la producció."
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr "El servei del proveïdor a comprar per la producció."
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr "Afegeix al cost de la producció."
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
"Els produccions \"%(productions)s\" no es poden processar perquè tenen "
"compres pendents."
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "Proveïdor"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "Producció"

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,67 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr "Einkaufspositionen"
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "Lieferant"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr "Menge"
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "Dienstleistung"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr "Lieferantendienstleistung"
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "Produktion"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr "Positionen die zu den Produktionskosten addiert werden."
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr "Der Lieferant zu dem die Produktion ausgelagert wird."
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr "Die zu beschaffende Menge, um die Stückliste einmal zu produzieren."
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr "Die vom Lieferanten zu beziehende Dienstleistung für die Produktion."
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr "Die vom Lieferanten zu beziehende Dienstleistung für die Produktion."
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr "Zu den Produktionskosten hinzufügen."
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
"Die Produktionsaufträge \"%(productions)s\" können nicht ausgeführt werden, "
"weil zugehörige Einkäufe noch nicht erledigt sind."
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "Lieferant"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "Produktion"

View File

@@ -0,0 +1,67 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr "Líneas de compra"
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "Proveedor"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr "Cantidad"
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "Servicio"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr "Servicio del proveedor"
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "Producción"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr "Las líneas a añadir al coste de la producción."
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr "El proveedor al que subcontratar la producción."
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr "La cantidad a comprar par producir la cantidad de la LdM."
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr "El servicio a comprar al proveedor para la producción."
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr "El servicio del proveedor a comprar para la producción."
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr "Añade coste a la producción."
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
"Las producciones \"%(productions)s\" no se pueden procesar porqué tienen "
"compras pendientes."
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "Proveedor"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "Producción"

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr "Ostu read"
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "Hankija"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr "Kogus"
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "Teenus"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr "Hankija teenus"
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "Tootmine"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr "Read, mida lisada tootmise kulusse."
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr "Välise tootmise hankija."
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr "Lisa tootmise kulusse."
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr "Tootmisi \"%(productions)s\" ei saa alustada, kuna neil on ootel hankeid."
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "Hankija"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "Tootmine"

View File

@@ -0,0 +1,67 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr "سطرهای خرید"
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "تأمین کننده"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr "مقدار"
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "خدمت"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr "خدمات تإمین کننده ها"
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "تولید"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr "خطوط برای اضافه کردن به هزینه تولید."
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr "تأمین کننده به محصول تولید خارجی."
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr "مقدار خرید یک بار برای تولید محصول نمونه."
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr "خدمات برای خرید به تامین کننده برای تولید."
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr "خرید عرضه کننده خدمات جهت تولید."
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr "افزودن به هزينه توليد."
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
"تولیدات : \"%(productions)s\" را نمی توان پردازش کرد زیرا آنها در انتظار "
"خرید هستند."
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "تأمین کننده"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "تولید"

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,67 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr "Lignes d'achat"
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "Fournisseur"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr "Quantité"
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "Service"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr "Service du fournisseur"
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "Production"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr "Les lignes à ajouter au coût de production."
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr "Le fournisseur à qui sous-traiter la production."
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr "La quantité à acheter pour produire une fois la nomenclature."
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr "Le service à acheter au fournisseur pour la production."
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr "Le service du fournisseur à acheter pour la production."
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr "Ajouter au coût de production."
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
"Les productions « %(productions)s » ne peuvent pas être traitées car elles "
"ont des achats en attentes."
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "Fournisseur"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "Production"

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "Pemasok"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "Jasa"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "Produksi"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "Pemasok"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "Produksi"

View File

@@ -0,0 +1,67 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr "Linee di acquisto"
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "Fornitore"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr "Quantità"
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "Servizio"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr "Servizio del fornitore"
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "Produzione"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr "Le righe da aggiungere al costo di produzione."
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr "Il fornitore dove esternalizzare la produzione."
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr "La quantità da acquistare per produrre una volta la distinta base."
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr "Il servizio del fornitore da acquistare per la produzione."
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr "Il servizio del fornitore da acquistare per la produzione."
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr "Aggiungere al costo della produzione."
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
"Le produzioni \"%(productions)s\" non possono essere elaborate in attesa di "
"acquisti."
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "Fornitore"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "Produzione"

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,69 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr "aankooplijnen"
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr "Leverancier"
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr "Hoeveelheid"
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr "Dienst"
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr "Service van de leverancier"
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr "Productie"
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr "De lijnen om toe te voegen aan de productiekosten."
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr "De leverancier om de productie aan uit te besteden."
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
"De hoeveelheid die moet worden gekocht om de stuklijst één keer te "
"produceren."
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr "De te kopen service van de leverancier voor de productie."
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr "De service te kopen van de leverancier voor de productie."
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr "Voeg toe aan de kosten van de productie."
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
"De productie \"%(productions)s\"kan niet verwerkt worden om dat er nog "
"aankopen hangende zijn."
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr "Leverancier"
msgctxt "view:purchase.line:"
msgid "Production"
msgstr "Productie"

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,65 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:production,purchase_lines:"
msgid "Purchase Lines"
msgstr ""
msgctxt "field:production.routing,supplier:"
msgid "Supplier"
msgstr ""
msgctxt "field:production.routing,supplier_quantity:"
msgid "Quantity"
msgstr ""
msgctxt "field:production.routing,supplier_service:"
msgid "Service"
msgstr ""
msgctxt "field:production.routing,supplier_service_supplier:"
msgid "Supplier's Service"
msgstr ""
msgctxt "field:purchase.line,production:"
msgid "Production"
msgstr ""
msgctxt "help:production,purchase_lines:"
msgid "The lines to add to the production cost."
msgstr ""
msgctxt "help:production.routing,supplier:"
msgid "The supplier to outsource the production."
msgstr ""
msgctxt "help:production.routing,supplier_quantity:"
msgid "The quantity to buy to produce one time the BOM."
msgstr ""
msgctxt "help:production.routing,supplier_service:"
msgid "The service to buy to the supplier for the production."
msgstr ""
msgctxt "help:production.routing,supplier_service_supplier:"
msgid "The supplier's service to buy for the production."
msgstr ""
msgctxt "help:purchase.line,production:"
msgid "Add to the cost of the production."
msgstr ""
msgctxt "model:ir.message,text:msg_pending_purchase_done"
msgid ""
"The productions \"%(productions)s\" cannot be processed as they have pending"
" purchases."
msgstr ""
msgctxt "view:production.routing:"
msgid "Supplier"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Production"
msgstr ""

View File

@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data grouped="1">
<record model="ir.message" id="msg_pending_purchase_done">
<field name="text">The productions "%(productions)s" cannot be processed as they have pending purchases.</field>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,245 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from decimal import Decimal
from itertools import groupby
from trytond.i18n import gettext
from trytond.model import ModelView, Workflow, fields
from trytond.modules.product import round_price
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Bool, Eval, If
from trytond.transaction import Transaction
from .exceptions import PurchaseWarning
class Routing(metaclass=PoolMeta):
__name__ = 'production.routing'
supplier = fields.Many2One(
'party.party', "Supplier",
help="The supplier to outsource the production.")
supplier_service = fields.Many2One(
'product.product', "Service",
ondelete='RESTRICT',
domain=[
('purchasable', '=', True),
('template.type', '=', 'service'),
],
states={
'required': Bool(Eval('supplier')),
'invisible': ~Eval('supplier'),
},
depends={'supplier_service_supplier'},
help="The service to buy to the supplier for the production.")
supplier_service_supplier = fields.Many2One(
'purchase.product_supplier', "Supplier's Service",
ondelete='RESTRICT',
domain=[
('template.type', '=', 'service'),
If(Bool('supplier_service'),
['OR',
[
('template.products', '=', Eval('supplier_service')),
('product', '=', None),
],
('product', '=', Eval('supplier_service')),
],
[]),
('party', '=', Eval('supplier', -1)),
],
states={
'invisible': ~Eval('supplier'),
},
help="The supplier's service to buy for the production.")
supplier_quantity = fields.Float("Quantity",
states={
'invisible': ~Eval('supplier_service'),
'required': Bool(Eval('supplier_service')),
},
help="The quantity to buy to produce one time the BOM.")
@classmethod
def default_supplier_quantity(cls):
return 1
@fields.depends('supplier')
def _get_product_supplier_pattern(self):
return {
'party': self.supplier.id if self.supplier else -1,
}
@fields.depends('supplier', 'supplier_service',
'supplier_service_supplier')
def on_change_supplier_service(self):
if self.supplier_service:
product_suppliers = list(
self.supplier_service.product_suppliers_used(
**self._get_product_supplier_pattern()))
if len(product_suppliers) == 1:
self.supplier_service_supplier, = product_suppliers
elif (self.supplier_service_supplier
and (self.supplier_service_supplier
not in product_suppliers)):
self.supplier_service = None
@fields.depends('supplier_service', 'supplier_service_supplier')
def on_change_supplier_service_supplier(self):
if self.supplier_service_supplier:
if self.supplier_service_supplier.product:
self.supplier_service = self.supplier_service_supplier.product
elif not self.supplier_service:
products = self.supplier_service_supplier.template.products
if len(products) == 1:
self.supplier_service, = products
@classmethod
def view_attributes(cls):
return super(Routing, cls).view_attributes() + [
('//page[@id="supplier"]', 'states', {
'invisible': ~Eval('supplier'),
}),
]
class Production(metaclass=PoolMeta):
__name__ = 'production'
purchase_lines = fields.One2Many(
'purchase.line', 'production', "Purchase Lines",
domain=[
('purchase.company', '=', Eval('company', -1)),
],
help="The lines to add to the production cost.")
def get_cost(self, name):
pool = Pool()
Currency = pool.get('currency.currency')
cost = super(Production, self).get_cost(name)
for line in self.purchase_lines:
if line.purchase.state != 'cancelled' and line.amount:
cost += Currency.compute(
line.purchase.currency, line.amount,
self.company.currency, round=False)
return round_price(cost)
@classmethod
@ModelView.button
@Workflow.transition('draft')
def draft(cls, productions):
pool = Pool()
PurchaseLine = pool.get('purchase.line')
super(Production, cls).draft(productions)
PurchaseLine.delete([l for p in productions for l in p.purchase_lines
if l.purchase_state in {'draft', 'cancelled'}])
@classmethod
@ModelView.button
@Workflow.transition('cancelled')
def cancel(cls, productions):
pool = Pool()
PurchaseLine = pool.get('purchase.line')
super(Production, cls).cancel(productions)
PurchaseLine.delete([l for p in productions for l in p.purchase_lines
if l.purchase_state in {'draft', 'cancelled'}])
@classmethod
@ModelView.button
@Workflow.transition('waiting')
def wait(cls, productions):
pool = Pool()
Purchase = pool.get('purchase.purchase')
PurchaseLine = pool.get('purchase.line')
Date = pool.get('ir.date')
draft_productions = [p for p in productions if p.state == 'draft']
super(Production, cls).wait(productions)
purchases = []
lines = []
def has_supplier(production):
return production.routing and production.routing.supplier
productions = cls.browse(sorted(
filter(has_supplier, draft_productions),
key=cls._group_purchase_key))
for key, grouped in groupby(productions, key=cls._group_purchase_key):
productions = list(grouped)
key = dict(key)
with Transaction().set_context(company=key['company'].id):
today = Date.today()
try:
purchase_date = min(p.planned_start_date or p.planned_date
for p in productions if p.planned_date)
except ValueError:
purchase_date = today
if purchase_date < today:
purchase_date = today
purchase = Purchase(purchase_date=purchase_date)
for f, v in key.items():
setattr(purchase, f, v)
purchases.append(purchase)
for production in productions:
line = production._get_purchase_line(purchase)
line.purchase = purchase
line.production = production
lines.append(line)
Purchase.save(purchases)
PurchaseLine.save(lines)
def _group_purchase_key(self):
supplier = self.routing.supplier
if self.routing.supplier_service_supplier:
currency = self.routing.supplier_service_supplier.currency
else:
currency = self.company.currency
return (
('company', self.company),
('party', supplier),
('payment_term', supplier.supplier_payment_term),
('warehouse', self.warehouse),
('currency', currency),
('invoice_address', supplier.address_get(type='invoice')),
)
def _get_purchase_line(self, purchase):
pool = Pool()
Line = pool.get('purchase.line')
line = Line()
line.product = self.routing.supplier_service
line.product_supplier = self.routing.supplier_service_supplier
line.unit = self.routing.supplier_service.purchase_uom
factor = self.bom.compute_factor(
self.product, self.quantity or 0, self.unit)
line.quantity = line.unit.round(
factor * self.routing.supplier_quantity)
line.purchase = purchase
line.on_change_product()
if line.unit_price is None:
line.unit_price = round_price(Decimal(0))
return line
@classmethod
@ModelView.button
@Workflow.transition('done')
def do(cls, productions):
pool = Pool()
Warning = pool.get('res.user.warning')
def pending_purchase(production):
return any(l.purchase_state in {'draft', 'quotation'}
for l in production.purchase_lines)
pendings = list(filter(pending_purchase, productions))
if pendings:
names = ', '.join(p.rec_name for p in productions[:5])
if len(pendings) > 5:
names += '...'
warning_name = Warning.format('pending_purchase.done', pendings)
if Warning.check(warning_name):
raise PurchaseWarning(
warning_name,
gettext('production_outsourcing.msg_pending_purchase_done',
productions=names))
super().do(productions)

View File

@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="routing_view_list">
<field name="model">production.routing</field>
<field name="inherit" ref="production_routing.routing_view_list"/>
<field name="name">routing_list</field>
</record>
<record model="ir.ui.view" id="routing_view_form">
<field name="model">production.routing</field>
<field name="inherit" ref="production_routing.routing_view_form"/>
<field name="name">routing_form</field>
</record>
<record model="ir.ui.view" id="production_view_form">
<field name="model">production</field>
<field name="inherit" ref="production.production_view_form"/>
<field name="name">production_form</field>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,20 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.pyson import Eval
class Line(metaclass=PoolMeta):
__name__ = 'purchase.line'
production = fields.Many2One(
'production', "Production", ondelete='RESTRICT',
domain=[
('company', '=', Eval('_parent_purchase', {}).get('company', -1)),
],
states={
'invisible': Eval('type') != 'line',
},
depends={'purchase'},
help="Add to the cost of the production.")

View File

@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data depends="purchase">
<record model="ir.ui.view" id="purchase_line_view_form">
<field name="model">purchase.line</field>
<field name="inherit" ref="purchase.purchase_line_view_form"/>
<field name="name">purchase_line_form</field>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

View File

@@ -0,0 +1,164 @@
===============================
Production Outsourcing Scenario
===============================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.modules.account.tests.tools import create_chart, get_accounts
>>> from trytond.modules.company.tests.tools import create_company, get_company
>>> from trytond.tests.tools import activate_modules, assertEqual
Activate modules::
>>> config = activate_modules('production_outsourcing')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> expense = accounts['expense']
Create supplier::
>>> Party = Model.get('party.party')
>>> supplier = Party(name="Supplier")
>>> supplier.save()
Create account categories::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.save()
Create Product::
>>> Uom = Model.get('product.uom')
>>> unit, = Uom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> Product = Model.get('product.product')
>>> template = ProductTemplate()
>>> template.name = "Product"
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.producible = True
>>> template.list_price = Decimal(30)
>>> product, = template.products
>>> product.cost_price = Decimal(20)
>>> template.save()
>>> product, = template.products
Create Component::
>>> template = ProductTemplate()
>>> template.name = "Component"
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.list_price = Decimal(5)
>>> component, = template.products
>>> component.cost_price = Decimal(1)
>>> template.save()
>>> component, = template.products
Create Supplier Service::
>>> template = ProductTemplate()
>>> template.name = "Production Service"
>>> template.default_uom = unit
>>> template.type = 'service'
>>> template.purchasable = True
>>> template.list_price = Decimal(20)
>>> template.account_category = account_category
>>> service, = template.products
>>> service_supplier = template.product_suppliers.new()
>>> service_supplier.party = supplier
>>> service_supplier_price = service_supplier.prices.new()
>>> service_supplier_price.unit_price = Decimal('20.0000')
>>> template.save()
>>> service, = template.products
>>> service_supplier, = template.product_suppliers
Create Bill of Material::
>>> BOM = Model.get('production.bom')
>>> bom = BOM(name="Product")
>>> input = bom.inputs.new()
>>> input.product = component
>>> input.quantity = 1
>>> output = bom.outputs.new()
>>> output.product = product
>>> output.quantity = 1
>>> bom.save()
Create Routing::
>>> Routing = Model.get('production.routing')
>>> routing = Routing(name="Supplier")
>>> routing.supplier = supplier
>>> routing.supplier_service = service
>>> assertEqual(routing.supplier_service_supplier, service_supplier)
>>> routing.supplier_quantity = 2
>>> routing.boms.append(bom)
>>> routing.save()
Set Bill of Material and Routing to the Product::
>>> ProductBOM = Model.get('product.product-production.bom')
>>> product.boms.append(ProductBOM(bom=bom, routing=routing))
>>> product.save()
Make a production::
>>> Production = Model.get('production')
>>> production = Production()
>>> production.product = product
>>> production.bom = bom
>>> production.routing = routing
>>> production.quantity = 10
>>> production.click('wait')
>>> production.state
'waiting'
>>> purchase_line, = production.purchase_lines
>>> assertEqual(purchase_line.product, service)
>>> assertEqual(purchase_line.product_supplier, service_supplier)
>>> purchase_line.quantity
20.0
>>> production.cost
Decimal('410.0000')
Reset to draft::
>>> production.click('draft')
>>> production.purchase_lines
[]
Try to do the production with pending purchase::
>>> production.click('wait')
>>> production.click('assign_force')
>>> production.click('run')
>>> production.click('do')
Traceback (most recent call last):
...
PurchaseWarning: ...
Validate the purchase::
>>> purchase_line, = production.purchase_lines
>>> purchase = purchase_line.purchase
>>> purchase.click('quote')
>>> purchase.click('confirm')
Do the production::
>>> production.click('do')

View File

@@ -0,0 +1,12 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.tests.test_tryton import ModuleTestCase
class ProductionOutsourcingTestCase(ModuleTestCase):
'Test Production Outsourcing module'
module = 'production_outsourcing'
del ModuleTestCase

View File

@@ -0,0 +1,8 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.tests.test_tryton import load_doc_tests
def load_tests(*args, **kwargs):
return load_doc_tests(__name__, __file__, *args, **kwargs)

View File

@@ -0,0 +1,12 @@
[tryton]
version=7.2.0
depends:
ir
product
production
production_routing
purchase
xml:
production.xml
purchase.xml
message.xml

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="//field[@name='cost']" position="after">
<field name="purchase_lines" colspan="4" widget="many2many"/>
</xpath>
</data>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath
expr="/form/notebook/page[@id='general']" position="after">
<page string="Production" id="production">
<label name="production"/>
<field name="production"/>
</page>
</xpath>
</data>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='active']" position="after">
<label name="supplier"/>
<field name="supplier"/>
</xpath>
<xpath expr="/form/notebook" position="inside">
<page id="supplier" string="Supplier">
<label name="supplier_service"/>
<field name="supplier_service"/>
<label name="supplier_service_supplier"/>
<field name="supplier_service_supplier"/>
<label name="supplier_quantity"/>
<field name="supplier_quantity"/>
</page>
</xpath>
</data>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree" position="inside">
<field name="supplier" expand="1"/>
</xpath>
</data>