forked from izzihector/github-forwarderp-pwk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34690b9
commit 9de383b
Showing
222 changed files
with
2,714 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,186 @@ | ||
all in one cancel | ||
All In One Cancel | ||
all in one cancel order | ||
all in one cancel po | ||
all in one cancel so | ||
all in one cancel sale order | ||
all in one cancel purchase order | ||
all in one cancel sales order | ||
all in one cancel sales | ||
all in one cancel purchase | ||
cancel all in one | ||
All in one | ||
All in One | ||
All In One Cancel Order | ||
All In One Cancel PO | ||
All In One Cancel SO | ||
All In One Cancel Sale Order | ||
All In One Cancel Purchase Order | ||
All In One Cancel Sales Order | ||
All In One Cancel Sales | ||
All In One Cancel Purchase | ||
Cancel All In One | ||
|
||
sale cancel | ||
Sale Cancel | ||
picking cancel | ||
Picking Cancel | ||
Stock Cancel | ||
stock cancel | ||
order cancel | ||
Order Cancel | ||
invoice cancel | ||
Invoice Cancel | ||
|
||
invoice order cancel | ||
cancel invoice | ||
invoice cancel | ||
reverse invoice | ||
invoice order cancel | ||
Stock cancel reverse accounting | ||
Picking Cancel | ||
Cancel Order | ||
Cancel Picking | ||
Cancel Invoice | ||
Invoice Cancel | ||
Cancel Receipts | ||
Receipt Cancel | ||
Cancel Order | ||
Cancel shipment | ||
reverse invoice | ||
account invoice cancel in odoo | ||
|
||
shipment cancel | ||
account invoice cancel | ||
Cancel Invoice Order | ||
Cancel Outgoing invoice | ||
Cancel Incoming Picking | ||
Reset Stock Move/Picking | ||
|
||
Cancel move | ||
reset move | ||
return move | ||
Reset Invoice Order | ||
reverse Invoice Order | ||
Return Invoice Order | ||
return invoice | ||
return invoice | ||
reverse move | ||
account cancel | ||
return account | ||
account return | ||
Stock Picking Cancel | ||
Stock Picking cancel and Reverse | ||
cancel accounting entries | ||
reverse account | ||
account reverse | ||
reverse account entries | ||
account entry reverse | ||
return account entry | ||
account entry return | ||
|
||
cancel confirmed Sales Order | ||
cancel confirmed Sale Order | ||
cancel confirmed SO | ||
|
||
cancel processed Sales Order | ||
cancel processed Sale Order | ||
cancel processed SO | ||
|
||
cancel done Sales Order | ||
cancel done Sale Order | ||
cancel done SO | ||
|
||
cancel transferred Sales Order | ||
cancel transferred Sale Order | ||
cancel transferred SO | ||
|
||
Cancel completed Sales Order | ||
Cancel completed Sale Order | ||
Cancel completed SO | ||
|
||
|
||
Reset to draft Sales order | ||
Reset to draft Sale order | ||
Reset to draft SO | ||
|
||
cancel sale transaction | ||
cancel sales transaction | ||
cancel SO transaction | ||
|
||
cancel confirmed Purchases Order | ||
cancel confirmed Purchase Order | ||
cancel confirmed PO | ||
|
||
cancel processed Purchases Order | ||
cancel processed Purchase Order | ||
cancel processed PO | ||
|
||
cancel done Purchases Order | ||
cancel done Purchase Order | ||
cancel done PO | ||
|
||
cancel transferred Purchases Order | ||
cancel transferred Purchase Order | ||
cancel transferred PO | ||
|
||
Cancel completed Purchases Order | ||
Cancel completed Purchase Order | ||
Cancel completed PO | ||
|
||
|
||
Reset to draft Purchases order | ||
Reset to draft Purchase order | ||
Reset to draft PO | ||
|
||
cancel purchase transaction | ||
cancel purchases transaction | ||
cancel PO transaction | ||
|
||
|
||
delivery order cancel | ||
cancel picking | ||
delivery cancel | ||
reverse delivery | ||
picking order cancel | ||
Stock cancel reverse accounting | ||
Picking Cancel | ||
Cancel Order | ||
Cancel Picking | ||
Cancel Delivery | ||
Delivery Cancel | ||
Cancel Receipts | ||
Receipt Cancel | ||
Cancel Order | ||
Cancel shipment | ||
reverse picking | ||
stock picking cancel in odoo | ||
|
||
shipment cancel | ||
stock picking cancel | ||
Cancel Delivery Order | ||
Cancel Outgoing picking | ||
Cancel Incoming Picking | ||
Reset Stock Move/Picking | ||
|
||
Cancel move | ||
reset move | ||
return move | ||
Reset Delivery Order | ||
reverse Delivery Order | ||
Return Delivery Order | ||
return picking | ||
return delivery | ||
reverse move | ||
stock cancel | ||
return stock | ||
stock return | ||
Stock Picking Cancel | ||
Stock Picking cancel and Reverse | ||
cancel accounting entries | ||
reverse stock | ||
stock reverse | ||
reverse stock entries | ||
stock entry reverse | ||
return stock entry | ||
stock entry return |
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import models | ||
from . import wizard |
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
{ | ||
'name' : 'All In One Cancel Sales,Purchases and Delivery/Incoming Shipments', | ||
'version' : '1.0', | ||
'author':'Craftsync Technologies', | ||
'category': 'Sales', | ||
'maintainer': 'Craftsync Technologies', | ||
'summary': """Enable Auto cancel like Sales Purchase and invoice, Inventory . This module it will allow you cancel sale,purchase,accounting,Inventory even if it already done. """, | ||
|
||
'website': 'https://www.craftsync.com/', | ||
'license': 'OPL-1', | ||
'support':'info@craftsync.com', | ||
'depends' : ['purchase_stock','account_cancel','sale_management','sale_stock'], | ||
'data': [ | ||
|
||
'views/res_config_settings_views.xml', | ||
'views/view_purchase_order.xml', | ||
'views/stock_warehouse.xml', | ||
'views/view_sale_order.xml', | ||
'views/stock_picking.xml', | ||
'wizard/view_cancel_delivery_wizard.xml', | ||
|
||
], | ||
|
||
'installable': True, | ||
'application': True, | ||
'auto_install': False, | ||
'price': 34.99, | ||
'currency': 'EUR', | ||
|
||
'images': ['static/description/main_screen.png'], | ||
|
||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from . import purchase_order | ||
from . import res_config_settings | ||
from . import company | ||
from . import sale_order | ||
from . import warehouse | ||
from . import stock_picking |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.2 KB
all_in_one_cancel/models/__pycache__/res_config_settings.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from odoo import api, fields, models | ||
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
cancel_delivery_order_for_po = fields.Boolean(string="Cancel Delivery Order?") | ||
cancel_invoice_for_po = fields.Boolean(string='Cancel Invoice?') | ||
cancel_done_picking = fields.Boolean(string='Cancel Done Delivery?') |
This file contains 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 |
---|---|---|
@@ -0,0 +1,123 @@ | ||
from odoo import api, fields, models, exceptions | ||
|
||
|
||
class PurchaseOrder(models.Model): | ||
_inherit = "purchase.order" | ||
|
||
cancel_done_picking = fields.Boolean(string='Cancel Done Delivery?', compute='check_cancel_done_picking') | ||
|
||
@api.model | ||
def check_cancel_done_picking(self): | ||
for order in self: | ||
Flag = False | ||
if order.company_id.cancel_done_picking and order.picking_count > 0: | ||
for picking in self.picking_ids: | ||
if picking.state != 'cancel': | ||
Flag = True | ||
break | ||
order.cancel_done_picking = Flag | ||
|
||
@api.multi | ||
def cancel_picking(self): | ||
if len(self.picking_ids) == 1 : | ||
self.picking_ids.with_context({'Flag':True}).action_cancel() | ||
return self.action_view_delivery() | ||
else: | ||
return self.action_cancel_selected_picking() | ||
|
||
@api.multi | ||
def action_view_delivery(self): | ||
action = self.env.ref('stock.action_picking_tree_all').read()[0] | ||
picking_records = self.mapped('picking_ids') | ||
if picking_records: | ||
action['views'] = [(self.env.ref('stock.view_picking_form').id, 'form')] | ||
action['res_id'] = picking_records.id | ||
return action | ||
|
||
@api.multi | ||
def action_cancel_selected_picking(self): | ||
picking_obj=self.env['stock.picking'] | ||
pickings=[] | ||
for picking in self.picking_ids: | ||
if picking.state !='cancel': | ||
pickings.append(picking.id) | ||
return { | ||
'type': 'ir.actions.act_window', | ||
'res_model': 'cancel.picking.wizard', | ||
'view_mode':'form', | ||
'views': [(self.env.ref('all_in_one_cancel.delivery_cancel_form_cft_all_in_one_cancel').id, 'form')], | ||
'target': 'new', | ||
'context': { | ||
'pickings':pickings, | ||
}, | ||
} | ||
|
||
|
||
@api.multi | ||
def button_cancel(self): | ||
quant_obj = self.env['stock.quant'] | ||
model_obj = self.env['ir.model'] | ||
moves = self.env['account.move'] | ||
account_move_obj = self.env['account.move'] | ||
model = model_obj.search([('model', '=', 'stock.landed.cost')]) | ||
|
||
for order in self: | ||
if order.picking_ids and order.company_id.cancel_delivery_order_for_po : | ||
for picking in order.picking_ids: | ||
if picking.state == 'cancel': | ||
continue | ||
if model and picking.picking_type_code == 'incoming': | ||
cost_recs = self.env['stock.landed.cost'].search([('state', '=', 'done'),('picking_ids', 'in', order.picking_ids.ids)]) | ||
if cost_recs: | ||
raise exceptions.Warning('Please Remove stock landed cost "%s" related with this incoming shipment(%s) then try to cancel it.'%(','.join(cost_recs.mapped('name')),picking.name)) | ||
if picking.state not in ['done']: | ||
picking.action_cancel() | ||
else: | ||
account_moves = picking.move_lines | ||
for move in account_moves: | ||
if move.state == 'cancel': | ||
continue | ||
# move._do_unreserve() | ||
if move.state == "done" and move.product_id.type == "product": | ||
for move_line in move.move_line_ids: | ||
quantity = move_line.product_uom_id._compute_quantity(move_line.qty_done, move_line.product_id.uom_id) | ||
quant_obj._update_available_quantity(move_line.product_id, move_line.location_id, quantity,move_line.lot_id) | ||
quant_obj._update_available_quantity(move_line.product_id, move_line.location_dest_id, quantity * -1,move_line.lot_id) | ||
if move.procure_method == 'make_to_order' and not move.move_orig_ids: | ||
move.state = 'waiting' | ||
elif move.move_orig_ids and not all(orig.state in ('done', 'cancel') for orig in move.move_orig_ids): | ||
move.state = 'waiting' | ||
else: | ||
move.state = 'confirmed' | ||
siblings_states = (move.move_dest_ids.mapped('move_orig_ids') - move).mapped('state') | ||
if move.propagate: | ||
# only cancel the next move if all my siblings are also cancelled | ||
if all(state == 'cancel' for state in siblings_states): | ||
move.move_dest_ids._action_cancel() | ||
else: | ||
if all(state in ('done', 'cancel') for state in siblings_states): | ||
move.move_dest_ids.write({'procure_method': 'make_to_stock'}) | ||
move.move_dest_ids.write({'move_orig_ids': [(3, move.id, 0)]}) | ||
account_moves = account_move_obj.search([('stock_move_id', '=', move.id)]) | ||
if account_moves: | ||
for account_move in account_moves: | ||
account_move.button_cancel() | ||
account_move.unlink() | ||
|
||
if order.company_id.cancel_invoice_for_po: | ||
for invoice in order.invoice_ids: | ||
if invoice.journal_id and not invoice.journal_id.update_posted: | ||
invoice.journal_id.write({'update_posted':True}) | ||
if invoice.state in ['draft','open']: | ||
invoice.action_cancel() | ||
|
||
else: | ||
moves = invoice.move_id | ||
# invoice.payment_move_line_ids.remove_move_reconcile() | ||
# invoice.payment_move_line_ids.button_cancel() | ||
if moves and not moves.journal_id.update_posted: | ||
moves.write({'update_posted':True}) | ||
invoice.action_cancel() | ||
|
||
res = super(PurchaseOrder,self).button_cancel() | ||
return res |
This file contains 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = 'res.config.settings' | ||
|
||
cancel_delivery_order_for_po = fields.Boolean(string="Cancel Delivery Order?") | ||
cancel_invoice_for_po = fields.Boolean(string='Cancel Invoice?') | ||
cancel_done_picking = fields.Boolean(string='Cancel Done Delivery?') | ||
|
||
@api.multi | ||
def get_values(self): | ||
res = super(ResConfigSettings, self).get_values() | ||
res.update( | ||
cancel_delivery_order_for_po=self.env.user.company_id.cancel_delivery_order_for_po , | ||
cancel_invoice_for_po = self.env.user.company_id.cancel_invoice_for_po, | ||
cancel_done_picking=self.env.user.company_id.cancel_done_picking | ||
) | ||
return res | ||
|
||
def set_values(self): | ||
super(ResConfigSettings, self).set_values() | ||
company_id=self.env.user.company_id | ||
company_id.cancel_invoice_for_po = self.cancel_invoice_for_po | ||
company_id.cancel_delivery_order_for_po = self.cancel_delivery_order_for_po | ||
company_id.cancel_done_picking = self.cancel_done_picking | ||
|
Oops, something went wrong.