-
Notifications
You must be signed in to change notification settings - Fork 4
updated #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
paidykumar-dreambits
wants to merge
2
commits into
dreambits:14.0
Choose a base branch
from
paidykumar-dreambits:14.0-migration
base: 14.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
updated #13
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this commented ? |
||
| } | ||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this commented ? |
||
|
|
||
|
|
||
| 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,35 +223,36 @@ 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") | ||
| self.associated_shipment.state = "ready_shipment" | ||
| 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" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove logs from production code