mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-28 01:52:04 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import accrued_orders
|
||||
from . import stock_rules_report
|
||||
from . import sale_order_cancel
|
||||
from . import stock_return_picking
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
from odoo import models, api
|
||||
|
||||
|
||||
class AccountAccruedOrdersWizard(models.TransientModel):
|
||||
_inherit = 'account.accrued.orders.wizard'
|
||||
|
||||
@api.model
|
||||
def _get_product_expense_and_stock_var_accounts(self, product):
|
||||
self.ensure_one()
|
||||
res = super()._get_product_expense_and_stock_var_accounts(product)
|
||||
if product.is_storable and product.valuation == 'real_time':
|
||||
product_accounts = product._get_product_accounts()
|
||||
expense_account = product_accounts.get('expense')
|
||||
stock_variation_account = product_accounts.get('stock_variation')
|
||||
if expense_account and stock_variation_account:
|
||||
return (expense_account, stock_variation_account)
|
||||
return res
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrderCancel(models.TransientModel):
|
||||
_inherit = 'sale.order.cancel'
|
||||
|
||||
display_delivery_alert = fields.Boolean('Delivery Alert', compute='_compute_display_delivery_alert')
|
||||
|
||||
@api.depends('order_id')
|
||||
def _compute_display_delivery_alert(self):
|
||||
for wizard in self:
|
||||
out_pickings = wizard.order_id.picking_ids.filtered(lambda p: p.picking_type_code == 'outgoing')
|
||||
wizard.display_delivery_alert = bool(any(picking.state == 'done' for picking in out_pickings))
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="sale_order_cancel_view_form_inherit" model="ir.ui.view">
|
||||
<field name="name">sale.order.cancel.form.inherit</field>
|
||||
<field name="model">sale.order.cancel</field>
|
||||
<field name="inherit_id" ref="sale.sale_order_cancel_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<span id="display_invoice_alert" position="after">
|
||||
<field name="display_delivery_alert" invisible="1"/>
|
||||
<span attrs="{'invisible': [('display_delivery_alert', '=', False)]}">
|
||||
Some deliveries are already done. Returns can be created from the Delivery Orders.
|
||||
</span>
|
||||
</span>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockReturnPickingLine(models.TransientModel):
|
||||
_inherit = 'stock.return.picking.line'
|
||||
|
||||
def _prepare_move_default_values(self, new_picking):
|
||||
vals = super()._prepare_move_default_values(new_picking)
|
||||
if self.move_id.sale_line_id:
|
||||
vals['sale_line_id'] = self.move_id.sale_line_id
|
||||
return vals
|
||||
|
||||
|
||||
class StockReturnPicking(models.TransientModel):
|
||||
_inherit = 'stock.return.picking'
|
||||
|
||||
def _prepare_picking_default_values_based_on(self, picking):
|
||||
vals = super()._prepare_picking_default_values_based_on(picking)
|
||||
if picking.sale_id:
|
||||
vals['sale_id'] = picking.sale_id.id
|
||||
return vals
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockReturnPicking(models.TransientModel):
|
||||
_inherit = 'stock.return.picking'
|
||||
|
||||
def _get_proc_values(self, line):
|
||||
sol = line.move_id.sale_line_id
|
||||
if sol:
|
||||
return sol._prepare_procurement_values()
|
||||
return super()._get_proc_values(line)
|
||||
Loading…
Add table
Add a link
Reference in a new issue