diff --git a/issue9049-issue4050.diff b/issue9049-issue4050.diff
new file mode 100644
index 0000000..f1ae8eb
--- /dev/null
+++ b/issue9049-issue4050.diff
@@ -0,0 +1,197 @@
+diff --git a/trytond/trytond/modules/purchase/__init__.py b/trytond/trytond/modules/purchase/__init__.py
+index 5f548ca..db72ac1 100644
+--- a/trytond/trytond/modules/purchase/__init__.py
++++ b/trytond/trytond/modules/purchase/__init__.py
+@@ -36,6 +36,7 @@ def register():
+ Location,
+ party.Party,
+ party.CustomerCode,
++ purchase.ReturnPurchaseStart,
+ module='purchase', type_='model')
+ Pool.register(
+ PurchaseReport,
+@@ -47,4 +48,5 @@ def register():
+ party.PartyReplace,
+ party.PartyErase,
+ ModifyHeader,
++ purchase.ReturnPurchase,
+ module='purchase', type_='wizard')
+diff --git a/trytond/trytond/modules/purchase/locale/ca.po b/trytond/trytond/modules/purchase/locale/ca.po
+index b184206..e4e01be 100644
+--- a/trytond/trytond/modules/purchase/locale/ca.po
++++ b/trytond/trytond/modules/purchase/locale/ca.po
+@@ -526,6 +526,10 @@ msgctxt "model:ir.action,name:wizard_modify_header"
+ msgid "Modify Header"
+ msgstr "Modificar capçalera"
+
++msgctxt "model:ir.action,name:wizard_return_purchase"
++msgid "Return Purchase"
++msgstr "Retorna la compra"
++
+ msgctxt "model:ir.action,name:wizard_shipment_handle_exception"
+ msgid "Handle Shipment Exception"
+ msgstr "Gestiona l'excepció d'enviament"
+@@ -1015,6 +1019,10 @@ msgctxt "view:purchase.purchase:"
+ msgid "Purchase"
+ msgstr "Compra"
+
++msgctxt "view:purchase.return_purchase.start:"
++msgid "Are you sure to return these/this purchase(s)?"
++msgstr "Esteu segurs que voleu retornar aquesta/es compra/es?"
++
+ msgctxt "wizard_button:purchase.handle.invoice.exception,ask,end:"
+ msgid "Cancel"
+ msgstr "Cancel·la"
+diff --git a/trytond/trytond/modules/purchase/locale/es.po b/trytond/trytond/modules/purchase/locale/es.po
+index c48d0c8..497e5a3 100644
+--- a/trytond/trytond/modules/purchase/locale/es.po
++++ b/trytond/trytond/modules/purchase/locale/es.po
+@@ -529,6 +529,10 @@ msgctxt "model:ir.action,name:wizard_modify_header"
+ msgid "Modify Header"
+ msgstr "Modificar cabecera"
+
++msgctxt "model:ir.action,name:wizard_return_purchase"
++msgid "Return Purchase"
++msgstr "Devolver la compra"
++
+ msgctxt "model:ir.action,name:wizard_shipment_handle_exception"
+ msgid "Handle Shipment Exception"
+ msgstr "Gestionar excepción de envío"
+@@ -1018,6 +1022,10 @@ msgctxt "view:purchase.purchase:"
+ msgid "Purchase"
+ msgstr "Compra"
+
++msgctxt "view:purchase.return_purchase.start:"
++msgid "Are you sure to return these/this purchase(s)?"
++msgstr "¿Estás seguro de querer devolver este/os pedido/s de compra?"
++
+ msgctxt "wizard_button:purchase.handle.invoice.exception,ask,end:"
+ msgid "Cancel"
+ msgstr "Cancelar"
+diff --git a/trytond/trytond/modules/purchase/purchase.py b/trytond/trytond/modules/purchase/purchase.py
+index a0459a5..4e35105 100644
+--- a/trytond/trytond/modules/purchase/purchase.py
++++ b/trytond/trytond/modules/purchase/purchase.py
+@@ -175,6 +175,11 @@ class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin):
+ invoices_recreated = fields.Many2Many(
+ 'purchase.purchase-recreated-account.invoice',
+ 'purchase', 'invoice', 'Recreated Invoices', readonly=True)
++ origin = fields.Reference('Origin', selection='get_origin', select=True,
++ states={
++ 'readonly': Eval('state') != 'draft',
++ },
++ depends=['state'])
+ delivery_date = fields.Date(
+ "Delivery Date",
+ states={
+@@ -575,6 +580,17 @@ class Purchase(Workflow, ModelSQL, ModelView, TaxableMixin):
+ self.write([self], {
+ 'shipment_state': state,
+ })
++ @classmethod
++ def _get_origin(cls):
++ "Return list of Model names for origin Reference"
++ return ['purchase.purchase']
++
++ @classmethod
++ def get_origin(cls):
++ Model = Pool().get('ir.model')
++ get_name = Model.get_name
++ models = cls._get_origin()
++ return [(None, '')] + [(m, get_name(m)) for m in models]
+
+ @property
+ def report_address(self):
+@@ -1864,3 +1880,37 @@ class ModifyHeader(Wizard):
+ Line.save(purchase.lines)
+
+ return 'end'
++
++
++class ReturnPurchaseStart(ModelView):
++ "Return Purchase"
++ __name__ = 'purchase.return_purchase.start'
++
++
++class ReturnPurchase(Wizard):
++ "Return Purchase"
++ __name__ = 'purchase.return_purchase'
++ start = StateView('purchase.return_purchase.start',
++ 'purchase.return_purchase_start_view_form', [
++ Button("Cancel", 'end', 'tryton-cancel'),
++ Button("Return", 'return_', 'tryton-ok', default=True),
++ ])
++ return_ = StateAction('purchase.act_purchase_form')
++
++ def do_return_(self, action):
++ Purchase = Pool().get('purchase.purchase')
++
++ purchases = Purchase.browse(Transaction().context['active_ids'])
++ return_purchases = Purchase.copy(purchases)
++ for return_purchase, purchase in zip(return_purchases, purchases):
++ return_purchase.origin = purchase
++ for line in return_purchase.lines:
++ if line.type == 'line':
++ line.quantity *= -1
++ return_purchase.lines = return_purchase.lines # Force saving
++ Purchase.save(return_purchases)
++
++ data = {'res_id': [s.id for s in return_purchases]}
++ if len(return_purchases) == 1:
++ action['views'].reverse()
++ return action, data
+diff --git a/trytond/trytond/modules/purchase/purchase.xml b/trytond/trytond/modules/purchase/purchase.xml
+index aef771b..97404cb 100644
+--- a/trytond/trytond/modules/purchase/purchase.xml
++++ b/trytond/trytond/modules/purchase/purchase.xml
+@@ -523,6 +523,22 @@ this repository contains the full copyright notices and license terms. -->
+ template_tree
+
+
++
++ purchase.return_purchase.start
++ form
++ return_purchase_start_form
++
++
++ Return Purchase
++ purchase.return_purchase
++ purchase.purchase
++
++
++ form_action
++ purchase.purchase,-1
++
++
++
+
+ Parties associated to Purchases
+ purchase.open_supplier
+diff --git a/trytond/trytond/modules/purchase/view/purchase_form.xml b/trytond/trytond/modules/purchase/view/purchase_form.xml
+index d689f5e..5f25f91 100644
+--- a/trytond/trytond/modules/purchase/view/purchase_form.xml
++++ b/trytond/trytond/modules/purchase/view/purchase_form.xml
+@@ -45,6 +45,8 @@ this repository contains the full copyright notices and license terms. -->
+
+
+
++
++
+
+
+
+diff --git a/trytond/trytond/modules/purchase/view/return_purchase_start_form.xml b/trytond/trytond/modules/purchase/view/return_purchase_start_form.xml
+new file mode 100644
+index 0000000..9a87dd8
+--- /dev/null
++++ b/trytond/trytond/modules/purchase/view/return_purchase_start_form.xml
+@@ -0,0 +1,9 @@
++
++
++
diff --git a/series b/series
index 972e1eb..a012a81 100644
--- a/series
+++ b/series
@@ -102,3 +102,5 @@ stock_lot_sled_ca_locale.diff # [stock_lot_sled] Fix wrong translation [#044921]
issue9122.diff # [stock_supply] Add cron job to supply stock
issue10500.diff # [account_invoice] Fix msg_invoice_same_account_line variables name
+
+issue9049-issue4050.diff # [purchase] Add origin and set on returned purchase + Add return wizard