[tryton-debian-vcs] tryton-modules-sale-supply-drop-shipment branch upstream updated. upstream/3.0.0-1-g19a749b
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Tue Apr 22 13:10:29 UTC 2014
The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-sale-supply-drop-shipment.git;a=commitdiff;h=upstream/3.0.0-1-g19a749b
commit 19a749b0428622b559bd8c6ca0702ffa561e2c59
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Apr 22 14:23:28 2014 +0200
Adding upstream version 3.2.0.
diff --git a/CHANGELOG b/CHANGELOG
index cd2dc58..aeba0cd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.2.0 - 2014-04-21
+* Bug fixes (see mercurial logs for details)
+
Version 3.0.0 - 2013-10-21
* Bug fixes (see mercurial logs for details)
diff --git a/COPYRIGHT b/COPYRIGHT
index cd6950c..7bcdb7f 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (C) 2011-2013 Cédric Krier.
-Copyright (C) 2011-2013 B2CK SPRL.
+Copyright (C) 2011-2014 Cédric Krier.
+Copyright (C) 2011-2014 B2CK SPRL.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/INSTALL b/INSTALL
index 99e62b7..13ad916 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,7 +4,7 @@ Installing trytond_sale_supply_drop_shipment
Prerequisites
-------------
- * Python 2.6 or later (http://www.python.org/)
+ * Python 2.7 or later (http://www.python.org/)
* trytond (http://www.tryton.org/)
* trytond_sale (http://www.tryton.org/)
* trytond_purchase (http://www.tryton.org/)
diff --git a/PKG-INFO b/PKG-INFO
index 9c7dadf..d86a4f9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_sale_supply_drop_shipment
-Version: 3.0.0
+Version: 3.2.0
Summary: Tryton module for sale supply drop shipment
Home-page: http://www.tryton.org/
Author: Tryton
-Author-email: UNKNOWN
+Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.0/
+Download-URL: http://downloads.tryton.org/3.2/
Description: sale_supply_drop_shipment
=========================
@@ -43,6 +43,7 @@ Description: sale_supply_drop_shipment
http://www.tryton.org/
+Keywords: tryton sale supply drop shipment
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
@@ -62,7 +63,6 @@ Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Office/Business
Classifier: Topic :: Office/Business :: Financial :: Accounting
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index efec202..6f1873f 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -2,6 +2,11 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:purchase.purchase:"
+msgid "A delivery address must be defined for quotation of purchase \"%s\"."
+msgstr ""
+"S'ha de definir una adreça d'enviament pel pressupost de la compra \"%s\"."
+
msgctxt "error:stock.shipment.drop:"
msgid ""
"You cannot reset to draft move \"%s\" which was generated by a sale or a "
@@ -139,7 +144,7 @@ msgstr "Esborrany"
msgctxt ""
"model:ir.action.act_window.domain,name:act_shipment_drop_form_domain_waiting"
msgid "Waiting"
-msgstr "Esperant"
+msgstr "En espera"
msgctxt "model:ir.sequence,name:sequence_shipment_drop"
msgid "Drop Shipment"
@@ -171,7 +176,7 @@ msgstr "Esborrany"
msgctxt "selection:stock.shipment.drop,state:"
msgid "Waiting"
-msgstr "Esperant"
+msgstr "En espera"
msgctxt "view:stock.shipment.drop:"
msgid "Cancel"
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 168370c..f86811d 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -2,6 +2,12 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:purchase.purchase:"
+msgid "A delivery address must be defined for quotation of purchase \"%s\"."
+msgstr ""
+"Für Angebotsanfrage von Verkauf \"%s\" muss eine Lieferadresse angegeben "
+"werden."
+
msgctxt "error:stock.shipment.drop:"
msgid ""
"You cannot reset to draft move \"%s\" which was generated by a sale or a "
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 6faf354..d9efbfc 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -2,6 +2,12 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:purchase.purchase:"
+msgid "A delivery address must be defined for quotation of purchase \"%s\"."
+msgstr ""
+"Se debe definir una dirección de envío para el presupuesto de la compra "
+"«%s»."
+
msgctxt "error:stock.shipment.drop:"
msgid ""
"You cannot reset to draft move \"%s\" which was generated by a sale or a "
diff --git a/locale/es_ES.po b/locale/es_CO.po
similarity index 73%
copy from locale/es_ES.po
copy to locale/es_CO.po
index 1ec1316..89eb53d 100644
--- a/locale/es_ES.po
+++ b/locale/es_CO.po
@@ -2,17 +2,23 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:purchase.purchase:"
+msgid "A delivery address must be defined for quotation of purchase \"%s\"."
+msgstr ""
+"Una dirección de entrega debe definirse en la cotización de la compra "
+"\"%s\"."
+
msgctxt "error:stock.shipment.drop:"
msgid ""
"You cannot reset to draft move \"%s\" which was generated by a sale or a "
"purchase."
msgstr ""
-"No puede restaurar a borrador el movimiento \"%s\" generado por una venta o "
-"una compra."
+"No puede devolver a borrador el movimiento \"%s\" porque fue generado por "
+"una venta o compra."
msgctxt "field:purchase.product_supplier,drop_shipment:"
msgid "Drop Shipment"
-msgstr "Envío directo"
+msgstr "Entrega de Envío"
msgctxt "field:purchase.purchase,customer:"
msgid "Customer"
@@ -20,11 +26,11 @@ msgstr "Cliente"
msgctxt "field:purchase.purchase,delivery_address:"
msgid "Delivery Address"
-msgstr "Dirección envío"
+msgstr "Dirección de Envío"
msgctxt "field:purchase.purchase,drop_shipments:"
msgid "Drop Shipments"
-msgstr "Envíos directos"
+msgstr "Entrega de Envíos"
msgctxt "field:purchase.request,customer:"
msgid "Customer"
@@ -32,19 +38,19 @@ msgstr "Cliente"
msgctxt "field:purchase.request,delivery_address:"
msgid "Delivery Address"
-msgstr "Dirección envío"
+msgstr "Dirección de Envío"
msgctxt "field:sale.sale,drop_shipments:"
msgid "Drop Shipments"
-msgstr "Envíos directos"
+msgstr "Entrega de Envíos"
msgctxt "field:stock.configuration,shipment_drop_sequence:"
msgid "Drop Shipment Sequence"
-msgstr "Secuencia de envío directo"
+msgstr "Secuencia Entrega de Envíos"
msgctxt "field:stock.move,customer_drop:"
msgid "Drop Customer"
-msgstr "Cliente de envío directo"
+msgstr "Cliente a Entregar"
msgctxt "field:stock.shipment.drop,code:"
msgid "Code"
@@ -52,19 +58,19 @@ msgstr "Código"
msgctxt "field:stock.shipment.drop,company:"
msgid "Company"
-msgstr "Empresa"
+msgstr "Compañía"
msgctxt "field:stock.shipment.drop,contact_address:"
msgid "Contact Address"
-msgstr "Dirección de contacto"
+msgstr "Dirección de Contacto"
msgctxt "field:stock.shipment.drop,create_date:"
msgid "Create Date"
-msgstr "Fecha creación"
+msgstr "Fecha de Creación"
msgctxt "field:stock.shipment.drop,create_uid:"
msgid "Create User"
-msgstr "Usuario creación"
+msgstr "Creado por Usuario"
msgctxt "field:stock.shipment.drop,customer:"
msgid "Customer"
@@ -72,11 +78,11 @@ msgstr "Cliente"
msgctxt "field:stock.shipment.drop,delivery_address:"
msgid "Delivery Address"
-msgstr "Dirección envío"
+msgstr "Dirección de Envío"
msgctxt "field:stock.shipment.drop,effective_date:"
msgid "Effective Date"
-msgstr "Fecha efectiva"
+msgstr "Fecha Efectiva"
msgctxt "field:stock.shipment.drop,id:"
msgid "ID"
@@ -88,7 +94,7 @@ msgstr "Movimientos"
msgctxt "field:stock.shipment.drop,planned_date:"
msgid "Planned Date"
-msgstr "Fecha estimada"
+msgstr "Fecha Planeada"
msgctxt "field:stock.shipment.drop,rec_name:"
msgid "Name"
@@ -108,23 +114,23 @@ msgstr "Proveedor"
msgctxt "field:stock.shipment.drop,write_date:"
msgid "Write Date"
-msgstr "Fecha modificación"
+msgstr "Fecha de Modificación"
msgctxt "field:stock.shipment.drop,write_uid:"
msgid "Write User"
-msgstr "Usuario modificación"
+msgstr "Modificado por Usuario"
msgctxt "model:ir.action,name:act_purchase_drop_shipment_form"
msgid "Drop Shipments"
-msgstr "Envíos directos"
+msgstr "Entrega de Envíos"
msgctxt "model:ir.action,name:act_sale_drop_shipment_form"
msgid "Drop Shipments"
-msgstr "Envíos directos"
+msgstr "Entrega de Envíos"
msgctxt "model:ir.action,name:act_shipment_drop_form"
msgid "Drop Shipments"
-msgstr "Envíos directos"
+msgstr "Entrega de Envíos"
msgctxt ""
"model:ir.action.act_window.domain,name:act_shipment_drop_form_domain_all"
@@ -139,31 +145,31 @@ msgstr "Borrador"
msgctxt ""
"model:ir.action.act_window.domain,name:act_shipment_drop_form_domain_waiting"
msgid "Waiting"
-msgstr "En espera"
+msgstr "En Espera"
msgctxt "model:ir.sequence,name:sequence_shipment_drop"
msgid "Drop Shipment"
-msgstr "Envío directo"
+msgstr "Entrega de Envío"
msgctxt "model:ir.sequence.type,name:sequence_type_shipment_drop"
msgid "Drop Shipment"
-msgstr "Envío directo"
+msgstr "Entrega de Envío"
msgctxt "model:ir.ui.menu,name:menu_shipment_drop_form"
msgid "Drop Shipments"
-msgstr "Envíos directos"
+msgstr "Entrega de Envíos"
msgctxt "model:stock.shipment.drop,name:"
msgid "Drop Shipment"
-msgstr "Envío directo"
+msgstr "Entrega de Envío"
msgctxt "selection:stock.shipment.drop,state:"
msgid "Canceled"
-msgstr "Cancelado"
+msgstr "Anulado"
msgctxt "selection:stock.shipment.drop,state:"
msgid "Done"
-msgstr "Realizado"
+msgstr "Hecho"
msgctxt "selection:stock.shipment.drop,state:"
msgid "Draft"
@@ -171,7 +177,7 @@ msgstr "Borrador"
msgctxt "selection:stock.shipment.drop,state:"
msgid "Waiting"
-msgstr "En espera"
+msgstr "En Espera"
msgctxt "view:stock.shipment.drop:"
msgid "Cancel"
@@ -179,7 +185,7 @@ msgstr "Cancelar"
msgctxt "view:stock.shipment.drop:"
msgid "Done"
-msgstr "Realizado"
+msgstr "Hecho"
msgctxt "view:stock.shipment.drop:"
msgid "Draft"
@@ -187,28 +193,12 @@ msgstr "Borrador"
msgctxt "view:stock.shipment.drop:"
msgid "Drop Shipment"
-msgstr "Envío directo"
+msgstr "Entrega de Envío"
msgctxt "view:stock.shipment.drop:"
msgid "Drop Shipments"
-msgstr "Envíos directos"
+msgstr "Entrega de Envíos"
msgctxt "view:stock.shipment.drop:"
msgid "Wait"
-msgstr "Esperando"
-
-msgctxt "wizard_button:purchase.request.create_purchase,ask_party,end:"
-msgid "Cancel"
-msgstr "Cancelar"
-
-msgctxt "wizard_button:purchase.request.create_purchase,ask_party,start:"
-msgid "Continue"
-msgstr "Continuar"
-
-msgctxt "wizard_button:purchase.request.create_purchase,ask_term,end:"
-msgid "Cancel"
-msgstr "Cancelar"
-
-msgctxt "wizard_button:purchase.request.create_purchase,ask_term,start:"
-msgid "Continue"
-msgstr "Continuar"
+msgstr "Espera"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index 1ec1316..5a1a7be 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -2,6 +2,12 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:purchase.purchase:"
+msgid "A delivery address must be defined for quotation of purchase \"%s\"."
+msgstr ""
+"Se debe definir una dirección de envío para el presupuesto de la compra "
+"\"%s\"."
+
msgctxt "error:stock.shipment.drop:"
msgid ""
"You cannot reset to draft move \"%s\" which was generated by a sale or a "
@@ -195,7 +201,7 @@ msgstr "Envíos directos"
msgctxt "view:stock.shipment.drop:"
msgid "Wait"
-msgstr "Esperando"
+msgstr "En espera"
msgctxt "wizard_button:purchase.request.create_purchase,ask_party,end:"
msgid "Cancel"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index 88035c5..71b0a38 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -2,6 +2,10 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:purchase.purchase:"
+msgid "A delivery address must be defined for quotation of purchase \"%s\"."
+msgstr "L'adresse de livraison doit être définie pour le devis de l'achat \"%s\"."
+
msgctxt "error:stock.shipment.drop:"
msgid ""
"You cannot reset to draft move \"%s\" which was generated by a sale or a "
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 06eb1c3..24e1acb 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -2,13 +2,17 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:purchase.purchase:"
+msgid "A delivery address must be defined for quotation of purchase \"%s\"."
+msgstr "Naslov dostave mora biti naveden za nabavno ponudbo \"%s\"."
+
msgctxt "error:stock.shipment.drop:"
msgid ""
"You cannot reset to draft move \"%s\" which was generated by a sale or a "
"purchase."
msgstr ""
-"Prometa \"%s\" v stanju osnutka, ki je bil izdelan ob prodaji ali nabavi, ni"
-" možno ponastaviti."
+"Prometa \"%s\" v stanju priprave, ki je bil izdelan ob prodaji ali nabavi, "
+"ni možno ponastaviti."
msgctxt "field:purchase.product_supplier,drop_shipment:"
msgid "Drop Shipment"
@@ -52,7 +56,7 @@ msgstr "Šifra"
msgctxt "field:stock.shipment.drop,company:"
msgid "Company"
-msgstr "Podjetje"
+msgstr "Družba"
msgctxt "field:stock.shipment.drop,contact_address:"
msgid "Contact Address"
@@ -134,7 +138,7 @@ msgstr "Vse"
msgctxt ""
"model:ir.action.act_window.domain,name:act_shipment_drop_form_domain_draft"
msgid "Draft"
-msgstr "Osnutki"
+msgstr "Priprava"
msgctxt ""
"model:ir.action.act_window.domain,name:act_shipment_drop_form_domain_waiting"
@@ -167,7 +171,7 @@ msgstr "Zaključeno"
msgctxt "selection:stock.shipment.drop,state:"
msgid "Draft"
-msgstr "Osnutek"
+msgstr "V pripravi"
msgctxt "selection:stock.shipment.drop,state:"
msgid "Waiting"
@@ -183,7 +187,7 @@ msgstr "Zaključeno"
msgctxt "view:stock.shipment.drop:"
msgid "Draft"
-msgstr "Osnutek"
+msgstr "Priprava"
msgctxt "view:stock.shipment.drop:"
msgid "Drop Shipment"
diff --git a/purchase.py b/purchase.py
index a2b63c7..907d60a 100644
--- a/purchase.py
+++ b/purchase.py
@@ -32,8 +32,7 @@ class Purchase:
customer = fields.Many2One('party.party', 'Customer', readonly=True,
states={
'invisible': ~Eval('customer'),
- },
- on_change=['customer', 'delivery_address'])
+ })
delivery_address = fields.Many2One('party.address', 'Delivery Address',
domain=[('party', '=', Eval('customer'))],
states={
@@ -49,6 +48,15 @@ class Purchase:
depends=['customer']),
'get_drop_shipments')
+ @classmethod
+ def __setup__(cls):
+ super(Purchase, cls).__setup__()
+ cls._error_messages.update({
+ 'delivery_address_required': ('A delivery address must be '
+ 'defined for quotation of purchase "%s".'),
+ })
+
+ @fields.depends('customer', 'delivery_address')
def on_change_customer(self):
result = {
'delivery_address': None,
@@ -66,14 +74,18 @@ class Purchase:
return list(set(m.shipment.id for l in self.lines for m in l.moves
if isinstance(m.shipment, DropShipment)))
+ def check_for_quotation(self):
+ super(Purchase, self).check_for_quotation()
+ if self.customer and not self.delivery_address:
+ self.raise_user_error('delivery_address_required', self.rec_name)
+
class PurchaseLine:
__name__ = 'purchase.line'
def get_to_location(self, name):
result = super(PurchaseLine, self).get_to_location(name)
- # If delivery_address is empty, it is no more a drop shipment
- if self.purchase.customer and self.purchase.delivery_address:
+ if self.purchase.customer:
return self.purchase.customer.customer_location.id
return result
diff --git a/purchase.xml b/purchase.xml
index 58f3157..b645bb4 100644
--- a/purchase.xml
+++ b/purchase.xml
@@ -12,7 +12,7 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_purchase_drop_shipment_form">
<field name="name">Drop Shipments</field>
<field name="res_model">stock.shipment.drop</field>
- <field name="domain">[("id", "in", Eval('drop_shipments'))]</field>
+ <field name="domain">[('moves.purchase', 'in', Eval('active_ids'))]</field>
</record>
<record model="ir.action.keyword"
id="act_open_purchase_drop_shipment_keyword1">
diff --git a/sale.py b/sale.py
index e3bd9cd..2021bf7 100644
--- a/sale.py
+++ b/sale.py
@@ -115,28 +115,6 @@ class SaleLine:
request.delivery_address = self.sale.shipment_address
return request
- def get_move_done(self, name):
- result = super(SaleLine, self).get_move_done(name)
- with Transaction().set_user(0, set_context=True):
- # TODO make it work in bunch
- line = self.__class__(self.id)
- if (line.purchase_request
- and line.purchase_request.customer):
- if line.purchase_request.purchase_line:
- return line.purchase_request.purchase_line.move_done
- else:
- return False
- return result
-
- def get_move_exception(self, name):
- result = super(SaleLine, self).get_move_exception(name)
- with Transaction().set_user(0, set_context=True):
- # TODO make it work in bunch
- line = self.__class__(self.id)
- if line.purchase_request and line.purchase_request.customer:
- return False
- return result
-
def get_drop_moves(self):
if (self.type != 'line'
or not self.product):
diff --git a/sale.xml b/sale.xml
index b8e68f1..538c611 100644
--- a/sale.xml
+++ b/sale.xml
@@ -12,7 +12,7 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_sale_drop_shipment_form">
<field name="name">Drop Shipments</field>
<field name="res_model">stock.shipment.drop</field>
- <field name="domain">[("id", "in", Eval('drop_shipments'))]</field>
+ <field name="domain">[('moves.sale', 'in', Eval('active_ids'))]</field>
</record>
<record model="ir.action.keyword"
id="act_open_sale_drop_shipment_keyword1">
diff --git a/setup.py b/setup.py
index 6c6c63c..ffb84d5 100644
--- a/setup.py
+++ b/setup.py
@@ -11,33 +11,51 @@ import ConfigParser
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+def get_require_version(name):
+ if minor_version % 2:
+ require = '%s >= %s.%s.dev0, < %s.%s'
+ else:
+ require = '%s >= %s.%s, < %s.%s'
+ require %= (name, major_version, minor_version,
+ major_version, minor_version + 1)
+ return require
+
config = ConfigParser.ConfigParser()
config.readfp(open('tryton.cfg'))
info = dict(config.items('tryton'))
for key in ('depends', 'extras_depend', 'xml'):
if key in info:
info[key] = info[key].strip().splitlines()
-major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
+version = info.get('version', '0.0.1')
+major_version, minor_version, _ = version.split('.', 2)
major_version = int(major_version)
minor_version = int(minor_version)
+name = 'trytond_sale_supply_drop_shipment'
+
+download_url = 'http://downloads.tryton.org/%s.%s/' % (
+ major_version, minor_version)
+if minor_version % 2:
+ version = '%s.%s.dev0' % (major_version, minor_version)
+ download_url = (
+ 'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
+ name[8:], name, version))
requires = []
for dep in info.get('depends', []):
if not re.match(r'(ir|res|webdav)(\W|$)', dep):
- requires.append('trytond_%s >= %s.%s, < %s.%s' %
- (dep, major_version, minor_version, major_version,
- minor_version + 1))
-requires.append('trytond >= %s.%s, < %s.%s' %
- (major_version, minor_version, major_version, minor_version + 1))
+ requires.append(get_require_version('trytond_%s' % dep))
+requires.append(get_require_version('trytond'))
-setup(name='trytond_sale_supply_drop_shipment',
- version=info.get('version', '0.0.1'),
+setup(name=name,
+ version=version,
description='Tryton module for sale supply drop shipment',
long_description=read('README'),
author='Tryton',
+ author_email='issue_tracker at tryton.org',
url='http://www.tryton.org/',
- download_url=("http://downloads.tryton.org/"
- + info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'),
+ download_url=download_url,
+ keywords='tryton sale supply drop shipment',
package_dir={'trytond.modules.sale_supply_drop_shipment': '.'},
packages=[
'trytond.modules.sale_supply_drop_shipment',
@@ -66,7 +84,6 @@ setup(name='trytond_sale_supply_drop_shipment',
'Natural Language :: Slovenian',
'Natural Language :: Spanish',
'Operating System :: OS Independent',
- 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Office/Business',
'Topic :: Office/Business :: Financial :: Accounting',
diff --git a/stock.py b/stock.py
index a990d12..47eb6ad 100644
--- a/stock.py
+++ b/stock.py
@@ -42,12 +42,12 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
states={
'readonly': Eval('state') != 'draft',
}, depends=['state'])
- supplier = fields.Many2One('party.party', 'Supplier',
+ supplier = fields.Many2One('party.party', 'Supplier', required=True,
states={
- 'readonly': (((Eval('state') != 'draft') | Eval('moves'))
+ 'readonly': (((Eval('state') != 'draft') | Eval('moves', [0]))
& Eval('supplier')),
- }, on_change=['supplier'], required=True,
- depends=['state', 'moves', 'supplier'])
+ },
+ depends=['state', 'supplier'])
contact_address = fields.Many2One('party.address', 'Contact Address',
states={
'readonly': Eval('state') != 'draft',
@@ -56,10 +56,10 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
depends=['state', 'supplier'])
customer = fields.Many2One('party.party', 'Customer', required=True,
states={
- 'readonly': (((Eval('state') != 'draft') | Eval('moves'))
+ 'readonly': (((Eval('state') != 'draft') | Eval('moves', [0]))
& Eval('customer')),
- }, on_change=['customer'],
- depends=['state', 'moves'])
+ },
+ depends=['state'])
delivery_address = fields.Many2One('party.address', 'Delivery Address',
required=True,
states={
@@ -135,6 +135,7 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
def default_company():
return Transaction().context.get('company')
+ @fields.depends('supplier')
def on_change_supplier(self):
if self.supplier:
address = self.supplier.address_get()
@@ -142,6 +143,7 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
return {'contact_address': address.id}
return {'contact_address': None}
+ @fields.depends('customer')
def on_change_customer(self):
if self.customer:
address = self.customer.address_get(type='delivery')
@@ -183,17 +185,20 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
return shipments
@classmethod
- def write(cls, shipments, values):
+ def write(cls, *args):
pool = Pool()
Purchase = pool.get('purchase.purchase')
PurchaseLine = pool.get('purchase.line')
Sale = pool.get('sale.sale')
SaleLine = pool.get('sale.line')
- result = super(ShipmentDrop, cls).write(shipments, values)
- cls._set_move_planned_date(shipments)
+ super(ShipmentDrop, cls).write(*args)
+ cls._set_move_planned_date(sum(args[::2], []))
- if values.get('state', '') in ('done', 'cancel'):
+ actions = iter(args)
+ for shipments, values in zip(actions, actions):
+ if values.get('state', '') not in ('done', 'cancel'):
+ continue
with Transaction().set_user(0, set_context=True):
purchases = set()
move_ids = [m.id for s in shipments for m in s.moves]
@@ -208,7 +213,6 @@ class ShipmentDrop(Workflow, ModelSQL, ModelView):
])
sales = list(set(l.sale for l in sale_lines or []))
Sale.process(sales)
- return result
@classmethod
def copy(cls, shipments, default=None):
diff --git a/tests/scenario_sale_supply_drop_shipment.rst b/tests/scenario_sale_supply_drop_shipment.rst
index 8bd73e6..f730ff5 100644
--- a/tests/scenario_sale_supply_drop_shipment.rst
+++ b/tests/scenario_sale_supply_drop_shipment.rst
@@ -37,14 +37,14 @@ Create company::
>>> company_config = Wizard('company.company.config')
>>> company_config.execute('company')
>>> company = company_config.form
- >>> party = Party(name='B2CK')
+ >>> party = Party(name='Dunder Mifflin')
>>> party.save()
>>> company.party = party
- >>> currencies = Currency.find([('code', '=', 'EUR')])
+ >>> currencies = Currency.find([('code', '=', 'USD')])
>>> if not currencies:
- ... currency = Currency(name='Euro', symbol=u'€', code='EUR',
+ ... currency = Currency(name='U.S. Dollar', symbol='$', code='USD',
... rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
- ... mon_decimal_point=',')
+ ... mon_decimal_point='.', mon_thousands_sep=',')
... currency.save()
... CurrencyRate(date=today + relativedelta(month=1, day=1),
... rate=Decimal('1.0'), currency=currency).save()
@@ -90,7 +90,11 @@ Create stock user::
>>> stock_user.login = 'stock'
>>> stock_user.main_company = company
>>> stock_group, = Group.find([('name', '=', 'Stock')])
+ >>> stock_force_group, = Group.find([
+ ... ('name', '=', 'Stock Force Assignment'),
+ ... ])
>>> stock_user.groups.append(stock_group)
+ >>> stock_user.groups.append(stock_force_group)
>>> stock_user.save()
Create fiscal year::
@@ -276,3 +280,126 @@ Receive 100 products::
150.0
>>> move.unit_price == move.cost_price
True
+
+The purchase is now waiting for this new drop shipment::
+
+ >>> config.user = purchase_user.id
+ >>> purchase.reload()
+ >>> purchase.shipment_state
+ u'waiting'
+
+Let's cancel it and handle the problem from the sale order::
+
+ >>> config.user = stock_user.id
+ >>> shipment.click('cancel')
+
+ >>> config.user = purchase_user.id
+ >>> purchase.reload()
+ >>> purchase.shipment_state
+ u'exception'
+ >>> handle_exception = Wizard('purchase.handle.shipment.exception',
+ ... [purchase])
+ >>> _ = handle_exception.form.recreate_moves.pop()
+ >>> handle_exception.execute('handle')
+ >>> purchase.reload()
+ >>> purchase.shipment_state
+ u'received'
+
+ >>> config.user = sale_user.id
+ >>> sale.shipment_state
+ u'exception'
+ >>> handle_exception = Wizard('sale.handle.shipment.exception', [sale])
+ >>> handle_exception.execute('handle')
+ >>> sale.reload()
+ >>> sale.shipment_state
+ u'waiting'
+
+The sale has created a new outgoing shipment::
+
+ >>> shipment, = sale.shipments
+ >>> move, = shipment.outgoing_moves
+ >>> move.quantity
+ 150.0
+
+Cancelling the workflow on the purchase step::
+
+ >>> sale = Sale()
+ >>> sale.party = customer
+ >>> sale.payment_term = payment_term
+ >>> sale_line = sale.lines.new()
+ >>> sale_line.product = product
+ >>> sale_line.quantity = 125
+ >>> sale.save()
+ >>> sale.click('quote')
+ >>> sale.click('confirm')
+ >>> sale.click('process')
+ >>> sale.state
+ u'processing'
+ >>> sale.shipments
+ []
+ >>> sale.drop_shipments
+ []
+
+ >>> config.user = purchase_user.id
+ >>> purchase_request, = PurchaseRequest.find([('purchase_line', '=', None)])
+ >>> purchase_request.quantity
+ 125.0
+ >>> create_purchase = Wizard('purchase.request.create_purchase',
+ ... [purchase_request])
+ >>> purchase, = Purchase.find([('state', '=', 'draft')])
+ >>> purchase.click('cancel')
+
+The sale just created a new outgoing shipment for the sale::
+
+ >>> config.user = sale_user.id
+ >>> sale.reload()
+ >>> shipment, = sale.shipments
+
+If the shipment is cancelled then the shipement state of the sale will be
+considered as 'sent'::
+
+ >>> config.user = stock_user.id
+ >>> shipment.click('cancel')
+ >>> config.user = sale_user.id
+ >>> sale.shipment_state
+ u'exception'
+
+ >>> handle_exception = Wizard('sale.handle.shipment.exception', [sale])
+ >>> _ = handle_exception.form.recreate_moves.pop()
+ >>> handle_exception.execute('handle')
+ >>> sale.reload()
+ >>> sale.shipment_state
+ u'sent'
+
+If we opt not to cancel the shipment and deliver from stock::
+
+ >>> config.user = sale_user.id
+ >>> sale = Sale()
+ >>> sale.party = customer
+ >>> sale.payment_term = payment_term
+ >>> sale_line = sale.lines.new()
+ >>> sale_line.product = product
+ >>> sale_line.quantity = 125
+ >>> sale.save()
+ >>> Sale.quote([sale.id], config.context)
+ >>> Sale.confirm([sale.id], config.context)
+ >>> Sale.process([sale.id], config.context)
+ >>> config.user = purchase_user.id
+ >>> purchase_request, = PurchaseRequest.find([('purchase_line', '=', None)])
+ >>> create_purchase = Wizard('purchase.request.create_purchase',
+ ... [purchase_request])
+ >>> purchase, = Purchase.find([('state', '=', 'draft')])
+ >>> purchase.click('cancel')
+
+ >>> config.user = sale_user.id
+ >>> sale.reload()
+ >>> shipment, = sale.shipments
+
+ >>> config.user = stock_user.id
+ >>> shipment.click('assign_force')
+ >>> shipment.click('pack')
+ >>> shipment.click('done')
+
+ >>> config.user = sale_user.id
+ >>> sale.shipment_state
+ u'sent'
diff --git a/tests/test_sale_supply_drop_shipment.py b/tests/test_sale_supply_drop_shipment.py
index 080e735..d016a75 100644
--- a/tests/test_sale_supply_drop_shipment.py
+++ b/tests/test_sale_supply_drop_shipment.py
@@ -1,55 +1,26 @@
-#!/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.
-
-import sys
-import os
-DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
- '..', '..', '..', '..', '..', 'trytond')))
-if os.path.isdir(DIR):
- sys.path.insert(0, os.path.dirname(DIR))
-
import unittest
import doctest
import trytond.tests.test_tryton
-from trytond.tests.test_tryton import test_view, test_depends
-from trytond.backend.sqlite.database import Database as SQLiteDatabase
+from trytond.tests.test_tryton import test_view, test_depends, doctest_dropdb
class SaleSupplyDropShipmentTestCase(unittest.TestCase):
- '''
- Test SaleSupplyDropShipment module.
- '''
+ 'Test SaleSupplyDropShipment module'
def setUp(self):
trytond.tests.test_tryton.install_module('sale_supply_drop_shipment')
def test0005views(self):
- '''
- Test views.
- '''
+ 'Test views'
test_view('sale_supply_drop_shipment')
def test0006depends(self):
- '''
- Test depends.
- '''
+ 'Test depends'
test_depends()
-def doctest_dropdb(test):
- '''
- Remove sqlite memory database
- '''
- database = SQLiteDatabase().connect()
- cursor = database.cursor(autocommit=True)
- try:
- database.drop(cursor, ':memory:')
- cursor.commit()
- finally:
- cursor.close()
-
-
def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
@@ -59,6 +30,3 @@ def suite():
setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8',
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite
-
-if __name__ == '__main__':
- unittest.TextTestRunner(verbosity=2).run(suite())
diff --git a/tryton.cfg b/tryton.cfg
index 15e8bde..9f5e064 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.0.0
+version=3.2.0
depends:
company
ir
diff --git a/trytond_sale_supply_drop_shipment.egg-info/PKG-INFO b/trytond_sale_supply_drop_shipment.egg-info/PKG-INFO
index d7fb817..1d3f960 100644
--- a/trytond_sale_supply_drop_shipment.egg-info/PKG-INFO
+++ b/trytond_sale_supply_drop_shipment.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-sale-supply-drop-shipment
-Version: 3.0.0
+Version: 3.2.0
Summary: Tryton module for sale supply drop shipment
Home-page: http://www.tryton.org/
Author: Tryton
-Author-email: UNKNOWN
+Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.0/
+Download-URL: http://downloads.tryton.org/3.2/
Description: sale_supply_drop_shipment
=========================
@@ -43,6 +43,7 @@ Description: sale_supply_drop_shipment
http://www.tryton.org/
+Keywords: tryton sale supply drop shipment
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
@@ -62,7 +63,6 @@ Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Office/Business
Classifier: Topic :: Office/Business :: Financial :: Accounting
diff --git a/trytond_sale_supply_drop_shipment.egg-info/SOURCES.txt b/trytond_sale_supply_drop_shipment.egg-info/SOURCES.txt
index 972377a..8a2f8e5 100644
--- a/trytond_sale_supply_drop_shipment.egg-info/SOURCES.txt
+++ b/trytond_sale_supply_drop_shipment.egg-info/SOURCES.txt
@@ -19,6 +19,7 @@ doc/index.rst
locale/ca_ES.po
locale/de_DE.po
locale/es_AR.po
+locale/es_CO.po
locale/es_ES.po
locale/fr_FR.po
locale/sl_SI.po
diff --git a/trytond_sale_supply_drop_shipment.egg-info/requires.txt b/trytond_sale_supply_drop_shipment.egg-info/requires.txt
index 5d631f7..83ecc0b 100644
--- a/trytond_sale_supply_drop_shipment.egg-info/requires.txt
+++ b/trytond_sale_supply_drop_shipment.egg-info/requires.txt
@@ -1,6 +1,6 @@
-trytond_company >= 3.0, < 3.1
-trytond_purchase >= 3.0, < 3.1
-trytond_sale >= 3.0, < 3.1
-trytond_sale_supply >= 3.0, < 3.1
-trytond_stock >= 3.0, < 3.1
-trytond >= 3.0, < 3.1
\ No newline at end of file
+trytond_company >= 3.2, < 3.3
+trytond_purchase >= 3.2, < 3.3
+trytond_sale >= 3.2, < 3.3
+trytond_sale_supply >= 3.2, < 3.3
+trytond_stock >= 3.2, < 3.3
+trytond >= 3.2, < 3.3
\ No newline at end of file
--
tryton-modules-sale-supply-drop-shipment
More information about the tryton-debian-vcs
mailing list