mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[IMP] : black, isort
This commit is contained in:
@@ -5,43 +5,52 @@ from odoo import fields, models
|
||||
|
||||
|
||||
class StockRule(models.Model):
|
||||
_inherit = 'stock.rule'
|
||||
_inherit = "stock.rule"
|
||||
|
||||
rma_line_id = fields.Many2one(
|
||||
comodel_name='rma.order.line', string='RMA line',
|
||||
ondelete="set null",
|
||||
comodel_name="rma.order.line", string="RMA line", ondelete="set null"
|
||||
)
|
||||
|
||||
def _get_stock_move_values(self, product_id, product_qty, product_uom,
|
||||
location_id, name, origin, values, group_id):
|
||||
res = super(StockRule, self)._get_stock_move_values(product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name, origin,
|
||||
values, group_id)
|
||||
if 'rma_line_id' in values:
|
||||
line = self.env['rma.order.line'].browse(values.get('rma_line_id'))
|
||||
res['rma_line_id'] = line.id
|
||||
def _get_stock_move_values(
|
||||
self,
|
||||
product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name,
|
||||
origin,
|
||||
values,
|
||||
group_id,
|
||||
):
|
||||
res = super(StockRule, self)._get_stock_move_values(
|
||||
product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name,
|
||||
origin,
|
||||
values,
|
||||
group_id,
|
||||
)
|
||||
if "rma_line_id" in values:
|
||||
line = self.env["rma.order.line"].browse(values.get("rma_line_id"))
|
||||
res["rma_line_id"] = line.id
|
||||
if line.delivery_address_id:
|
||||
res['partner_id'] = line.delivery_address_id.id
|
||||
res["partner_id"] = line.delivery_address_id.id
|
||||
else:
|
||||
res['partner_id'] = line.rma_id.partner_id.id
|
||||
dest_loc = self.env["stock.location"].browse([
|
||||
res["location_dest_id"]])[0]
|
||||
res["partner_id"] = line.rma_id.partner_id.id
|
||||
dest_loc = self.env["stock.location"].browse([res["location_dest_id"]])[0]
|
||||
if dest_loc.usage == "internal":
|
||||
res["price_unit"] = line.price_unit
|
||||
return res
|
||||
|
||||
|
||||
class ProcurementGroup(models.Model):
|
||||
_inherit = 'procurement.group'
|
||||
_inherit = "procurement.group"
|
||||
|
||||
rma_id = fields.Many2one(
|
||||
comodel_name='rma.order', string='RMA',
|
||||
ondelete="set null",
|
||||
comodel_name="rma.order", string="RMA", ondelete="set null"
|
||||
)
|
||||
rma_line_id = fields.Many2one(
|
||||
comodel_name='rma.order.line', string='RMA line',
|
||||
ondelete="set null",
|
||||
comodel_name="rma.order.line", string="RMA line", ondelete="set null"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user