diff --git a/__init__.py b/__init__.py index 50e892f..c95ff4d 100644 --- a/__init__.py +++ b/__init__.py @@ -10,6 +10,7 @@ def register(): Pool.register( shipment.ShipmentOut, shipment.ShipmentIn, + shipment.ShipmentInternal, shipment.SendLinkStart, configuration.Configuration, company.Company, diff --git a/email_shipment_internal.html b/email_shipment_internal.html new file mode 100644 index 0000000..2024802 --- /dev/null +++ b/email_shipment_internal.html @@ -0,0 +1,17 @@ + + + + Web link to Shipment Internal + + +
+
+

Web link to Shipment Internal

+ +

Go to Shipment Internal

+
+
+
+
+ + \ No newline at end of file diff --git a/locale/es.po b/locale/es.po index 92cea18..2e4517d 100644 --- a/locale/es.po +++ b/locale/es.po @@ -58,6 +58,10 @@ msgctxt "selection:stock.shipment.in,state:" msgid "Mail sent" msgstr "Correo enviado" +msgctxt "selection:stock.shipment.internal,state:" +msgid "Mail sent" +msgstr "Correo enviado" + msgctxt "model:ir.action.act_window.domain,name:act_shipment_out_form_domain_mail_sent" msgid "Mail sent" msgstr "Correo enviado" @@ -66,6 +70,10 @@ msgctxt "model:ir.action.act_window.domain,name:act_shipment_in_form_domain_mail msgid "Mail sent" msgstr "Correo enviado" +msgctxt "model:ir.action.act_window.domain,name:act_shipment_internal_form_domain_mail_sent" +msgid "Mail sent" +msgstr "Correo enviado" + msgctxt "model:ir.action,name:act_send_link" msgid "Send link" msgstr "Enviar enlace" @@ -82,6 +90,10 @@ msgctxt "error:stock.shipment.in:" msgid "The action \"Send link\" must be done from draft state." msgstr "La acción \"Enviar enlace\" debe hacerse desde el estado borrador." +msgctxt "error:stock.shipment.internal:" +msgid "The action \"Send link\" must be done from draft state." +msgstr "La acción \"Enviar enlace\" debe hacerse desde el estado borrador." + msgctxt "wizard_button:stock.shipment.send_link,start,end:" msgid "Cancel" msgstr "Cancelar" diff --git a/shipment.py b/shipment.py index b65184e..1114bd9 100644 --- a/shipment.py +++ b/shipment.py @@ -1,7 +1,7 @@ # The COPYRIGHT file at the top level of this repository contains the full # copyright notices and license terms. from trytond.pool import PoolMeta, Pool -from trytond.pyson import Eval +from trytond.pyson import Eval, Not from trytond.model import ModelView, fields, Workflow from trytond.config import config from trytond.transaction import Transaction @@ -148,6 +148,8 @@ class ShipmentWebLinkMixin(object): _type = 'shipment_in/' if self.__name__ == 'stock.shipment.out': _type = 'shipment_out/' + elif self.__name__ == 'stock.shipment.internal': + _type = 'shipment_internal/' return config.shipment_link_url + _type + self.encrypted_id def get_languages(self, user): @@ -230,6 +232,29 @@ class ShipmentIn(ShipmentWebLinkMixin, metaclass=PoolMeta): email=email, send_mail=send_mail, raise_error=raise_error) +class ShipmentInternal(ShipmentWebLinkMixin, metaclass=PoolMeta): + __name__ = 'stock.shipment.internal' + + @classmethod + def __setup__(cls): + super().__setup__() + + cls._buttons['wait']['invisible'] = Not(Eval('state').in_( + ['assigned', 'draft', 'mail_sent'])) + cls._transitions |= set(( + ('draft', 'mail_sent'), + ('mail_sent', 'waiting'), + ('mail_sent', 'draft'), + ('waiting', 'mail_sent'))) + + def get_email_shipment_flask(self, user): + return self.get_email( + 'stock.shipment.internal.web_link', self, self.get_languages(user)) + + def get_to_email(self): + return self.company.party.email + + class SendLinkStart(ModelView): """Shipment Send Link Start""" __name__ = 'stock.shipment.send_link.start' diff --git a/shipment.xml b/shipment.xml index cf23ed7..f5c3aab 100644 --- a/shipment.xml +++ b/shipment.xml @@ -31,6 +31,11 @@ stock.shipment.in,-1 + + form_action + stock.shipment.internal,-1 + + @@ -55,6 +60,15 @@ + + + Mail sent + + + + + + Web link to Shipment Out @@ -70,5 +84,12 @@ stock_shipment_web_link/email_shipment_in.html html + + Web link to Shipment Internal + stock.shipment.internal + stock.shipment.internal.web_link + stock_shipment_web_link/email_shipment_internal.html + html + \ No newline at end of file