mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX]do not duplicate related records.
[FIX]button to related rmas [FIX]printout [IMP]add term and conditions field at rma level
This commit is contained in:
@@ -10,7 +10,7 @@ class ProcurementOrder(models.Model):
|
||||
|
||||
rma_line_id = fields.Many2one(
|
||||
comodel_name='rma.order.line', string='RMA line',
|
||||
ondelete="set null",
|
||||
ondelete="set null", copy=False
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@@ -35,9 +35,9 @@ class ProcurementGroup(models.Model):
|
||||
|
||||
rma_id = fields.Many2one(
|
||||
comodel_name='rma.order', string='RMA',
|
||||
ondelete="set null",
|
||||
ondelete="set null", copy=False
|
||||
)
|
||||
rma_line_id = fields.Many2one(
|
||||
comodel_name='rma.order.line', string='RMA line',
|
||||
ondelete="set null",
|
||||
ondelete="set null", copy=False,
|
||||
)
|
||||
|
||||
@@ -13,6 +13,7 @@ ops = {'=': operator.eq,
|
||||
class RmaOrderLine(models.Model):
|
||||
_name = "rma.order.line"
|
||||
_inherit = ['mail.thread']
|
||||
_order = 'create_date desc, id desc'
|
||||
|
||||
@api.model
|
||||
def _get_default_type(self):
|
||||
@@ -191,14 +192,17 @@ class RmaOrderLine(models.Model):
|
||||
rma_id = fields.Many2one(
|
||||
comodel_name='rma.order', string='RMA Group',
|
||||
track_visibility='onchange', readonly=True,
|
||||
copy=False
|
||||
)
|
||||
name = fields.Char(
|
||||
string='Reference', required=True, default='/',
|
||||
readonly=True, states={'draft': [('readonly', False)]},
|
||||
copy=False,
|
||||
help='Add here the supplier RMA #. Otherwise an internal code is'
|
||||
' assigned.',
|
||||
)
|
||||
description = fields.Text(string='Description')
|
||||
conditions = fields.Html(string='Terms and conditions')
|
||||
origin = fields.Char(
|
||||
string='Source Document',
|
||||
readonly=True, states={'draft': [('readonly', False)]},
|
||||
@@ -252,7 +256,7 @@ class RmaOrderLine(models.Model):
|
||||
required=True,
|
||||
readonly=True, states={'draft': [('readonly', False)]},
|
||||
)
|
||||
price_unit = fields.Monetary(
|
||||
price_unit = fields.Float(
|
||||
string='Price Unit',
|
||||
readonly=True, states={'draft': [('readonly', False)]},
|
||||
)
|
||||
@@ -335,7 +339,8 @@ class RmaOrderLine(models.Model):
|
||||
default=_default_location_id,
|
||||
)
|
||||
customer_rma_id = fields.Many2one(
|
||||
'rma.order.line', string='Customer RMA line', ondelete='cascade')
|
||||
'rma.order.line', string='Customer RMA line', ondelete='cascade',
|
||||
copy=False)
|
||||
supplier_rma_line_ids = fields.One2many(
|
||||
'rma.order.line', 'customer_rma_id')
|
||||
rma_line_count = fields.Integer(
|
||||
@@ -642,18 +647,19 @@ class RmaOrderLine(models.Model):
|
||||
# from customer we link to supplier rma
|
||||
action = self.env.ref(
|
||||
'rma.action_rma_supplier_lines')
|
||||
rma_lines = self.supplier_rma_line_ids.ids
|
||||
rma_lines = self.supplier_rma_line_ids
|
||||
res = self.env.ref('rma.view_rma_line_supplier_form', False)
|
||||
else:
|
||||
# from supplier we link to customer rma
|
||||
action = self.env.ref(
|
||||
'rma.action_rma_customer_lines')
|
||||
rma_lines = self.customer_rma_id.ids
|
||||
rma_lines = self.customer_rma_id
|
||||
res = self.env.ref('rma.view_rma_line_form', False)
|
||||
result = action.read()[0]
|
||||
# choose the view_mode accordingly
|
||||
if rma_lines and len(rma_lines) != 1:
|
||||
result['domain'] = rma_lines.ids
|
||||
result['domain'] = "[('id', 'in', " + \
|
||||
str(rma_lines.ids) + ")]"
|
||||
elif len(rma_lines) == 1:
|
||||
result['views'] = [(res and res.id or False, 'form')]
|
||||
result['res_id'] = rma_lines[0]
|
||||
|
||||
@@ -26,7 +26,7 @@ class StockMove(models.Model):
|
||||
_inherit = "stock.move"
|
||||
|
||||
rma_line_id = fields.Many2one('rma.order.line', string='RMA line',
|
||||
ondelete='restrict')
|
||||
ondelete='restrict', copy=False)
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
|
||||
@@ -84,6 +84,10 @@
|
||||
<strong><p>Description</p></strong>
|
||||
<span t-field="doc.description"></span>
|
||||
</div>
|
||||
<div>
|
||||
<strong><p>Term and Conditions</p></strong>
|
||||
<span t-field="doc.conditions"></span>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
@@ -198,6 +198,7 @@
|
||||
</page>
|
||||
<page name="other" string="Other Info">
|
||||
<group name="general" string="General">
|
||||
<field name="conditions"/>
|
||||
<field name="rma_id"/>
|
||||
<field name="origin"/>
|
||||
|
||||
@@ -371,6 +372,7 @@
|
||||
</page>
|
||||
<page name="other" string="Other Info">
|
||||
<group name="general" string="General">
|
||||
<field name="conditions"/>
|
||||
<field name="rma_id"/>
|
||||
<field name="origin"/>
|
||||
</group>
|
||||
|
||||
@@ -156,11 +156,12 @@ class AccountInvoiceLine(models.Model):
|
||||
compute=_compute_rma_count, string='# of RMA')
|
||||
rma_line_ids = fields.One2many(
|
||||
comodel_name='rma.order.line', inverse_name='invoice_line_id',
|
||||
string="RMA", readonly=True,
|
||||
string="RMA", readonly=True, copy=False,
|
||||
help="This will contain the RMA lines for the invoice line")
|
||||
|
||||
rma_line_id = fields.Many2one(
|
||||
comodel_name='rma.order.line',
|
||||
string="RMA line refund",
|
||||
copy=False,
|
||||
ondelete="set null",
|
||||
help="This will contain the rma line that originated the refund line")
|
||||
|
||||
@@ -13,7 +13,7 @@ class PurchaseOrderLine(models.Model):
|
||||
state = fields.Selection(related='order_id.state', store=True)
|
||||
|
||||
rma_line_id = fields.Many2one(
|
||||
comodel_name='rma.order.line', string='RMA',
|
||||
comodel_name='rma.order.line', string='RMA', copy=False
|
||||
)
|
||||
|
||||
@api.model
|
||||
|
||||
@@ -47,7 +47,8 @@ class SaleOrderLine(models.Model):
|
||||
return super(SaleOrderLine, self).name_get()
|
||||
|
||||
rma_line_id = fields.Many2one(
|
||||
comodel_name='rma.order.line', string='RMA', ondelete='restrict')
|
||||
comodel_name='rma.order.line', string='RMA', ondelete='restrict',
|
||||
copy=False)
|
||||
|
||||
@api.multi
|
||||
def _prepare_order_line_procurement(self, group_id=False):
|
||||
|
||||
Reference in New Issue
Block a user