diff --git a/dbt_shipment_base/__manifest__.py b/dbt_shipment_base/__manifest__.py
index 5153540..3da3ede 100755
--- a/dbt_shipment_base/__manifest__.py
+++ b/dbt_shipment_base/__manifest__.py
@@ -1,7 +1,7 @@
{
'name': 'Dreambits Shipments Base',
- 'version': '12.0.1.0.0',
- 'depends': ['sale_management','stock'],
+ 'version': '14.0.1.0.0',
+ 'depends': ['sale_management', 'sale_stock'],
'summary': 'Module to have Shipment and Shipment Transporter Models',
'description': """
This module includes shipment and shipment transporter models which will
@@ -29,4 +29,3 @@
'installable': True,
'auto_install': False,
}
-
diff --git a/dbt_shipment_base/models/Shipment.py b/dbt_shipment_base/models/Shipment.py
index 42352b4..b9fbe2c 100755
--- a/dbt_shipment_base/models/Shipment.py
+++ b/dbt_shipment_base/models/Shipment.py
@@ -1,7 +1,7 @@
# /usr/bin/env python
# -*- coding: utf-8 -*-
-from odoo import models, fields, api
+from odoo import models, fields, api
import logging
_logger = logging.getLogger(__name__)
@@ -53,7 +53,7 @@ class Shipment(models.Model):
associated_sale = fields.Many2one('sale.order',
string='Associated Sales Order',
- required=True, ondelete='cascade')
+ required=True, ondelete='cascade')
associated_pickings = fields.One2many('stock.picking',
'associated_shipment',
string='Associated Stock Pickings')
@@ -65,17 +65,16 @@ class Shipment(models.Model):
synced = fields.Boolean('Synced')
@api.model
- def create(self, vals):
+ def create(self, vals):
_logger.info("inside set name")
name = self.env['ir.sequence'].next_by_code('dbt.shipment')
vals["name"] = name
vals["state"] = "ready"
vals["label_state"] = "waiting"
- return super(Shipment, self).create(vals)
+ return super(Shipment, self).create(vals)
@api.model
- @api.multi
def name_get(self):
_logger.info("Inside name_get fn")
result = []
@@ -84,7 +83,7 @@ def name_get(self):
record.name,
record.transporter.name if record.transporter.name else "None",
record.associated_sale.name)
- result.append((record.id, name))
+ result.append((record.id, name))
return result
@api.depends('associated_sale')
@@ -109,7 +108,7 @@ def update_state(self):
_logger.info("Shipment: " + str(shipments.name)
+ ": calling output method from scheduler")
transporter = shipments.transporter
- output_method = getattr(transporter, transporter.get_output_method)
+ output_method = getattr(transporter, transporter.get_output_method)
output_method(self.associated_shipment)
def action_sync(self):
@@ -134,13 +133,11 @@ def get_transporters(self):
return name_list
- @api.multi
def action_confirm(self):
res = super(CustomSaleOrder, self).action_confirm()
self.create_shipment()
return res
- @api.multi
def write(self, vals):
res = super(CustomSaleOrder, self).write(vals)
@@ -162,6 +159,7 @@ def create_shipment(self):
# lets get the tranporter and make the relevant
# lets get the state. If it is confirmed SO then also proceed
+ logging.info("***************************************************************************")
state = self.state
if state == "sale":
# lets check if shipment is already available or not
@@ -179,6 +177,7 @@ def create_shipment(self):
else:
values = {
'associated_sale': self.id,
+ # 'shipment_id': self.id,
}
shipment = self.env['dbt.shipment'].create(values)
@@ -202,15 +201,15 @@ def create_shipment(self):
_logger.info(pickings)
if pickings:
shipment.associated_pickings = [(6, False, pickings)]
+ # shipment.shipment_id = self.id
class CustomStockPicking(models.Model):
_inherit = 'stock.picking'
associated_shipment = fields.Many2one('dbt.shipment', 'Shipment')
- @api.multi
- def action_done(self):
- prev = super(CustomStockPicking, self).action_done()
+ def _action_done(self):
+ prev = super(CustomStockPicking, self)._action_done()
_logger.info("We are now inside stock picking")
company = self.env['res.company']._company_default_get('stock.picking')
@@ -224,8 +223,8 @@ def action_done(self):
generate_method = transporter.generate_file_method
output_method = transporter.get_output_method
- _logger.info(generate_method)
- _logger.info(output_method)
+ _logger.info("generate_method %s" % generate_method)
+ _logger.info("output_method %s" % output_method)
if transporter.transporter_type == "manual":
_logger.info("Manual transportation so no label is generated")
@@ -233,26 +232,27 @@ def action_done(self):
else:
# The transporter's method need to update label state and
# state of shipment
- _logger.info("now lets call this methods")
+ _logger.info("now lets call this methods:" )
# we are sending the stock picking object while calling the
# method so it should get the relevant shipment and keep it
# updated
if generate_method and not generate_method == "":
- input_function = getattr(transporter, generate_method)
+ input_function = getattr(transporter, generate_method)
input_function(self)
+ _logger.info("input_function in _action_done():")
if output_method and not output_method == "":
- output_function = getattr(transporter, output_method)
+ output_function = getattr(transporter, output_method)
output_function(self.associated_shipment)
+ _logger.info("output_function in _action_done():")
return prev
- @api.multi
def write(self, vals):
_logger.info("inside stock picking write")
_logger.info(self)
_logger.info(vals)
- result = super(CustomStockPicking, self).write(vals)
+ result = super(CustomStockPicking, self).write(vals)
for rec in self:
_logger.info(rec)
@@ -310,7 +310,8 @@ class ShipmentTransporter(models.Model):
should_override_existing = fields.Boolean("Override existing transporter?")
_sql_constraints = [('transporter_code_uniq', 'unique (transporter_code)',
- 'Duplicate transporter code not allowed !')]
+ 'Duplicate transporter code not allowed !')]
+
class ShipmentOptions(models.Model):
_name = "dbt.shipment.options"
diff --git a/dbt_shipment_base/models/res_company.py b/dbt_shipment_base/models/res_company.py
index e6adffa..2aaecee 100755
--- a/dbt_shipment_base/models/res_company.py
+++ b/dbt_shipment_base/models/res_company.py
@@ -8,4 +8,4 @@
class Company(models.Model):
_inherit = "res.company"
- shipment_picking_type_id = fields.Many2one('stock.picking.type', required=1, oldname="shippment_picking_type_id")
+ shipment_picking_type_id = fields.Many2one('stock.picking.type', required=1)
diff --git a/dbt_shipment_base/views/shipment_scheduler.xml b/dbt_shipment_base/views/shipment_scheduler.xml
index 1edd7fa..3334978 100755
--- a/dbt_shipment_base/views/shipment_scheduler.xml
+++ b/dbt_shipment_base/views/shipment_scheduler.xml
@@ -10,7 +10,7 @@
-1
-
+ model.update_state()
diff --git a/dbt_shipment_base/views/shipment_transporter_view.xml b/dbt_shipment_base/views/shipment_transporter_view.xml
index fe33ac8..f8fbdc8 100755
--- a/dbt_shipment_base/views/shipment_transporter_view.xml
+++ b/dbt_shipment_base/views/shipment_transporter_view.xml
@@ -5,7 +5,6 @@
Shipment Transporters
dbt.shipment.transporter
ir.actions.act_window
- form
tree,form
diff --git a/dbt_shipment_base/views/shipment_view.xml b/dbt_shipment_base/views/shipment_view.xml
index 3fe5328..acbb446 100755
--- a/dbt_shipment_base/views/shipment_view.xml
+++ b/dbt_shipment_base/views/shipment_view.xml
@@ -5,7 +5,6 @@
Shipments
dbt.shipment
ir.actions.act_window
- form
tree,form