commit
36bead3afd
|
|
@ -1221,7 +1221,7 @@ msgstr "لجان الإحتياج السنوي"
|
|||
|
||||
#. module: odex25_annual_purchase
|
||||
#: model:ir.model.fields,field_description:odex25_annual_purchase.field_annual_rfq__technical_attachment_ids
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_annual_purchase.view_annual_rfq_form_hide_chatter_for_committee
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_annual_purchase.view_annual_rfq_form
|
||||
msgid "Technical Attachments"
|
||||
msgstr "المرفقات الفنية"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,3 +3,4 @@ from . import addendum
|
|||
from . import purchase_requisition
|
||||
from . import annual_rfq
|
||||
from . import committe
|
||||
from . import purchase_order
|
||||
|
|
|
|||
|
|
@ -164,28 +164,12 @@ class PurchaseRFQ(models.Model):
|
|||
}
|
||||
|
||||
def action_refuse_rfq(self):
|
||||
|
||||
self.ensure_one()
|
||||
|
||||
member = self.env['committe.member'].search([
|
||||
('rfq_id', '=', self.id),
|
||||
('user_id', '=', self.env.user.id),
|
||||
], limit=1)
|
||||
|
||||
vals = {
|
||||
'refused': True,
|
||||
'select': False,
|
||||
'selection_reason': False,
|
||||
}
|
||||
|
||||
member = self._get_current_member_vote()
|
||||
if member:
|
||||
member.write(vals)
|
||||
else:
|
||||
self.env['committe.member'].create({
|
||||
'rfq_id': self.id,
|
||||
'user_id': self.env.user.id,
|
||||
**vals
|
||||
})
|
||||
self._check_committee_rejection()
|
||||
if member.refused:
|
||||
raise UserError(_("You have already refused this RFQ before."))
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
|
|
@ -195,6 +179,7 @@ class PurchaseRFQ(models.Model):
|
|||
'target': 'new',
|
||||
'context': {
|
||||
'default_rfq_id': self.id
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
@api.onchange('requisition_id')
|
||||
def _onchange_requisition_id(self):
|
||||
|
||||
if not self.requisition_id:
|
||||
return super(PurchaseOrder, self)._onchange_requisition_id()
|
||||
|
||||
requisition = self.requisition_id
|
||||
is_annual = bool(requisition.annual_request_id)
|
||||
|
||||
if not is_annual:
|
||||
|
||||
return super(PurchaseOrder, self)._onchange_requisition_id()
|
||||
|
||||
self = self.with_company(self.company_id)
|
||||
if self.partner_id:
|
||||
partner = self.partner_id
|
||||
else:
|
||||
partner = requisition.vendor_id
|
||||
payment_term = partner.property_supplier_payment_term_id
|
||||
|
||||
FiscalPosition = self.env['account.fiscal.position']
|
||||
fpos = FiscalPosition.with_company(self.company_id).get_fiscal_position(partner.id)
|
||||
|
||||
self.partner_id = partner.id
|
||||
self.fiscal_position_id = fpos.id
|
||||
self.payment_term_id = payment_term.id
|
||||
self.company_id = requisition.company_id.id
|
||||
self.currency_id = requisition.currency_id.id
|
||||
|
||||
current_origins = (self.origin or '').split(', ')
|
||||
if requisition.name and requisition.name not in current_origins:
|
||||
if self.origin:
|
||||
self.origin = self.origin + ', ' + requisition.name
|
||||
else:
|
||||
self.origin = requisition.name
|
||||
self.notes = requisition.description
|
||||
self.date_order = fields.Datetime.now()
|
||||
|
||||
requisition_lines_map = {
|
||||
line.product_id.id: line
|
||||
for line in requisition.line_ids
|
||||
}
|
||||
|
||||
for po_line in self.order_line:
|
||||
req_line = requisition_lines_map.get(po_line.product_id.id)
|
||||
|
||||
if req_line:
|
||||
|
||||
price_unit = req_line.price_unit
|
||||
if req_line.product_uom_id != po_line.product_uom:
|
||||
price_unit = req_line.product_uom_id._compute_price(
|
||||
req_line.price_unit, po_line.product_uom
|
||||
)
|
||||
|
||||
po_line.price_unit = price_unit
|
||||
|
|
@ -33,14 +33,14 @@
|
|||
string="Select"
|
||||
class="oe_highlight"
|
||||
attrs="{'invisible': [('show_committee_actions','=',False)]}"
|
||||
|
||||
groups="odex25_annual_purchase.group_technical_committee,odex25_annual_purchase.group_annual_committee"
|
||||
|
||||
/>
|
||||
<button name="action_refuse_rfq"
|
||||
type="object"
|
||||
string="Refuse"
|
||||
attrs="{'invisible': [('show_committee_actions','=',False)]}"
|
||||
|
||||
groups="odex25_annual_purchase.group_technical_committee,odex25_annual_purchase.group_annual_committee"
|
||||
|
||||
/>
|
||||
<button type="object" name="action_recommend"
|
||||
|
|
|
|||
Loading…
Reference in New Issue