[tryton-debian-vcs] tryton-modules-purchase branch upstream updated. upstream/3.4.1-1-g8297b2d
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Thu Apr 23 16:05:36 UTC 2015
The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-purchase.git;a=commitdiff;h=upstream/3.4.1-1-g8297b2d
commit 8297b2dec0935ffefc9fece4f19a184c43f09bc8
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Apr 23 17:00:03 2015 +0200
Adding upstream version 3.6.0.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index bca2d1b..eac7ed7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
-Version 3.4.1 - 2015-02-21
+Version 3.6.0 - 2015-04-20
* Bug fixes (see mercurial logs for details)
+* Add support for PyPy
+* Support mixed invoice type by line in invoiced quantity calculation
+* Use TaxableMixin
Version 3.4.0 - 2014-10-20
* Bug fixes (see mercurial logs for details)
diff --git a/INSTALL b/INSTALL
index ca4cf87..add8567 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,7 +6,7 @@ Prerequisites
* Python 2.7 or later (http://www.python.org/)
* trytond (http://www.tryton.org/)
- * python-sql (http://code.google.com/p/python-sql/)
+ * python-sql 0.4 or later (http://code.google.com/p/python-sql/)
* trytond_company (http://www.tryton.org/)
* trytond_party (http://www.tryton.org/)
* trytond_stock (http://www.tryton.org/)
diff --git a/PKG-INFO b/PKG-INFO
index 9e0f509..47c8c1d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_purchase
-Version: 3.4.1
+Version: 3.6.0
Summary: Tryton module for purchase
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.4/
+Download-URL: http://downloads.tryton.org/3.6/
Description: trytond_purchase
================
@@ -64,5 +64,7 @@ Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business
Classifier: Topic :: Office/Business :: Financial :: Accounting
diff --git a/__init__.py b/__init__.py
index 3811cbf..e37b9a5 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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 .purchase import *
diff --git a/configuration.py b/configuration.py
index c7f038d..b1d7c6d 100644
--- a/configuration.py
+++ b/configuration.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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 ModelView, ModelSQL, ModelSingleton, fields
from trytond.pyson import Eval, Bool
diff --git a/invoice.py b/invoice.py
index fb08125..42007df 100644
--- a/invoice.py
+++ b/invoice.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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 functools import wraps
from sql import Table
diff --git a/locale/bg_BG.po b/locale/bg_BG.po
index b28635d..3ab5409 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -770,6 +770,12 @@ msgstr "Проект"
#, fuzzy
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "Обработване"
+
+#, fuzzy
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Запитване"
@@ -1178,7 +1184,7 @@ msgid "Cancel"
msgstr "Отказ"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Добре"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1186,7 +1192,7 @@ msgid "Cancel"
msgstr "Отказ"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Добре"
#, fuzzy
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index 5e2a519..94716a9 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -14,13 +14,13 @@ msgctxt "error:purchase.line:"
msgid ""
"Product \"%(product)s\" of purchase %(purchase)s misses an expense account."
msgstr ""
-"Falta el compte a pagar del producte \"%(product)s\" de la compra "
+"Falta el compte de despeses del producte \"%(product)s\" de la compra "
"%(purchase)s."
msgctxt "error:purchase.line:"
msgid "Purchase \"%(purchase)s\" misses an \"account expense\" default property."
msgstr ""
-"Falta la propietat \"compte a pagar\" per defecte de la compra "
+"Falta la propietat \"Compte de despeses\" per defecte de la compra "
"\"%(purchase)s\"."
msgctxt "error:purchase.line:"
@@ -131,7 +131,7 @@ msgstr "Refer moviments"
msgctxt "field:purchase.line,amount:"
msgid "Amount"
-msgstr "Quantitat"
+msgstr "Import"
msgctxt "field:purchase.line,create_date:"
msgid "Create Date"
@@ -227,7 +227,7 @@ msgstr "Unitat"
msgctxt "field:purchase.line,unit_digits:"
msgid "Unit Digits"
-msgstr "Decimals unitaris"
+msgstr "Decimals de la unitat"
msgctxt "field:purchase.line,unit_price:"
msgid "Unit Price"
@@ -752,12 +752,12 @@ msgstr "Gestiona excepció d'enviament"
msgctxt "model:ir.action.act_window.domain,name:act_purchase_form_domain_all"
msgid "All"
-msgstr "Tot"
+msgstr "Totes"
msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_confirmed"
msgid "Confirmed"
-msgstr "Confirmat"
+msgstr "Confirmada"
msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_draft"
@@ -765,6 +765,11 @@ msgid "Draft"
msgstr "Esborrany"
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "En procés"
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Pressupost"
@@ -863,7 +868,7 @@ msgstr "Administració de compres"
msgctxt "odt:purchase.purchase:"
msgid "Amount"
-msgstr "Quantitat"
+msgstr "Import"
msgctxt "odt:purchase.purchase:"
msgid "Date:"
@@ -1063,7 +1068,7 @@ msgstr "Configuració de les compres"
msgctxt "view:purchase.handle.invoice.exception.ask:"
msgid "Choose invoices to recreate"
-msgstr "Seleccioni les factures a recrear"
+msgstr "Seleccioneu les factures a recrear"
msgctxt "view:purchase.handle.invoice.exception.ask:"
msgid "Handle Invoice Exception"
@@ -1071,7 +1076,7 @@ msgstr "Gestiona l'excepció de factura"
msgctxt "view:purchase.handle.shipment.exception.ask:"
msgid "Choose move to recreate"
-msgstr "Esculli un moviment a refer"
+msgstr "Seleccioneu els moviments a recrear"
msgctxt "view:purchase.handle.shipment.exception.ask:"
msgid "Handle shipment Exception"
@@ -1097,6 +1102,10 @@ msgctxt "view:purchase.line:"
msgid "Purchase Lines"
msgstr "Línies de compra"
+msgctxt "view:purchase.line:"
+msgid "Taxes"
+msgstr "Impostos"
+
msgctxt "view:purchase.product_supplier.price:"
msgid "Product Supplier Price"
msgstr "Preu del proveïdor del producte"
@@ -1170,7 +1179,7 @@ msgid "Cancel"
msgstr "Cancel·la"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Accepta"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1178,7 +1187,7 @@ msgid "Cancel"
msgstr "Cancel·la"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Accepta"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index 3bf6de3..59706bb 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -757,6 +757,11 @@ msgid "Draft"
msgstr ""
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr ""
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr ""
@@ -1162,7 +1167,7 @@ msgid "Cancel"
msgstr ""
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr ""
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1170,7 +1175,7 @@ msgid "Cancel"
msgstr ""
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr ""
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 71326c0..6d013e6 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -708,7 +708,7 @@ msgstr "Minimale Anzahl"
msgctxt "model:ir.action,name:act_invoice_form"
msgid "Invoices"
-msgstr "Rechnungsausgang"
+msgstr "Rechnungseingang"
msgctxt "model:ir.action,name:act_open_supplier"
msgid "Parties associated to Purchases"
@@ -773,6 +773,11 @@ msgid "Draft"
msgstr "Entwurf"
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "In Ausführung"
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Angebot"
@@ -1105,6 +1110,10 @@ msgctxt "view:purchase.line:"
msgid "Purchase Lines"
msgstr "Einkaufspositionen"
+msgctxt "view:purchase.line:"
+msgid "Taxes"
+msgstr "Steuern"
+
msgctxt "view:purchase.product_supplier.price:"
msgid "Product Supplier Price"
msgstr "Einkaufspreis"
@@ -1178,7 +1187,7 @@ msgid "Cancel"
msgstr "Abbrechen"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "OK"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1186,7 +1195,7 @@ msgid "Cancel"
msgstr "Abbrechen"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "OK"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 3a090bd..4c7f060 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -227,7 +227,7 @@ msgstr "Unidad"
msgctxt "field:purchase.line,unit_digits:"
msgid "Unit Digits"
-msgstr "Dígitos de unidad"
+msgstr "Decimales de unidad"
msgctxt "field:purchase.line,unit_price:"
msgid "Unit Price"
@@ -459,7 +459,7 @@ msgstr "Moneda"
msgctxt "field:purchase.purchase,currency_digits:"
msgid "Currency Digits"
-msgstr "Dígitos de moneda"
+msgstr "Decimales de moneda"
msgctxt "field:purchase.purchase,description:"
msgid "Description"
@@ -503,7 +503,7 @@ msgstr "Movimientos"
msgctxt "field:purchase.purchase,party:"
msgid "Party"
-msgstr "Entidades"
+msgstr "Entidad"
msgctxt "field:purchase.purchase,party_lang:"
msgid "Party Language"
@@ -759,7 +759,7 @@ msgstr "Todo"
msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_confirmed"
msgid "Confirmed"
-msgstr "Confirmado"
+msgstr "Confirmada"
msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_draft"
@@ -767,6 +767,11 @@ msgid "Draft"
msgstr "Borrador"
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "Procesamiento"
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Presupuesto"
@@ -1021,7 +1026,7 @@ msgstr "Cancelada"
msgctxt "selection:purchase.purchase,state:"
msgid "Confirmed"
-msgstr "Confirmado"
+msgstr "Confirmada"
msgctxt "selection:purchase.purchase,state:"
msgid "Done"
@@ -1099,6 +1104,10 @@ msgctxt "view:purchase.line:"
msgid "Purchase Lines"
msgstr "Líneas de compra"
+msgctxt "view:purchase.line:"
+msgid "Taxes"
+msgstr "Impuestos"
+
msgctxt "view:purchase.product_supplier.price:"
msgid "Product Supplier Price"
msgstr "Precio del proveedor del producto"
@@ -1172,7 +1181,7 @@ msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Aceptar"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1180,7 +1189,7 @@ msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Aceptar"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 009255e..a031bf6 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -767,6 +767,11 @@ msgid "Draft"
msgstr "Borrador"
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "Procesada"
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Cotización"
@@ -1099,6 +1104,10 @@ msgctxt "view:purchase.line:"
msgid "Purchase Lines"
msgstr "Líneas de Compra"
+msgctxt "view:purchase.line:"
+msgid "Taxes"
+msgstr "Impuestos"
+
msgctxt "view:purchase.product_supplier.price:"
msgid "Product Supplier Price"
msgstr "Precio del Proveedor del Producto"
@@ -1117,7 +1126,7 @@ msgstr "Proveedores de Producto"
msgctxt "view:purchase.purchase:"
msgid "Cancel"
-msgstr "Cancelar"
+msgstr "Anular"
msgctxt "view:purchase.purchase:"
msgid "Confirm"
@@ -1172,7 +1181,7 @@ msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Aceptar"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1180,7 +1189,7 @@ msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Aceptar"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
diff --git a/locale/es_EC.po b/locale/es_EC.po
index 9d6bbb6..6f54045 100644
--- a/locale/es_EC.po
+++ b/locale/es_EC.po
@@ -4,24 +4,24 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:account.invoice:"
msgid "You cannot reset to draft an invoice generated by a purchase."
-msgstr "No puede restaurar a borrador una factura generada por una compra."
+msgstr "No puede restablecer a borrador una factura generada por una compra."
msgctxt "error:product.template:"
msgid "Purchase prices are based on the purchase uom."
-msgstr "Los precios de compra se basan en la unidad de medida de la compra."
+msgstr "Los precios de compra se basan en la UdM de la compra."
msgctxt "error:purchase.line:"
msgid ""
"Product \"%(product)s\" of purchase %(purchase)s misses an expense account."
msgstr ""
-"El producto \"%(product)s\" de la compra %(purchase)s le falta una cuenta de"
-" gastos."
+"El producto \"%(product)s\" de la compra %(purchase)s le falta la cuenta de "
+"gastos."
msgctxt "error:purchase.line:"
msgid "Purchase \"%(purchase)s\" misses an \"account expense\" default property."
msgstr ""
-"Falta la propiedad por defecto \"Cuenta de Gastos\" de la compra "
-"\"%(purchase)s\"."
+"A la compra \"%(purchase)s\" le falta la propiedad \"Cuenta de Gastos\" por "
+"defecto."
msgctxt "error:purchase.line:"
msgid "Purchase \"%(purchase)s\" misses the supplier location for line \"%(line)s\"."
@@ -31,7 +31,7 @@ msgstr ""
msgctxt "error:purchase.purchase:"
msgid "A warehouse must be defined for quotation of purchase \"%s\"."
-msgstr "Debe definir una bodega para la cotización de la compra \"%s\"."
+msgstr "Se debe definir una bodega para la cotización de la compra \"%s\"."
msgctxt "error:purchase.purchase:"
msgid "Missing \"Account Payable\" on party \"%s\"."
@@ -39,19 +39,20 @@ msgstr "Falta la \"Cuenta por Pagar\" en el tercero \"%s\"."
msgctxt "error:purchase.purchase:"
msgid "Purchase \"%s\" must be cancelled before deletion."
-msgstr "La compra \"%s\" debe ser cancelada antes de ser eliminada."
+msgstr "Se debe cancelar la compra \"%s\" antes de eliminarla."
msgctxt "error:stock.shipment.in.return:"
msgid "You cannot reset to draft a move generated by a purchase."
-msgstr "No puede restaurar a borrador un movimiento generado por una compra."
+msgstr ""
+"No puede restablecer a borrador un movimiento generado por una compra."
msgctxt "error:stock.shipment.in:"
msgid ""
"You cannot reset to draft move \"%s\" because it was generated by a "
"purchase."
msgstr ""
-"No puede restaurar a borrador el movimiento \"%s\" porque se generó mediante"
-" una compra."
+"No puede restablecer a borrador el movimiento \"%s\" porque se generó "
+"mediante una compra."
msgctxt "field:account.invoice,purchase_exception_state:"
msgid "Exception State"
@@ -151,7 +152,7 @@ msgstr "Descripción"
msgctxt "field:purchase.line,from_location:"
msgid "From Location"
-msgstr "Desde Ubicación"
+msgstr "Desde Bodega"
msgctxt "field:purchase.line,id:"
msgid "ID"
@@ -191,7 +192,7 @@ msgstr "Producto"
msgctxt "field:purchase.line,product_uom_category:"
msgid "Product Uom Category"
-msgstr "Categoría UdM del Producto"
+msgstr "Categoría de UdM del Producto"
msgctxt "field:purchase.line,purchase:"
msgid "Purchase"
@@ -511,7 +512,7 @@ msgstr "Idioma del Tercero"
msgctxt "field:purchase.purchase,payment_term:"
msgid "Payment Term"
-msgstr "Plazo de Pago"
+msgstr "Término de Pago"
msgctxt "field:purchase.purchase,purchase_date:"
msgid "Purchase Date"
@@ -551,7 +552,7 @@ msgstr "Impuesto"
msgctxt "field:purchase.purchase,tax_amount_cache:"
msgid "Tax Cache"
-msgstr "Caché de Impuestos"
+msgstr "Impuestos precalculados"
msgctxt "field:purchase.purchase,total_amount:"
msgid "Total"
@@ -559,15 +560,15 @@ msgstr "Total"
msgctxt "field:purchase.purchase,total_amount_cache:"
msgid "Total Cache"
-msgstr "Cache del Total"
+msgstr "Total precalculado"
msgctxt "field:purchase.purchase,untaxed_amount:"
msgid "Untaxed"
-msgstr "Base (sin impuestos)"
+msgstr "Base Imponible"
msgctxt "field:purchase.purchase,untaxed_amount_cache:"
msgid "Untaxed Cache"
-msgstr "Cache de Base sin Impuestos"
+msgstr "Base Imponible precalculado"
msgctxt "field:purchase.purchase,warehouse:"
msgid "Warehouse"
@@ -710,7 +711,7 @@ msgstr "Proveedores"
msgctxt "model:ir.action,name:act_product_supplier_form"
msgid "Product Suppliers"
-msgstr "Proveedores de Producto"
+msgstr "Proveedores de Productos"
msgctxt "model:ir.action,name:act_product_supplier_price_form"
msgid "Prices"
@@ -767,6 +768,11 @@ msgid "Draft"
msgstr "Borrador"
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "En Proceso"
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Cotización"
@@ -785,7 +791,7 @@ msgstr "Configuración"
msgctxt "model:ir.ui.menu,name:menu_product_supplier"
msgid "Product Suppliers"
-msgstr "Proveedores de Producto"
+msgstr "Proveedores de Productos"
msgctxt "model:ir.ui.menu,name:menu_purchase"
msgid "Purchase"
@@ -793,7 +799,7 @@ msgstr "Compras"
msgctxt "model:ir.ui.menu,name:menu_purchase_configuration"
msgid "Purchase Configuration"
-msgstr "Configuración de Compras"
+msgstr "Compras"
msgctxt "model:ir.ui.menu,name:menu_purchase_form"
msgid "Purchases"
@@ -913,7 +919,7 @@ msgstr "Impuestos:"
msgctxt "odt:purchase.purchase:"
msgid "Total (excl. taxes):"
-msgstr "Base (sin Impuestos):"
+msgstr "Total (sin Impuestos):"
msgctxt "odt:purchase.purchase:"
msgid "Total:"
@@ -1045,7 +1051,7 @@ msgstr ""
msgctxt "selection:stock.move,purchase_exception_state:"
msgid "Ignored"
-msgstr "Ignorado"
+msgstr "Ignorada"
msgctxt "selection:stock.move,purchase_exception_state:"
msgid "Recreated"
@@ -1099,6 +1105,10 @@ msgctxt "view:purchase.line:"
msgid "Purchase Lines"
msgstr "Líneas de Compra"
+msgctxt "view:purchase.line:"
+msgid "Taxes"
+msgstr "Impuestos"
+
msgctxt "view:purchase.product_supplier.price:"
msgid "Product Supplier Price"
msgstr "Precio del Proveedor del Producto"
@@ -1109,11 +1119,11 @@ msgstr "Precios del Proveedor del Producto"
msgctxt "view:purchase.product_supplier:"
msgid "Product Supplier"
-msgstr "Proveedor del Producto"
+msgstr "Proveedor de Producto"
msgctxt "view:purchase.product_supplier:"
msgid "Product Suppliers"
-msgstr "Proveedores de Producto"
+msgstr "Proveedores de Productos"
msgctxt "view:purchase.purchase:"
msgid "Cancel"
@@ -1172,16 +1182,16 @@ msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
-msgstr "Aceptar"
+msgid "OK"
+msgstr "OK"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
-msgstr "Aceptar"
+msgid "OK"
+msgstr "OK"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
msgid "Cancel"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index f9bc6ef..ba12b89 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -14,13 +14,13 @@ msgctxt "error:purchase.line:"
msgid ""
"Product \"%(product)s\" of purchase %(purchase)s misses an expense account."
msgstr ""
-"Falta la cuenta a pagar del product \"%(product)s\" de la compra "
+"Falta la cuenta de gastos del producto \"%(product)s\" de la compra "
"%(purchase)s."
msgctxt "error:purchase.line:"
msgid "Purchase \"%(purchase)s\" misses an \"account expense\" default property."
msgstr ""
-"Falta la propiedad \"cuenta a pagar\" por defecto de la compra "
+"Falta la propiedad \"Cuenta de gastos\" por defecto de la compra "
"\"%(purchase)s\"."
msgctxt "error:purchase.line:"
@@ -163,7 +163,7 @@ msgstr "Líneas de factura"
msgctxt "field:purchase.line,move_done:"
msgid "Moves Done"
-msgstr "Movimientos realizados"
+msgstr "Movimientos finalizados"
msgctxt "field:purchase.line,move_exception:"
msgid "Moves Exception"
@@ -227,7 +227,7 @@ msgstr "Unidad"
msgctxt "field:purchase.line,unit_digits:"
msgid "Unit Digits"
-msgstr "Dígitos unidad"
+msgstr "Decimales de la unidad"
msgctxt "field:purchase.line,unit_price:"
msgid "Unit Price"
@@ -759,7 +759,7 @@ msgstr "Todo"
msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_confirmed"
msgid "Confirmed"
-msgstr "Confirmado"
+msgstr "Confirmada"
msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_draft"
@@ -767,6 +767,11 @@ msgid "Draft"
msgstr "Borrador"
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "En proceso"
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Presupuesto"
@@ -1025,7 +1030,7 @@ msgstr "Confirmada"
msgctxt "selection:purchase.purchase,state:"
msgid "Done"
-msgstr "Realizada"
+msgstr "Finalizada"
msgctxt "selection:purchase.purchase,state:"
msgid "Draft"
@@ -1065,7 +1070,7 @@ msgstr "Configuración de compras"
msgctxt "view:purchase.handle.invoice.exception.ask:"
msgid "Choose invoices to recreate"
-msgstr "Seleccione facturas a recrear"
+msgstr "Seleccione las facturas a recrear"
msgctxt "view:purchase.handle.invoice.exception.ask:"
msgid "Handle Invoice Exception"
@@ -1073,7 +1078,7 @@ msgstr "Gestionar excepción de factura"
msgctxt "view:purchase.handle.shipment.exception.ask:"
msgid "Choose move to recreate"
-msgstr "Seleccione movimientos a recrear"
+msgstr "Seleccione los movimientos a recrear"
msgctxt "view:purchase.handle.shipment.exception.ask:"
msgid "Handle shipment Exception"
@@ -1099,6 +1104,10 @@ msgctxt "view:purchase.line:"
msgid "Purchase Lines"
msgstr "Líneas de compra"
+msgctxt "view:purchase.line:"
+msgid "Taxes"
+msgstr "Impuestos"
+
msgctxt "view:purchase.product_supplier.price:"
msgid "Product Supplier Price"
msgstr "Precio del proveedor del producto"
@@ -1172,7 +1181,7 @@ msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Aceptar"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1180,7 +1189,7 @@ msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Aceptar"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index c755d01..3820855 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -35,7 +35,7 @@ msgstr "Un entrepôt doit être défini pour le devis de l'achat « %s »."
msgctxt "error:purchase.purchase:"
msgid "Missing \"Account Payable\" on party \"%s\"."
-msgstr "Le compte à payer est manquant sur le tiers « %s »."
+msgstr "Le « compte fournisseur » est manquant sur le tiers « %s »."
msgctxt "error:purchase.purchase:"
msgid "Purchase \"%s\" must be cancelled before deletion."
@@ -767,6 +767,11 @@ msgid "Draft"
msgstr "Brouillon"
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "Traitement"
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Devis"
@@ -1099,6 +1104,10 @@ msgctxt "view:purchase.line:"
msgid "Purchase Lines"
msgstr "Lignes d'achat"
+msgctxt "view:purchase.line:"
+msgid "Taxes"
+msgstr "Taxes"
+
msgctxt "view:purchase.product_supplier.price:"
msgid "Product Supplier Price"
msgstr "Prix du fournisseur du produit"
@@ -1172,16 +1181,16 @@ msgid "Cancel"
msgstr "Annuler"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
-msgstr "Ok"
+msgid "OK"
+msgstr "OK"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
msgid "Cancel"
msgstr "Annuler"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
-msgstr "Ok"
+msgid "OK"
+msgstr "OK"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
msgid "Cancel"
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index 247787b..eb6500f 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -842,6 +842,12 @@ msgstr "Concept"
#, fuzzy
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "Verwerking"
+
+#, fuzzy
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Offerte"
@@ -1307,7 +1313,7 @@ msgstr "Annuleren"
#, fuzzy
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Oké"
#, fuzzy
@@ -1317,7 +1323,7 @@ msgstr "Annuleren"
#, fuzzy
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Oké"
#, fuzzy
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index 95c8b7f..06e7523 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -768,6 +768,12 @@ msgctxt ""
msgid "Draft"
msgstr "Черновик"
+#, fuzzy
+msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "Обслуживание"
+
msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
@@ -1177,7 +1183,7 @@ msgid "Cancel"
msgstr "Отменить"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Ок"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1185,7 +1191,7 @@ msgid "Cancel"
msgstr "Отменить"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "Ок"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index f34a1b3..a80ffe1 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -223,7 +223,7 @@ msgstr "Na lokacijo"
msgctxt "field:purchase.line,type:"
msgid "Type"
-msgstr "Vrsta"
+msgstr "Tip"
msgctxt "field:purchase.line,unit:"
msgid "Unit"
@@ -769,6 +769,11 @@ msgid "Draft"
msgstr "Priprava"
msgctxt ""
+"model:ir.action.act_window.domain,name:act_purchase_form_domain_processing"
+msgid "Processing"
+msgstr "Obdelava"
+
+msgctxt ""
"model:ir.action.act_window.domain,name:act_purchase_form_domain_quotation"
msgid "Quotation"
msgstr "Ponudba"
@@ -1101,6 +1106,10 @@ msgctxt "view:purchase.line:"
msgid "Purchase Lines"
msgstr "Nabavne postavke"
+msgctxt "view:purchase.line:"
+msgid "Taxes"
+msgstr "Davki"
+
msgctxt "view:purchase.product_supplier.price:"
msgid "Product Supplier Price"
msgstr "Dobaviteljeva cena"
@@ -1174,7 +1183,7 @@ msgid "Cancel"
msgstr "Prekliči"
msgctxt "wizard_button:purchase.handle.invoice.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "V redu"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,end:"
@@ -1182,7 +1191,7 @@ msgid "Cancel"
msgstr "Prekliči"
msgctxt "wizard_button:purchase.handle.shipment.exception,ask,handle:"
-msgid "Ok"
+msgid "OK"
msgstr "V redu"
msgctxt "wizard_button:stock.product_quantities_warehouse,start,end:"
diff --git a/party.xml b/party.xml
index d342535..2d20034 100644
--- a/party.xml
+++ b/party.xml
@@ -6,7 +6,8 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_purchase_form2">
<field name="name">Purchases</field>
<field name="res_model">purchase.purchase</field>
- <field name="domain">[('party', 'in', Eval('active_ids'))]</field>
+ <field name="domain"
+ eval="[('party', 'in', Eval('active_ids'))]" pyson="1"/>
</record>
<record model="ir.action.keyword"
id="act_open_purchase_keyword1">
diff --git a/product.py b/product.py
index 34765a4..06d067d 100644
--- a/product.py
+++ b/product.py
@@ -1,7 +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.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
import datetime
-from sql import Literal
+
+from sql import Literal, Null
from sql.aggregate import Count
from trytond.model import ModelView, ModelSQL, MatchMixin, fields
@@ -10,6 +11,8 @@ from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
from trytond import backend
+from trytond.modules.product import price_digits
+
__all__ = ['Template', 'Product', 'ProductSupplier', 'ProductSupplierPrice']
__metaclass__ = PoolMeta
@@ -54,18 +57,22 @@ class Template:
@fields.depends('default_uom', 'purchase_uom', 'purchasable')
def on_change_default_uom(self):
try:
- changes = super(Template, self).on_change_default_uom()
+ super(Template, self).on_change_default_uom()
except AttributeError:
- changes = {}
+ pass
if self.default_uom:
if self.purchase_uom:
- if self.default_uom.category == self.purchase_uom.category:
- changes['purchase_uom'] = self.purchase_uom.id
- else:
- changes['purchase_uom'] = self.default_uom.id
+ if self.default_uom.category != self.purchase_uom.category:
+ self.purchase_uom = self.default_uom
else:
- changes['purchase_uom'] = self.default_uom.id
- return changes
+ self.purchase_uom = self.default_uom
+
+ @classmethod
+ def view_attributes(cls):
+ return super(Template, cls).view_attributes() + [
+ ('//page[@id="suppliers"]', 'states', {
+ 'invisible': ~Eval('purchasable'),
+ })]
@classmethod
def write(cls, *args):
@@ -215,7 +222,7 @@ class ProductSupplier(ModelSQL, ModelView, MatchMixin):
@staticmethod
def order_sequence(tables):
table, _ = tables[None]
- return [table.sequence == None, table.sequence]
+ return [table.sequence == Null, table.sequence]
@staticmethod
def default_company():
@@ -231,9 +238,7 @@ class ProductSupplier(ModelSQL, ModelView, MatchMixin):
@fields.depends('party')
def on_change_party(self):
cursor = Transaction().cursor
- changes = {
- 'currency': self.default_currency(),
- }
+ self.currency = self.default_currency()
if self.party:
table = self.__table__()
cursor.execute(*table.select(table.currency,
@@ -242,15 +247,18 @@ class ProductSupplier(ModelSQL, ModelView, MatchMixin):
order_by=Count(Literal(1)).desc))
row = cursor.fetchone()
if row:
- changes['currency'], = row
- return changes
+ self.currency, = row
def get_rec_name(self, name):
return '%s @ %s' % (self.product.rec_name, self.party.rec_name)
@classmethod
def search_rec_name(cls, name, clause):
- return ['OR',
+ if clause[1].startswith('!') or clause[1].startswith('not '):
+ bool_op = 'AND'
+ else:
+ bool_op = 'OR'
+ return [bool_op,
('product',) + tuple(clause[1:]),
('party',) + tuple(clause[1:]),
]
@@ -295,7 +303,8 @@ class ProductSupplierPrice(ModelSQL, ModelView, MatchMixin):
product_supplier = fields.Many2One('purchase.product_supplier',
'Supplier', required=True, ondelete='CASCADE')
quantity = fields.Float('Quantity', required=True, help='Minimal quantity')
- unit_price = fields.Numeric('Unit Price', required=True, digits=(16, 4))
+ unit_price = fields.Numeric('Unit Price', required=True,
+ digits=price_digits)
sequence = fields.Integer('Sequence')
@classmethod
@@ -322,7 +331,7 @@ class ProductSupplierPrice(ModelSQL, ModelView, MatchMixin):
@staticmethod
def order_sequence(tables):
table, _ = tables[None]
- return [table.sequence == None, table.sequence]
+ return [table.sequence == Null, table.sequence]
@staticmethod
def default_quantity():
diff --git a/purchase.odt b/purchase.odt
index 95c53f8..9d2e0ff 100644
Binary files a/purchase.odt and b/purchase.odt differ
diff --git a/purchase.py b/purchase.py
index 02ad88c..3b2a76e 100644
--- a/purchase.py
+++ b/purchase.py
@@ -1,9 +1,10 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
import datetime
from itertools import chain
from decimal import Decimal
-from sql import Table, Literal
+
+from sql import Table, Literal, Null
from sql.functions import Overlay, Position
from sql.aggregate import Count
from sql.operators import Concat
@@ -17,6 +18,9 @@ from trytond.pyson import Eval, Bool, If, PYSONEncoder, Id
from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
+from trytond.modules.account.tax import TaxableMixin
+from trytond.modules.product import price_digits
+
__all__ = ['Purchase', 'PurchaseIgnoredInvoice',
'PurchaseRecreadtedInvoice', 'PurchaseLine', 'PurchaseLineTax',
'PurchaseLineIgnoredMove', 'PurchaseLineRecreatedMove', 'PurchaseReport',
@@ -31,7 +35,7 @@ _DEPENDS = ['state']
_ZERO = Decimal(0)
-class Purchase(Workflow, ModelSQL, ModelView):
+class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin):
'Purchase'
__name__ = 'purchase.purchase'
_rec_name = 'reference'
@@ -152,8 +156,10 @@ class Purchase(Workflow, ModelSQL, ModelView):
@classmethod
def __setup__(cls):
super(Purchase, cls).__setup__()
- cls._order.insert(0, ('purchase_date', 'DESC'))
- cls._order.insert(1, ('id', 'DESC'))
+ cls._order = [
+ ('purchase_date', 'DESC'),
+ ('id', 'DESC'),
+ ]
cls._error_messages.update({
'warehouse_required': ('A warehouse must be defined for '
'quotation of purchase "%s".'),
@@ -288,8 +294,8 @@ class Purchase(Workflow, ModelSQL, ModelView):
purchase_line.id))
).select(sql_table.id,
where=((sql_table.state == 'confirmed')
- & ((invoice_line.id != None)
- | (move.id != None))))
+ & ((invoice_line.id != Null)
+ | (move.id != Null))))
cursor.execute(*sql_table.update(
columns=[sql_table.state],
values=['processing'],
@@ -355,23 +361,19 @@ class Purchase(Workflow, ModelSQL, ModelView):
@fields.depends('party', 'payment_term', 'lines')
def on_change_party(self):
pool = Pool()
- PaymentTerm = pool.get('account.invoice.payment_term')
Currency = pool.get('currency.currency')
cursor = Transaction().cursor
table = self.__table__()
- changes = {
- 'invoice_address': None,
- 'payment_term': None,
- }
+ self.invoice_address = None
+ self.payment_term = self.default_payment_term()
if not self.lines:
- changes['currency'] = self.default_currency()
- changes['currency_digits'] = self.default_currency_digits()
- invoice_address = None
- payment_term = None
+ self.currency = self.default_currency()
+ self.currency_digits = self.default_currency_digits()
+ self.invoice_address = None
if self.party:
- invoice_address = self.party.address_get(type='invoice')
+ self.invoice_address = self.party.address_get(type='invoice')
if self.party.supplier_payment_term:
- payment_term = self.party.supplier_payment_term
+ self.payment_term = self.party.supplier_payment_term
if not self.lines:
subquery = table.select(table.currency,
@@ -384,24 +386,8 @@ class Purchase(Workflow, ModelSQL, ModelView):
row = cursor.fetchone()
if row:
currency_id, = row
- currency = Currency(currency_id)
- changes['currency'] = currency.id
- changes['currency_digits'] = currency.digits
-
- if invoice_address:
- changes['invoice_address'] = invoice_address.id
- changes['invoice_address.rec_name'] = invoice_address.rec_name
- else:
- changes['invoice_address'] = None
- if payment_term:
- changes['payment_term'] = payment_term.id
- changes['payment_term.rec_name'] = payment_term.rec_name
- else:
- changes['payment_term'] = self.default_payment_term()
- if changes['payment_term']:
- changes['payment_term.rec_name'] = PaymentTerm(
- changes['payment_term']).rec_name
- return changes
+ self.currency = Currency(currency_id)
+ self.currency_digits = self.currency.digits
@fields.depends('currency')
def on_change_with_currency_digits(self, name=None):
@@ -417,7 +403,7 @@ class Purchase(Workflow, ModelSQL, ModelView):
return self.party.lang.code
return Config.get_language()
- def get_tax_context(self):
+ def _get_tax_context(self):
context = {}
if self.party and self.party.lang:
context['language'] = self.party.lang.code
@@ -425,91 +411,47 @@ class Purchase(Workflow, ModelSQL, ModelView):
@fields.depends('lines', 'currency', 'party')
def on_change_lines(self):
- pool = Pool()
- Tax = pool.get('account.tax')
- Invoice = pool.get('account.invoice')
- Configuration = pool.get('account.configuration')
-
- config = Configuration(1)
-
- changes = {
- 'untaxed_amount': Decimal('0.0'),
- 'tax_amount': Decimal('0.0'),
- 'total_amount': Decimal('0.0'),
- }
+ self.untaxed_amount = Decimal('0.0')
+ self.tax_amount = Decimal('0.0')
+ self.total_amount = Decimal('0.0')
+ taxes = {}
if self.lines:
- context = self.get_tax_context()
- taxes = {}
-
- def round_taxes():
- if self.currency:
- for key, value in taxes.iteritems():
- taxes[key] = self.currency.round(value)
-
for line in self.lines:
- if getattr(line, 'type', 'line') != 'line':
- continue
- changes['untaxed_amount'] += (getattr(line, 'amount', None)
- or Decimal(0))
-
- with Transaction().set_context(context):
- tax_list = Tax.compute(getattr(line, 'taxes', []),
- getattr(line, 'unit_price', None) or Decimal('0.0'),
- getattr(line, 'quantity', None) or 0.0)
- for tax in tax_list:
- key, val = Invoice._compute_tax(tax, 'in_invoice')
- if key not in taxes:
- taxes[key] = val['amount']
- else:
- taxes[key] += val['amount']
- if config.tax_rounding == 'line':
- round_taxes()
- if config.tax_rounding == 'document':
- round_taxes()
- changes['tax_amount'] = sum(taxes.itervalues(), Decimal('0.0'))
+ self.untaxed_amount += getattr(line, 'amount', None) or 0
+ taxes = self._get_taxes()
+ self.tax_amount = sum(t['amount'] for t in taxes.itervalues())
if self.currency:
- changes['untaxed_amount'] = self.currency.round(
- changes['untaxed_amount'])
- changes['tax_amount'] = self.currency.round(changes['tax_amount'])
- changes['total_amount'] = (changes['untaxed_amount']
- + changes['tax_amount'])
+ self.untaxed_amount = self.currency.round(self.untaxed_amount)
+ self.tax_amount = self.currency.round(self.tax_amount)
+ self.total_amount = self.untaxed_amount + self.tax_amount
if self.currency:
- changes['total_amount'] = self.currency.round(
- changes['total_amount'])
- return changes
-
- def get_tax_amount(self):
- pool = Pool()
- Tax = pool.get('account.tax')
- Invoice = pool.get('account.invoice')
- Configuration = pool.get('account.configuration')
-
- config = Configuration(1)
-
- context = self.get_tax_context()
- taxes = {}
-
- def round_taxes():
- for key, value in taxes.iteritems():
- taxes[key] = self.currency.round(value)
+ self.total_amount = self.currency.round(self.total_amount)
+ @property
+ def taxable_lines(self):
+ taxable_lines = []
+ # In case we're called from an on_change we have to use some sensible
+ # defaults
for line in self.lines:
- if line.type != 'line':
+ if getattr(line, 'type', None) != 'line':
continue
- with Transaction().set_context(context):
- tax_list = Tax.compute(line.taxes, line.unit_price,
- line.quantity)
- for tax in tax_list:
- key, val = Invoice._compute_tax(tax, 'in_invoice')
- if key not in taxes:
- taxes[key] = val['amount']
- else:
- taxes[key] += val['amount']
- if config.tax_rounding == 'line':
- round_taxes()
- if config.tax_rounding == 'document':
- round_taxes()
- return sum(taxes.itervalues(), _ZERO)
+ taxable_lines.append(tuple())
+ for attribute, default_value in (
+ ('taxes', []),
+ ('unit_price', Decimal(0)),
+ ('quantity', 0.0)):
+ value = getattr(line, attribute, None)
+ taxable_lines[-1] += (value
+ if value is not None else default_value,)
+ return taxable_lines
+
+ @property
+ def tax_type(self):
+ return 'invoice'
+
+ def get_tax_amount(self):
+ taxes = self._get_taxes().itervalues()
+ return sum(tax['amount'] for tax in taxes)
@classmethod
def get_amount(cls, purchases, names):
@@ -639,16 +581,24 @@ class Purchase(Workflow, ModelSQL, ModelView):
@classmethod
def search_rec_name(cls, name, clause):
_, operator, value = clause
+ if operator[1].startswith('!') or operator[1].startswith('not '):
+ bool_op = 'AND'
+ else:
+ bool_op = 'OR'
names = value.split(' - ', 1)
- domain = ['OR',
+ domain = [bool_op,
('reference', operator, names[0]),
('supplier_reference', operator, names[0]),
]
if len(names) != 1 and names[1]:
- domain = [domain, ('party', operator, names[1])]
+ domain = [bool_op, domain, ('party', operator, names[1])]
return domain
@classmethod
+ def view_attributes(cls):
+ return [('//field[@name="comment"]', 'spell', Eval('party_lang'))]
+
+ @classmethod
def copy(cls, purchases, default=None):
if default is None:
default = {}
@@ -956,7 +906,7 @@ class PurchaseLine(ModelSQL, ModelView):
product_uom_category = fields.Function(
fields.Many2One('product.uom.category', 'Product Uom Category'),
'on_change_with_product_uom_category')
- unit_price = fields.Numeric('Unit Price', digits=(16, 4),
+ unit_price = fields.Numeric('Unit Price', digits=price_digits,
states={
'invisible': Eval('type') != 'line',
'required': Eval('type') == 'line',
@@ -973,9 +923,12 @@ class PurchaseLine(ModelSQL, ModelView):
note = fields.Text('Note')
taxes = fields.Many2Many('purchase.line-account.tax',
'line', 'tax', 'Taxes',
+ order=[('tax.sequence', 'ASC'), ('tax.id', 'ASC')],
domain=[('parent', '=', None), ['OR',
('group', '=', None),
('group.kind', 'in', ['purchase', 'both'])],
+ ('company', '=',
+ Eval('_parent_purchase', {}).get('company', -1)),
],
states={
'invisible': Eval('type') != 'line',
@@ -1037,7 +990,7 @@ class PurchaseLine(ModelSQL, ModelView):
@staticmethod
def order_sequence(tables):
table, _ = tables[None]
- return [table.sequence == None, table.sequence]
+ return [table.sequence == Null, table.sequence]
@staticmethod
def default_type():
@@ -1098,6 +1051,7 @@ class PurchaseLine(ModelSQL, ModelView):
context['uom'] = self.unit.id
else:
self.product.purchase_uom.id
+ context['taxes'] = [t.id for t in self.taxes]
return context
@fields.depends('product', 'unit', 'quantity', 'description',
@@ -1107,8 +1061,7 @@ class PurchaseLine(ModelSQL, ModelView):
Product = Pool().get('product.product')
if not self.product:
- return {}
- res = {}
+ return
context = {}
party = None
@@ -1117,69 +1070,70 @@ class PurchaseLine(ModelSQL, ModelView):
if party.lang:
context['language'] = party.lang.code
- category = self.product.purchase_uom.category
- if not self.unit or self.unit not in category.uoms:
- res['unit'] = self.product.purchase_uom.id
- self.unit = self.product.purchase_uom
- res['unit.rec_name'] = self.product.purchase_uom.rec_name
- res['unit_digits'] = self.product.purchase_uom.digits
-
- with Transaction().set_context(self._get_context_purchase_price()):
- res['unit_price'] = Product.get_purchase_price([self.product],
- abs(self.quantity or 0))[self.product.id]
- if res['unit_price']:
- res['unit_price'] = res['unit_price'].quantize(
- Decimal(1) / 10 ** self.__class__.unit_price.digits[1])
- res['taxes'] = []
+ # Set taxes before unit_price to have taxes in context of purchase
+ # price
+ taxes = []
pattern = self._get_tax_rule_pattern()
for tax in self.product.supplier_taxes_used:
if party and party.supplier_tax_rule:
tax_ids = party.supplier_tax_rule.apply(tax, pattern)
if tax_ids:
- res['taxes'].extend(tax_ids)
+ taxes.extend(tax_ids)
continue
- res['taxes'].append(tax.id)
+ taxes.append(tax)
if party and party.supplier_tax_rule:
tax_ids = party.supplier_tax_rule.apply(None, pattern)
if tax_ids:
- res['taxes'].extend(tax_ids)
+ taxes.extend(tax_ids)
+ self.taxes = taxes
+
+ category = self.product.purchase_uom.category
+ if not self.unit or self.unit not in category.uoms:
+ self.unit = self.product.purchase_uom
+ self.unit_digits = self.product.purchase_uom.digits
+
+ with Transaction().set_context(self._get_context_purchase_price()):
+ self.unit_price = Product.get_purchase_price([self.product],
+ abs(self.quantity or 0))[self.product.id]
+ if self.unit_price:
+ self.unit_price = self.unit_price.quantize(
+ Decimal(1) / 10 ** self.__class__.unit_price.digits[1])
if not self.description:
with Transaction().set_context(context):
- res['description'] = Product(self.product.id).rec_name
+ self.description = Product(self.product.id).rec_name
- self.unit_price = res['unit_price']
self.type = 'line'
- res['amount'] = self.on_change_with_amount()
- return res
+ self.amount = self.on_change_with_amount()
@fields.depends('product')
def on_change_with_product_uom_category(self, name=None):
if self.product:
return self.product.default_uom_category.id
- @fields.depends('product', 'quantity', 'unit',
+ @fields.depends('product', 'quantity', 'unit', 'taxes',
'_parent_purchase.currency', '_parent_purchase.party',
'_parent_purchase.purchase_date')
def on_change_quantity(self):
Product = Pool().get('product.product')
if not self.product:
- return {}
- res = {}
+ return
with Transaction().set_context(self._get_context_purchase_price()):
- res['unit_price'] = Product.get_purchase_price([self.product],
+ self.unit_price = Product.get_purchase_price([self.product],
abs(self.quantity or 0))[self.product.id]
- if res['unit_price']:
- res['unit_price'] = res['unit_price'].quantize(
+ if self.unit_price:
+ self.unit_price = self.unit_price.quantize(
Decimal(1) / 10 ** self.__class__.unit_price.digits[1])
- return res
- @fields.depends('product', 'quantity', 'unit',
- '_parent_purchase.currency', '_parent_purchase.party')
+ @fields.depends(methods=['quantity'])
def on_change_unit(self):
- return self.on_change_quantity()
+ self.on_change_quantity()
+
+ @fields.depends(methods=['quantity'])
+ def on_change_taxes(self):
+ self.on_change_quantity()
@fields.depends('type', 'quantity', 'unit_price', 'unit',
'_parent_purchase.currency')
@@ -1289,8 +1243,15 @@ class PurchaseLine(ModelSQL, ModelView):
if old_invoice_line.type != 'line':
continue
if old_invoice_line.id not in skip_ids:
+ if old_invoice_line.invoice:
+ old_invoice_type = old_invoice_line.invoice.type
+ else:
+ old_invoice_type = old_invoice_line.invoice_type
+
+ sign = 1 if old_invoice_type == invoice_type else -1
+
quantity -= Uom.compute_qty(old_invoice_line.unit,
- old_invoice_line.quantity, self.unit)
+ sign * old_invoice_line.quantity, self.unit)
rounding = self.unit.rounding if self.unit else 0.01
invoice_line.quantity = Uom.round(quantity, rounding)
@@ -1320,6 +1281,11 @@ class PurchaseLine(ModelSQL, ModelView):
return [invoice_line]
@classmethod
+ def view_attributes(cls):
+ return [('//field[@name="note"]|//field[@name="description"]',
+ 'spell', Eval('_parent_purchase', {}).get('party_lang'))]
+
+ @classmethod
def copy(cls, lines, default=None):
if default is None:
default = {}
@@ -1485,7 +1451,7 @@ class HandleShipmentException(Wizard):
ask = StateView('purchase.handle.shipment.exception.ask',
'purchase.handle_shipment_exception_ask_view_form', [
Button('Cancel', 'end', 'tryton-cancel'),
- Button('Ok', 'handle', 'tryton-ok', default=True),
+ Button('OK', 'handle', 'tryton-ok', default=True),
])
handle = StateTransition()
@@ -1556,7 +1522,7 @@ class HandleInvoiceException(Wizard):
ask = StateView('purchase.handle.invoice.exception.ask',
'purchase.handle_invoice_exception_ask_view_form', [
Button('Cancel', 'end', 'tryton-cancel'),
- Button('Ok', 'handle', 'tryton-ok', default=True),
+ Button('OK', 'handle', 'tryton-ok', default=True),
])
handle = StateTransition()
diff --git a/purchase.xml b/purchase.xml
index 71eb30b..051e0a6 100644
--- a/purchase.xml
+++ b/purchase.xml
@@ -69,7 +69,9 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_shipment_form">
<field name="name">Shipments</field>
<field name="res_model">stock.shipment.in</field>
- <field name="domain">[('moves.purchase', 'in', Eval('active_ids'))]</field>
+ <field name="domain"
+ eval="[('moves.purchase', 'in', Eval('active_ids'))]"
+ pyson="1"/>
</record>
<record model="ir.action.keyword"
id="act_open_shipment_keyword1">
@@ -80,7 +82,9 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_return_form">
<field name="name">Returns</field>
<field name="res_model">stock.shipment.in.return</field>
- <field name="domain">[('moves.purchase', 'in', Eval('active_ids'))]</field>
+ <field name="domain"
+ eval="[('moves.purchase', 'in', Eval('active_ids'))]"
+ pyson="1"/>
</record>
<record model="ir.action.keyword"
id="act_open_shipment_return_keyword1">
@@ -91,7 +95,9 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_invoice_form">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
- <field name="domain">[('lines.origin.purchase.id', 'in', Eval('active_ids'), 'purchase.line')]</field>
+ <field name="domain"
+ eval="[('lines.origin.purchase.id', 'in', Eval('active_ids'), 'purchase.line')]"
+ pyson="1"/>
</record>
<record model="ir.action.keyword"
id="act_open_invoice_keyword1">
@@ -131,21 +137,28 @@ this repository contains the full copyright notices and license terms. -->
id="act_purchase_form_domain_draft">
<field name="name">Draft</field>
<field name="sequence" eval="10"/>
- <field name="domain">[('state', '=', 'draft')]</field>
+ <field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
<field name="act_window" ref="act_purchase_form"/>
</record>
<record model="ir.action.act_window.domain"
id="act_purchase_form_domain_quotation">
<field name="name">Quotation</field>
<field name="sequence" eval="20"/>
- <field name="domain">[('state', '=', 'quotation')]</field>
+ <field name="domain" eval="[('state', '=', 'quotation')]" pyson="1"/>
<field name="act_window" ref="act_purchase_form"/>
</record>
<record model="ir.action.act_window.domain"
id="act_purchase_form_domain_confirmed">
<field name="name">Confirmed</field>
<field name="sequence" eval="30"/>
- <field name="domain">[('state', '=', 'confirmed')]</field>
+ <field name="domain" eval="[('state', '=', 'confirmed')]" pyson="1"/>
+ <field name="act_window" ref="act_purchase_form"/>
+ </record>
+ <record model="ir.action.act_window.domain"
+ id="act_purchase_form_domain_processing">
+ <field name="name">Processing</field>
+ <field name="sequence" eval="40"/>
+ <field name="domain" eval="[('state', '=', 'processing')]" pyson="1"/>
<field name="act_window" ref="act_purchase_form"/>
</record>
<record model="ir.action.act_window.domain"
@@ -165,7 +178,8 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_purchase_invoice_relate">
<field name="name">Purchases</field>
<field name="res_model">purchase.purchase</field>
- <field name="domain">[('invoices', 'in', Eval('active_ids'))]</field>
+ <field name="domain"
+ eval="[('invoices', 'in', Eval('active_ids'))]" pyson="1"/>
</record>
<record model="ir.action.act_window.view"
id="act_purchase_invoice_relate_view1">
@@ -378,7 +392,9 @@ this repository contains the full copyright notices and license terms. -->
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_product_supplier">
- <field name="domain">[('company', '=', user.company.id if user.company else None)]</field>
+ <field name="domain"
+ eval="[('company', '=', Eval('user', {}).get('company', None))]"
+ pyson="1"/>
<field name="rule_group" ref="rule_group_product_supplier"/>
</record>
@@ -418,7 +434,9 @@ this repository contains the full copyright notices and license terms. -->
id="act_product_supplier_price_form">
<field name="name">Prices</field>
<field name="res_model">purchase.product_supplier.price</field>
- <field name="domain">[('product_supplier', 'in', Eval('active_ids'))]</field>
+ <field name="domain"
+ eval="[('product_supplier', 'in', Eval('active_ids'))]"
+ pyson="1"/>
</record>
<record model="ir.action.keyword"
id="act_product_supplier_price_form_keyword1">
@@ -475,7 +493,9 @@ this repository contains the full copyright notices and license terms. -->
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_purchase1">
- <field name="domain">[('company', '=', user.company.id if user.company else None)]</field>
+ <field name="domain"
+ eval="[('company', '=', Eval('user', {}).get('company', None))]"
+ pyson="1"/>
<field name="rule_group" ref="rule_group_purchase"/>
</record>
diff --git a/setup.py b/setup.py
index 85157a3..34ee2d3 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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 setuptools import setup
import re
@@ -41,7 +41,7 @@ if minor_version % 2:
'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
name[8:], name, version))
-requires = ['python-sql']
+requires = ['python-sql >= 0.4']
for dep in info.get('depends', []):
if not re.match(r'(ir|res|webdav)(\W|$)', dep):
requires.append(get_require_version('trytond_%s' % dep))
@@ -92,6 +92,8 @@ setup(name=name,
'Natural Language :: Spanish',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: Implementation :: CPython',
+ 'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business',
'Topic :: Office/Business :: Financial :: Accounting',
],
diff --git a/stock.py b/stock.py
index a74e90d..6c95b38 100644
--- a/stock.py
+++ b/stock.py
@@ -1,6 +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.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
import datetime
+
+from sql import Null
from sql.operators import Concat
from trytond.model import Workflow, ModelView, fields
@@ -11,6 +13,8 @@ from trytond.transaction import Transaction
from trytond.pyson import PYSONDecoder, PYSONEncoder
from trytond import backend
+from trytond.modules.product import price_digits
+
__all__ = ['ShipmentIn', 'ShipmentInReturn', 'Move',
'OpenProductQuantitiesByWarehouse']
__metaclass__ = PoolMeta
@@ -158,7 +162,7 @@ class Move:
purchase_unit_digits = fields.Function(fields.Integer(
'Purchase Unit Digits'), 'get_purchase_fields')
purchase_unit_price = fields.Function(fields.Numeric('Purchase Unit Price',
- digits=(16, 4), states={
+ digits=price_digits, states={
'invisible': ~Eval('purchase_visible', False),
}, depends=['purchase_visible']), 'get_purchase_fields')
purchase_currency = fields.Function(fields.Many2One('currency.currency',
@@ -190,7 +194,7 @@ class Move:
cursor.execute(*sql_table.update(
columns=[sql_table.origin],
values=[Concat('purchase.line,', sql_table.purchase_line)],
- where=sql_table.purchase_line != None))
+ where=sql_table.purchase_line != Null))
table.drop_column('purchase_line')
@classmethod
diff --git a/tests/__init__.py b/tests/__init__.py
index f648605..d69a38c 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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 .test_purchase import suite
diff --git a/tests/scenario_purchase.rst b/tests/scenario_purchase.rst
index 4c08939..70a276a 100644
--- a/tests/scenario_purchase.rst
+++ b/tests/scenario_purchase.rst
@@ -8,7 +8,13 @@ Imports::
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
>>> from operator import attrgetter
- >>> from proteus import config, Model, Wizard
+ >>> from proteus import config, Model, Wizard, Report
+ >>> from trytond.modules.company.tests.tools import create_company, \
+ ... get_company
+ >>> from trytond.modules.account.tests.tools import create_fiscalyear, \
+ ... create_chart, get_accounts, create_tax
+ >>> from.trytond.modules.account_invoice.tests.tools import \
+ ... set_fiscalyear_invoice_sequences, create_payment_term
>>> today = datetime.date.today()
Create database::
@@ -20,34 +26,13 @@ Install purchase::
>>> Module = Model.get('ir.module.module')
>>> purchase_module, = Module.find([('name', '=', 'purchase')])
- >>> Module.install([purchase_module.id], config.context)
+ >>> purchase_module.click('install')
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
Create company::
- >>> Currency = Model.get('currency.currency')
- >>> CurrencyRate = Model.get('currency.currency.rate')
- >>> currencies = Currency.find([('code', '=', 'USD')])
- >>> if not currencies:
- ... currency = Currency(name='U.S. Dollar', symbol='$', code='USD',
- ... rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
- ... mon_decimal_point='.', mon_thousands_sep=',')
- ... currency.save()
- ... CurrencyRate(date=today + relativedelta(month=1, day=1),
- ... rate=Decimal('1.0'), currency=currency).save()
- ... else:
- ... currency, = currencies
- >>> Company = Model.get('company.company')
- >>> Party = Model.get('party.party')
- >>> company_config = Wizard('company.company.config')
- >>> company_config.execute('company')
- >>> company = company_config.form
- >>> party = Party(name='Dunder Mifflin')
- >>> party.save()
- >>> company.party = party
- >>> company.currency = currency
- >>> company_config.execute('add')
- >>> company, = Company.find([])
+ >>> _ = create_company()
+ >>> company = get_company()
Reload the context::
@@ -87,67 +72,29 @@ Create account user::
Create fiscal year::
- >>> FiscalYear = Model.get('account.fiscalyear')
- >>> Sequence = Model.get('ir.sequence')
- >>> SequenceStrict = Model.get('ir.sequence.strict')
- >>> fiscalyear = FiscalYear(name=str(today.year))
- >>> fiscalyear.start_date = today + relativedelta(month=1, day=1)
- >>> fiscalyear.end_date = today + relativedelta(month=12, day=31)
- >>> fiscalyear.company = company
- >>> post_move_seq = Sequence(name=str(today.year), code='account.move',
- ... company=company)
- >>> post_move_seq.save()
- >>> fiscalyear.post_move_sequence = post_move_seq
- >>> invoice_seq = SequenceStrict(name=str(today.year),
- ... code='account.invoice', company=company)
- >>> invoice_seq.save()
- >>> fiscalyear.out_invoice_sequence = invoice_seq
- >>> fiscalyear.in_invoice_sequence = invoice_seq
- >>> fiscalyear.out_credit_note_sequence = invoice_seq
- >>> fiscalyear.in_credit_note_sequence = invoice_seq
- >>> fiscalyear.save()
- >>> FiscalYear.create_period([fiscalyear.id], config.context)
+ >>> fiscalyear = set_fiscalyear_invoice_sequences(
+ ... create_fiscalyear(company))
+ >>> fiscalyear.click('create_period')
Create chart of accounts::
- >>> AccountTemplate = Model.get('account.account.template')
- >>> Account = Model.get('account.account')
+ >>> _ = create_chart(company)
+ >>> accounts = get_accounts(company)
+ >>> revenue = accounts['revenue']
+ >>> expense = accounts['expense']
+ >>> cash = accounts['cash']
+
>>> Journal = Model.get('account.journal')
- >>> account_template, = AccountTemplate.find([('parent', '=', None)])
- >>> create_chart = Wizard('account.create_chart')
- >>> create_chart.execute('account')
- >>> create_chart.form.account_template = account_template
- >>> create_chart.form.company = company
- >>> create_chart.execute('create_account')
- >>> receivable, = Account.find([
- ... ('kind', '=', 'receivable'),
- ... ('company', '=', company.id),
- ... ])
- >>> payable, = Account.find([
- ... ('kind', '=', 'payable'),
- ... ('company', '=', company.id),
- ... ])
- >>> revenue, = Account.find([
- ... ('kind', '=', 'revenue'),
- ... ('company', '=', company.id),
- ... ])
- >>> expense, = Account.find([
- ... ('kind', '=', 'expense'),
- ... ('company', '=', company.id),
- ... ])
- >>> create_chart.form.account_receivable = receivable
- >>> create_chart.form.account_payable = payable
- >>> create_chart.execute('create_properties')
- >>> cash, = Account.find([
- ... ('kind', '=', 'other'),
- ... ('name', '=', 'Main Cash'),
- ... ('company', '=', company.id),
- ... ])
>>> cash_journal, = Journal.find([('type', '=', 'cash')])
>>> cash_journal.credit_account = cash
>>> cash_journal.debit_account = cash
>>> cash_journal.save()
+Create tax::
+
+ >>> tax = create_tax(Decimal('.10'))
+ >>> tax.save()
+
Create parties::
>>> Party = Model.get('party.party')
@@ -174,6 +121,7 @@ Create product::
>>> template.cost_price_method = 'fixed'
>>> template.account_expense = expense
>>> template.account_revenue = revenue
+ >>> template.supplier_taxes.append(tax)
>>> template.save()
>>> product.template = template
>>> product.save()
@@ -195,31 +143,23 @@ Create product::
Create payment term::
- >>> PaymentTerm = Model.get('account.invoice.payment_term')
- >>> PaymentTermLine = Model.get('account.invoice.payment_term.line')
- >>> payment_term = PaymentTerm(name='Direct')
- >>> payment_term_line = PaymentTermLine(type='remainder', days=0)
- >>> payment_term.lines.append(payment_term_line)
+ >>> payment_term = create_payment_term()
>>> payment_term.save()
Create an Inventory::
>>> config.user = stock_user.id
>>> Inventory = Model.get('stock.inventory')
- >>> InventoryLine = Model.get('stock.inventory.line')
>>> Location = Model.get('stock.location')
>>> storage, = Location.find([
... ('code', '=', 'STO'),
... ])
>>> inventory = Inventory()
>>> inventory.location = storage
- >>> inventory.save()
- >>> inventory_line = InventoryLine(product=product, inventory=inventory)
+ >>> inventory_line = inventory.lines.new(product=product)
>>> inventory_line.quantity = 100.0
>>> inventory_line.expected_quantity = 0.0
- >>> inventory.save()
- >>> inventory_line.save()
- >>> Inventory.confirm([inventory.id], config.context)
+ >>> inventory.click('confirm')
>>> inventory.state
u'done'
@@ -245,8 +185,14 @@ Purchase 5 products::
>>> purchase_line.product = product
>>> purchase_line.quantity = 3.0
>>> purchase.click('quote')
+ >>> purchase.untaxed_amount, purchase.tax_amount, purchase.total_amount
+ (Decimal('25.00'), Decimal('2.50'), Decimal('27.50'))
>>> purchase.click('confirm')
+ >>> purchase.untaxed_amount, purchase.tax_amount, purchase.total_amount
+ (Decimal('25.00'), Decimal('2.50'), Decimal('27.50'))
>>> purchase.click('process')
+ >>> purchase.untaxed_amount, purchase.tax_amount, purchase.total_amount
+ (Decimal('25.00'), Decimal('2.50'), Decimal('27.50'))
>>> purchase.state
u'processing'
>>> len(purchase.moves), len(purchase.shipment_returns), len(purchase.invoices)
@@ -329,8 +275,8 @@ Validate Shipments::
>>> shipment.save()
>>> shipment.origins == purchase.rec_name
True
- >>> ShipmentIn.receive([shipment.id], config.context)
- >>> ShipmentIn.done([shipment.id], config.context)
+ >>> shipment.click('receive')
+ >>> shipment.click('done')
>>> purchase.reload()
>>> len(purchase.shipments), len(purchase.shipment_returns)
(1, 0)
@@ -349,8 +295,7 @@ Open supplier invoice::
... line.quantity = 1
... line.save()
>>> invoice.invoice_date = today
- >>> invoice.save()
- >>> Invoice.post([invoice.id], config.context)
+ >>> invoice.click('post')
Invoice lines must be linked to each stock moves::
@@ -368,6 +313,15 @@ Check second invoices::
>>> sum(l.quantity for i in purchase.invoices for l in i.lines)
5.0
+Create the report::
+
+ >>> purchase_report = Report('purchase.purchase')
+ >>> ext, _, _, name = purchase_report.execute([purchase], {})
+ >>> ext
+ u'odt'
+ >>> name
+ u'Purchase'
+
Create a Return::
>>> config.user = purchase_user.id
@@ -405,10 +359,9 @@ Check Return Shipments::
u'product'
>>> move_return.quantity
4.0
- >>> ShipmentReturn.assign_try([ship_return.id], config.context)
+ >>> ship_return.click('assign_try')
True
- >>> ShipmentReturn.done([ship_return.id], config.context)
- >>> ship_return.reload()
+ >>> ship_return.click('done')
>>> ship_return.state
u'done'
>>> return_.reload()
@@ -426,8 +379,7 @@ Open supplier credit note::
>>> sum(l.quantity for l in credit_note.lines)
4.0
>>> credit_note.invoice_date = today
- >>> credit_note.save()
- >>> Invoice.post([credit_note.id], config.context)
+ >>> credit_note.click('post')
Mixing return and purchase::
@@ -459,27 +411,26 @@ Mixing return and purchase::
Checking Shipments::
- >>> mix_returns, = mix.shipment_returns
+ >>> mix_return, = mix.shipment_returns
>>> config.user = stock_user.id
- >>> mix_shipments = ShipmentIn()
- >>> mix_shipments.supplier = supplier
+ >>> mix_shipment = ShipmentIn()
+ >>> mix_shipment.supplier = supplier
>>> for move in mix.moves:
- ... if move.id in [m.id for m in mix_returns.moves]:
+ ... if move.id in [m.id for m in mix_return.moves]:
... continue
... incoming_move = Move(id=move.id)
- ... mix_shipments.incoming_moves.append(incoming_move)
- >>> mix_shipments.save()
- >>> ShipmentIn.receive([mix_shipments.id], config.context)
- >>> ShipmentIn.done([mix_shipments.id], config.context)
+ ... mix_shipment.incoming_moves.append(incoming_move)
+ >>> mix_shipment.click('receive')
+ >>> mix_shipment.click('done')
>>> mix.reload()
>>> len(mix.shipments)
1
- >>> ShipmentReturn.wait([mix_returns.id], config.context)
- >>> ShipmentReturn.assign_try([mix_returns.id], config.context)
+ >>> mix_return.click('wait')
+ >>> mix_return.click('assign_try')
True
- >>> ShipmentReturn.done([mix_returns.id], config.context)
- >>> move_return, = mix_returns.moves
+ >>> mix_return.click('done')
+ >>> move_return, = mix_return.moves
>>> move_return.product.rec_name
u'product'
>>> move_return.quantity
@@ -503,11 +454,9 @@ Checking the invoice::
>>> sum(l.quantity for l in mix_credit_note.lines)
2.0
>>> mix_invoice.invoice_date = today
- >>> mix_invoice.save()
- >>> Invoice.post([mix_invoice.id], config.context)
+ >>> mix_invoice.click('post')
>>> mix_credit_note.invoice_date = today
- >>> mix_credit_note.save()
- >>> Invoice.post([mix_credit_note.id], config.context)
+ >>> mix_credit_note.click('post')
Mixing stuff with an invoice method 'on shipment'::
@@ -540,26 +489,25 @@ Mixing stuff with an invoice method 'on shipment'::
Checking Shipments::
>>> config.user = stock_user.id
- >>> mix_returns, = mix.shipment_returns
- >>> mix_shipments = ShipmentIn()
- >>> mix_shipments.supplier = supplier
+ >>> mix_return, = mix.shipment_returns
+ >>> mix_shipment = ShipmentIn()
+ >>> mix_shipment.supplier = supplier
>>> for move in mix.moves:
- ... if move.id in [m.id for m in mix_returns.moves]:
+ ... if move.id in [m.id for m in mix_return.moves]:
... continue
... incoming_move = Move(id=move.id)
- ... mix_shipments.incoming_moves.append(incoming_move)
- >>> mix_shipments.save()
- >>> ShipmentIn.receive([mix_shipments.id], config.context)
- >>> ShipmentIn.done([mix_shipments.id], config.context)
+ ... mix_shipment.incoming_moves.append(incoming_move)
+ >>> mix_shipment.click('receive')
+ >>> mix_shipment.click('done')
>>> mix.reload()
>>> len(mix.shipments)
1
- >>> ShipmentReturn.wait([mix_returns.id], config.context)
- >>> ShipmentReturn.assign_try([mix_returns.id], config.context)
+ >>> mix_return.click('wait')
+ >>> mix_return.click('assign_try')
True
- >>> ShipmentReturn.done([mix_returns.id], config.context)
- >>> move_return, = mix_returns.moves
+ >>> mix_return.click('done')
+ >>> move_return, = mix_return.moves
>>> move_return.product.rec_name
u'product'
>>> move_return.quantity
diff --git a/tests/test_purchase.py b/tests/test_purchase.py
index 9fa0e0f..1008b94 100644
--- a/tests/test_purchase.py
+++ b/tests/test_purchase.py
@@ -1,29 +1,19 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
import unittest
import doctest
from decimal import Decimal
import trytond.tests.test_tryton
-from trytond.tests.test_tryton import test_view, test_depends
+from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
from trytond.transaction import Transaction
-class PurchaseTestCase(unittest.TestCase):
+class PurchaseTestCase(ModuleTestCase):
'Test Purchase module'
-
- def setUp(self):
- trytond.tests.test_tryton.install_module('purchase')
-
- def test0005views(self):
- 'Test views'
- test_view('purchase')
-
- def test0006depends(self):
- 'Test depends'
- test_depends()
+ module = 'purchase'
def test_purchase_price(self):
'Test purchase price'
diff --git a/tryton.cfg b/tryton.cfg
index d735d64..33b8d6b 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.4.1
+version=3.6.0
depends:
account
account_invoice
diff --git a/trytond_purchase.egg-info/PKG-INFO b/trytond_purchase.egg-info/PKG-INFO
index 6bf3106..d47c147 100644
--- a/trytond_purchase.egg-info/PKG-INFO
+++ b/trytond_purchase.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-purchase
-Version: 3.4.1
+Version: 3.6.0
Summary: Tryton module for purchase
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.4/
+Download-URL: http://downloads.tryton.org/3.6/
Description: trytond_purchase
================
@@ -64,5 +64,7 @@ Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business
Classifier: Topic :: Office/Business :: Financial :: Accounting
diff --git a/trytond_purchase.egg-info/requires.txt b/trytond_purchase.egg-info/requires.txt
index 354776c..a18bded 100644
--- a/trytond_purchase.egg-info/requires.txt
+++ b/trytond_purchase.egg-info/requires.txt
@@ -1,11 +1,11 @@
-python-sql
-trytond_account >= 3.4, < 3.5
-trytond_account_invoice >= 3.4, < 3.5
-trytond_account_invoice_stock >= 3.4, < 3.5
-trytond_account_product >= 3.4, < 3.5
-trytond_company >= 3.4, < 3.5
-trytond_currency >= 3.4, < 3.5
-trytond_party >= 3.4, < 3.5
-trytond_product >= 3.4, < 3.5
-trytond_stock >= 3.4, < 3.5
-trytond >= 3.4, < 3.5
\ No newline at end of file
+python-sql >= 0.4
+trytond_account >= 3.6, < 3.7
+trytond_account_invoice >= 3.6, < 3.7
+trytond_account_invoice_stock >= 3.6, < 3.7
+trytond_account_product >= 3.6, < 3.7
+trytond_company >= 3.6, < 3.7
+trytond_currency >= 3.6, < 3.7
+trytond_party >= 3.6, < 3.7
+trytond_product >= 3.6, < 3.7
+trytond_stock >= 3.6, < 3.7
+trytond >= 3.6, < 3.7
\ No newline at end of file
diff --git a/view/purchase_form.xml b/view/purchase_form.xml
index c9eb522..c64c46e 100644
--- a/view/purchase_form.xml
+++ b/view/purchase_form.xml
@@ -24,7 +24,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="currency"/>
<field name="lines" colspan="4"
view_ids="purchase.purchase_line_view_tree_sequence"/>
- <group col="2" colspan="2" id="states">
+ <group col="2" colspan="2" id="states" yfill="1">
<label name="invoice_state"/>
<field name="invoice_state"/>
<label name="shipment_state"/>
@@ -32,7 +32,7 @@ this repository contains the full copyright notices and license terms. -->
<label name="state"/>
<field name="state"/>
</group>
- <group col="2" colspan="2" id="amount_buttons">
+ <group col="2" colspan="2" id="amount_buttons" yfill="1">
<label name="untaxed_amount" xalign="1.0" xexpand="1"/>
<field name="untaxed_amount" xalign="1.0" xexpand="0"/>
<label name="tax_amount" xalign="1.0" xexpand="1"/>
@@ -64,7 +64,7 @@ this repository contains the full copyright notices and license terms. -->
<label name="invoice_method"/>
<field name="invoice_method"/>
<separator name="comment" colspan="4"/>
- <field name="comment" colspan="4" spell="Eval('party_lang')"/>
+ <field name="comment" colspan="4"/>
</page>
<page string="Invoices" id="invoices">
<field name="invoices" colspan="4"/>
diff --git a/view/purchase_line_form.xml b/view/purchase_line_form.xml
index cda5196..ff62046 100644
--- a/view/purchase_line_form.xml
+++ b/view/purchase_line_form.xml
@@ -4,19 +4,18 @@ this repository contains the full copyright notices and license terms. -->
<form string="Purchase Line" cursor="product">
<label name="purchase"/>
<field name="purchase" colspan="3"/>
+ <label name="type"/>
+ <field name="type"/>
+ <label name="sequence"/>
+ <field name="sequence"/>
<notebook colspan="4">
<page string="General" id="general">
- <label name="type"/>
- <field name="type"/>
- <label name="sequence"/>
- <field name="sequence"/>
<label name="product"/>
<field name="product"
view_ids="purchase.product_view_list_purchase_line"/>
<newline/>
<label name="description"/>
- <field name="description" colspan="3"
- spell="Get(Eval('_parent_purchase', {}), 'party_lang')"/>
+ <field name="description" colspan="3" yexpand="0"/>
<label name="quantity"/>
<field name="quantity"/>
<label name="unit"/>
@@ -27,13 +26,13 @@ this repository contains the full copyright notices and license terms. -->
<field name="amount"/>
<label name="delivery_date"/>
<field name="delivery_date"/>
+ </page>
+ <page string="Taxes" id="taxes">
<field name="taxes" colspan="4"/>
</page>
<page string="Notes" id="notes">
<separator name="note" colspan="4"/>
- <field name="note" colspan="4"
- spell="Get(Eval('_parent_purchase', {}), 'party_lang')"/>
+ <field name="note" colspan="4"/>
</page>
</notebook>
- <field name="unit_digits" invisible="1" colspan="4"/>
</form>
diff --git a/view/template_form.xml b/view/template_form.xml
index 2afde82..6bdc573 100644
--- a/view/template_form.xml
+++ b/view/template_form.xml
@@ -9,9 +9,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="purchasable"/>
</xpath>
<xpath expr="/form/notebook/page[@id='general']" position="after">
- <page string="Suppliers"
- states="{'invisible': Not(Bool(Eval('purchasable')))}"
- id="suppliers">
+ <page string="Suppliers" id="suppliers">
<label name="purchasable"/>
<field name="purchasable"/>
<label name="purchase_uom"/>
--
tryton-modules-purchase
More information about the tryton-debian-vcs
mailing list