Compare commits
2 commits
b9c09f6068
...
3cc04fb825
Author | SHA1 | Date | |
---|---|---|---|
|
3cc04fb825 | ||
|
8f306a2237 |
8 changed files with 56 additions and 36 deletions
|
@ -29,47 +29,52 @@ class Picking(models.Model):
|
|||
return super().create(vals)
|
||||
|
||||
def write(self, vals):
|
||||
if vals.get('picking_type_id'):
|
||||
picking_type = self.env['stock.picking.type'].browse(vals.get('picking_type_id'))
|
||||
if vals.get("picking_type_id"):
|
||||
picking_type = self.env["stock.picking.type"].browse(vals.get("picking_type_id"))
|
||||
if picking_type.is_deposit:
|
||||
self.change_dest_location(vals, picking_type.code)
|
||||
return super().write(vals)
|
||||
|
||||
@api.onchange('partner_id')
|
||||
@api.onchange("partner_id")
|
||||
def onchange_partner_id(self):
|
||||
#super().onchange_partner_id()
|
||||
for picking in self:
|
||||
if not picking.partner_id:
|
||||
return
|
||||
_logger.debug("onchange %s", picking.location_dest_id.name) # web cliebt does not update without this, wtf?
|
||||
_logger.warning("onchange %s %s", picking.location_dest_id.name, picking.location_id.name) # web cliebt does not update without this, wtf?
|
||||
_logger.warning("onchange %s", picking.picking_type_id.code)
|
||||
if picking.picking_type_id.is_deposit:
|
||||
if picking.picking_type_id.code == 'internal':
|
||||
if picking.picking_type_id.code in ["internal","outgoing"]:
|
||||
if not picking.partner_id.deposit_sale_accept:
|
||||
raise ValidationError("Éste cliente no acepta material en depósito, configúralo antes de crear un depósito para él.")
|
||||
return
|
||||
picking.location_dest_id = picking.partner_id.deposit_sale_location_id.id,
|
||||
elif picking.picking_type_id.code == 'incoming':
|
||||
picking.location_id = picking.partner_id.deposit_sale_location_id.id,
|
||||
moves = picking.env["stock.move"].search([("picking_id", "=", picking.id)])
|
||||
for move in moves:
|
||||
move.write({"partner_id": picking.partner_id.id}, {"location_id": picking.location_id})
|
||||
elif picking.picking_type_id.code == "incoming":
|
||||
if not picking.partner_id.deposit_buy_accept:
|
||||
raise ValidationError("Éste proveedor no suministra material en depósito, configúralo antes de crear un depósito para él.")
|
||||
return
|
||||
picking.location_dest_id = picking.partner_id.deposit_buy_location_id.id
|
||||
moves = picking.env['stock.move'].search([('picking_id', '=', picking.id)])
|
||||
moves = picking.env["stock.move"].search([("picking_id", "=", picking.id)])
|
||||
for move in moves:
|
||||
move.write({'partner_id': picking.partner_id.id}, {'location_dest_id': picking.location_dest_id})
|
||||
move.write({"partner_id": picking.partner_id.id}, {"location_dest_id": picking.location_dest_id})
|
||||
|
||||
def change_dest_location(self, vals, code):
|
||||
if vals.get('partner_id'):
|
||||
partner = self.env['res.partner'].browse(vals.get('partner_id'))
|
||||
if code == 'internal':
|
||||
if vals.get("partner_id"):
|
||||
partner = self.env["res.partner"].browse(vals.get("partner_id"))
|
||||
if code == "internal":
|
||||
if not partner.deposit_sale_accept:
|
||||
raise ValidationError("Éste cliente no acepta material en depósito, configúralo antes de crear un depósito para él.")
|
||||
return
|
||||
vals.update({
|
||||
'location_dest_id': partner.deposit_sale_location_id.id,
|
||||
"location_dest_id": partner.deposit_sale_location_id.id,
|
||||
})
|
||||
elif code == 'incoming':
|
||||
if not partner.deposit_buy_accept:
|
||||
raise ValidationError("Éste proveedor no suministra material en depósito, configúralo antes de crear un depósito para él.")
|
||||
return
|
||||
vals.update({
|
||||
'location_dest_id': partner.deposit_buy_location_id.id,
|
||||
"location_dest_id": partner.deposit_buy_location_id.id,
|
||||
})
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
'name': 'Website Product Retail',
|
||||
'category': 'Product',
|
||||
'summary': 'Setea categorías y ribbons de website en productos en distribución.',
|
||||
'version': "16.0.1.0.0",
|
||||
'description': """
|
||||
"name": "Website Product Retail",
|
||||
"category": "Product",
|
||||
"summary": "Setea categorías y ribbons de website en productos en distribución.",
|
||||
"version": "16.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"description": """
|
||||
|
||||
Configura categorías y ribbons de website en productos en distribución.
|
||||
==================================================
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"name": "Display product website descrition in e-commerce catalog pages.",
|
||||
"version": "16.0.1.0.2",
|
||||
"category": "Website",
|
||||
"author": "Criptomart",
|
||||
"license": "AGPL-3",
|
||||
"application": False,
|
||||
"installable": True,
|
||||
"depends": ["website_sale"],
|
||||
"data": ["views/website_sale_views.xml"],
|
||||
"assets": {
|
||||
"web.assets_frontend": [
|
||||
"website_sale_product_description_displayed/static/src/scss/custom.scss",
|
||||
],
|
||||
}
|
||||
}
|
1
website_sale_product_library/__init__.py
Normal file
1
website_sale_product_library/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from . import controllers
|
29
website_sale_product_library/__manifest__.py
Normal file
29
website_sale_product_library/__manifest__.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "Website Sale Product Library.",
|
||||
"version": "16.0.1.0.3",
|
||||
"category": "Website",
|
||||
"summary": "Modifica website_sale para una librería / Tienda de música.",
|
||||
"author": "Criptomart",
|
||||
"license": "AGPL-3",
|
||||
"description": """
|
||||
|
||||
Website Sale Product Library
|
||||
==================================================
|
||||
|
||||
Modifica la tienda online con los campos de product_library.
|
||||
|
||||
* Linka internal description con website_description.
|
||||
* Muestra en product en la lista de productos los campos de product_library (subtítulo, autor, editorial, formato, género).
|
||||
* En la vista del producto, añade subtítulo y autor después del nombre y la descripción.
|
||||
* Búsueda en la web por autor, editorial y subtítulo.
|
||||
""",
|
||||
"depends": ["website_sale", "product_library"],
|
||||
"data": ["views/website_sale_views.xml"],
|
||||
"assets": {
|
||||
"web.assets_frontend": [
|
||||
"website_sale_product_description_displayed/static/src/scss/custom.scss",
|
||||
],
|
||||
},
|
||||
"application": False,
|
||||
"installable": True,
|
||||
}
|
|
@ -5,5 +5,5 @@
|
|||
padding: 4px;
|
||||
background-color: #f6f6ff;
|
||||
border: 1px solid #99d;
|
||||
border-radius: 8px;
|
||||
border-radius: 6px;
|
||||
}
|
Loading…
Add table
Reference in a new issue