Funcionando la lógica de almacenes, falta la parte de facturación.
- el partner tiene que estar configurado como acepta depósitos para evitar errores. - en el onchange del accept en el partner se crea su ubicación de almacén. - Eñ usuario crea un albarán de tipo depósito de entrada o salida y se configuran automáticamente las ubicaciones de depósito del partner en el albarán.
This commit is contained in:
parent
3523629d60
commit
53ad5dffb3
4 changed files with 65 additions and 38 deletions
|
@ -2,8 +2,8 @@
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||||
{
|
{
|
||||||
"name": "Stock Picking Depósito",
|
"name": "Stock Picking Depósito",
|
||||||
"summary": "",
|
"summary": "Permite la gestión de depósitos en el almacén.",
|
||||||
"version": "12.0.1.0.0",
|
"version": "12.0.1.0.1",
|
||||||
"development_status": "Alpha",
|
"development_status": "Alpha",
|
||||||
"category": "Warehouse Management",
|
"category": "Warehouse Management",
|
||||||
"website": "https://criptomart.net",
|
"website": "https://criptomart.net",
|
||||||
|
@ -15,7 +15,6 @@
|
||||||
"stock",
|
"stock",
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
"views/stock_picking.xml",
|
|
||||||
"views/view_res_partner.xml",
|
"views/view_res_partner.xml",
|
||||||
"data/data.xml",
|
"data/data.xml",
|
||||||
],
|
],
|
||||||
|
|
|
@ -13,5 +13,35 @@
|
||||||
<field name="location_id" ref="stock.stock_location_locations"/>
|
<field name="location_id" ref="stock.stock_location_locations"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="seq_stock_picking_deposit_in" model="ir.sequence">
|
||||||
|
<field name="name">Recepción en depósito</field>
|
||||||
|
<field name="code">stock.picking</field>
|
||||||
|
<field eval="4" name="padding" />
|
||||||
|
<field name="prefix">DEPIN/</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="seq_stock_picking_deposit_out" model="ir.sequence">
|
||||||
|
<field name="name">Salida en depósito</field>
|
||||||
|
<field name="code">stock.picking</field>
|
||||||
|
<field eval="4" name="padding" />
|
||||||
|
<field name="prefix">DEPOUT/</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="stock_picking_deposit_out" model="stock.picking.type">
|
||||||
|
<field name="name">Salida en Depósito</field>
|
||||||
|
<field name="code">internal</field>
|
||||||
|
<field name="sequence_id" ref="seq_stock_picking_deposit_out" />
|
||||||
|
<field name="default_location_src_id" ref="stock.stock_location_stock"/>
|
||||||
|
<field name="is_deposit">True</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="stock_picking_deposit_in" model="stock.picking.type">
|
||||||
|
<field name="name">Recepción en Depósito</field>
|
||||||
|
<field name="code">incoming</field>
|
||||||
|
<field name="sequence_id" ref="seq_stock_picking_deposit_in" />
|
||||||
|
<field name="default_location_src_id" ref="stock.stock_location_suppliers"/>
|
||||||
|
<field name="is_deposit">True</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,20 +1,44 @@
|
||||||
# Copyright 2021 Criptomart
|
# Copyright 2021 Criptomart
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
|
||||||
|
|
||||||
|
#import logging
|
||||||
|
|
||||||
from odoo import api, models, fields
|
from odoo import api, models, fields
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
#_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
"""
|
|
||||||
class PickingType(models.Model):
|
class PickingType(models.Model):
|
||||||
|
|
||||||
_inherit = 'stock.picking.type'
|
_inherit = 'stock.picking.type'
|
||||||
|
|
||||||
"""
|
is_deposit = fields.Boolean(
|
||||||
|
string='Depósito',
|
||||||
class StockPicking(models.Model):
|
help='Éste albarán es un depósito, no es una venta final.',
|
||||||
|
default= False,
|
||||||
|
)
|
||||||
|
|
||||||
|
class Picking(models.Model):
|
||||||
_inherit = 'stock.picking'
|
_inherit = 'stock.picking'
|
||||||
|
|
||||||
is_deposit = fields.Boolean(
|
@api.onchange('picking_type_id','partner_id')
|
||||||
string='Es un Depósito',
|
def onchange_picking_type(self):
|
||||||
help='Éste albarán es un depósito, no una compra final',
|
super(Picking, self).onchange_picking_type()
|
||||||
)
|
if self.picking_type_id.is_deposit and self.partner_id:
|
||||||
|
self.change_dest_location()
|
||||||
|
|
||||||
|
def change_dest_location(self):
|
||||||
|
if self.picking_type_id.code == 'internal':
|
||||||
|
if not self.partner_id.deposit_sale_accept:
|
||||||
|
raise ValidationError("Éste cliente no acepta material en depósito, configúralo antes de crear depósitos para él.")
|
||||||
|
return
|
||||||
|
self.update({
|
||||||
|
'location_dest_id': self.partner_id.deposit_sale_location_id.id,
|
||||||
|
})
|
||||||
|
elif self.picking_type_id.code == 'incoming':
|
||||||
|
if not self.partner_id.deposit_buy_accept:
|
||||||
|
raise ValidationError("Éste proveedor no acepta depósitos, configúralo antes de crear depósitos para él.")
|
||||||
|
return
|
||||||
|
self.update({
|
||||||
|
'location_dest_id': self.partner_id.deposit_buy_location_id.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<odoo>
|
|
||||||
|
|
||||||
<!-- <record id="view_picking_type_form_inherit" model="ir.ui.view">
|
|
||||||
<field name="name">Operation Types inherit</field>
|
|
||||||
<field name="inherit_id" ref="stock.view_picking_type_form" />
|
|
||||||
<field name="model">stock.picking.type</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="show_reserved" position="after">
|
|
||||||
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record> -->
|
|
||||||
|
|
||||||
<record id="view_picking_form_deposito_inherit" model="ir.ui.view">
|
|
||||||
<field name="name">stock.picking.form.deposito.inherit</field>
|
|
||||||
<field name="inherit_id" ref="stock.view_picking_form" />
|
|
||||||
<field name="model">stock.picking</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="partner_id" position="before">
|
|
||||||
<field name="is_deposit"/>
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
Loading…
Add table
Reference in a new issue