diff --git a/stock_picking_deposito/__manifest__.py b/stock_picking_deposito/__manifest__.py
index e78ac10..9eaa99c 100644
--- a/stock_picking_deposito/__manifest__.py
+++ b/stock_picking_deposito/__manifest__.py
@@ -1,4 +1,4 @@
-# Copyright 2021 Criptomart
+# Copyright 2021 Criptomart
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Stock Picking Depósito",
@@ -16,5 +16,7 @@
],
"data": [
"views/stock_picking.xml",
+ "views/view_res_partner.xml",
+ "data/data.xml",
],
}
diff --git a/stock_picking_deposito/data/data.xml b/stock_picking_deposito/data/data.xml
new file mode 100644
index 0000000..825d912
--- /dev/null
+++ b/stock_picking_deposito/data/data.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ Depósitos Entradas
+ internal
+
+
+
+
+ Depósitos Salidas
+ internal
+
+
+
+
+
diff --git a/stock_picking_deposito/models/__init__.py b/stock_picking_deposito/models/__init__.py
index ae4c272..6192433 100644
--- a/stock_picking_deposito/models/__init__.py
+++ b/stock_picking_deposito/models/__init__.py
@@ -1 +1,2 @@
from . import stock_picking
+from . import res_partner
diff --git a/stock_picking_deposito/models/res_partner.py b/stock_picking_deposito/models/res_partner.py
new file mode 100644
index 0000000..7bc8152
--- /dev/null
+++ b/stock_picking_deposito/models/res_partner.py
@@ -0,0 +1,55 @@
+# Copyright (C) 2021: Criptomart ()
+# @author: Criptomart ()
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+#import logging
+
+from odoo import models, fields, api
+
+#_logger = logging.getLogger(__name__)
+
+class ResPartner(models.Model):
+ _inherit = 'res.partner'
+
+ deposit_sale_accept = fields.Boolean(
+ string='Acepta depósitos de venta',
+ help='Éste cliente acepta nuestro material a depósito',
+ )
+ deposit_buy_accept = fields.Boolean(
+ string='Acepta depósitos de compra',
+ help='Éste proveedor nos deja material a depósito',
+ )
+ deposit_sale_location_id = fields.Many2one(
+ comodel_name='stock.location',
+ string='Ubicación de depósito de ventas',
+ help="La ubicación que se usará para gestionar el depósito que dejamos a éste proveedor"
+ )
+ deposit_buy_location_id = fields.Many2one(
+ comodel_name='stock.location',
+ string='Ubicación de depósito de compras',
+ help="La ubicación que se usará para gestionar el material que éste proveedor nos deja en depósito."
+ )
+
+ @api.onchange('deposit_sale_accept')
+ def _onchange_deposit_sale_accept(self):
+ if self.deposit_sale_accept and not self.deposit_sale_location_id:
+ new_loc = self.env['stock.location'].create({
+ 'usage': 'internal',
+ 'name': self.name,
+ 'location_id': self.env.ref('stock_picking_deposito.location_deposit_sale').id
+ })
+ self.update({
+ 'deposit_sale_location_id': new_loc
+ })
+
+ @api.onchange('deposit_buy_accept')
+ def _onchange_deposit_buy_accept(self):
+ if self.deposit_buy_accept and not self.deposit_buy_location_id:
+ new_loc = self.env['stock.location'].create({
+ 'usage': 'internal',
+ 'name': self.name,
+ 'location_id': self.env.ref('stock_picking_deposito.location_deposit_buy').id
+ })
+ self.update({
+ 'deposit_buy_location_id': new_loc
+ })
diff --git a/stock_picking_deposito/models/stock_picking.py b/stock_picking_deposito/models/stock_picking.py
index d346dc9..0764e54 100644
--- a/stock_picking_deposito/models/stock_picking.py
+++ b/stock_picking_deposito/models/stock_picking.py
@@ -1,4 +1,4 @@
-# Copyright 2021 Criptomart SLL
+# Copyright 2021 Criptomart
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, models, fields
@@ -18,4 +18,3 @@ class StockPicking(models.Model):
string='Es un Depósito',
help='Éste albarán es un depósito, no una compra final',
)
-
diff --git a/stock_picking_deposito/views/stock_picking.xml b/stock_picking_deposito/views/stock_picking.xml
index 2863c97..e416894 100644
--- a/stock_picking_deposito/views/stock_picking.xml
+++ b/stock_picking_deposito/views/stock_picking.xml
@@ -1,5 +1,6 @@
+