Skip to content

Commit

Permalink
Add journal support to purchase orders and invoices
Browse files Browse the repository at this point in the history
Introduced a new "journal_id" field in purchase orders to specify the journal for related invoices. Updated the invoice preparation logic to include the selected journal. Adjusted the purchase order view to display the journal field and incremented the module version to 17.0.1.1.5.
  • Loading branch information
dhongu committed Jan 28, 2025
1 parent a068861 commit 7136b48
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ addon | version | maintainers | summary | price
[deltatech_queue_job](deltatech_queue_job/) | 17.0.1.0.2 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Deltatech Queue Job | Free
[deltatech_ral](deltatech_ral/) | 17.0.1.0.3 | | RAL | Free
[deltatech_reception_note](deltatech_reception_note/) | 17.0.0.1.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Batch reception note | Free
[deltatech_record_type](deltatech_record_type/) | 17.0.1.1.4 | [![VoicuStefan2001](https://github.com/VoicuStefan2001.png?size=30px)](https://github.com/VoicuStefan2001) | Manage multiple record types | Free
[deltatech_record_type](deltatech_record_type/) | 17.0.1.1.5 | [![VoicuStefan2001](https://github.com/VoicuStefan2001.png?size=30px)](https://github.com/VoicuStefan2001) | Manage multiple record types | Free
[deltatech_replenish](deltatech_replenish/) | 17.0.1.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Deltatech Replenish | Free
[deltatech_report_packaging](deltatech_report_packaging/) | 17.0.1.0.2 | [![cojocariudaniel1](https://github.com/cojocariudaniel1.png?size=30px)](https://github.com/cojocariudaniel1) [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Report Packaging | Free
[deltatech_report_prn](deltatech_report_prn/) | 17.0.1.0.4 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Raport PRN | Free
Expand Down
2 changes: 1 addition & 1 deletion deltatech_record_type/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Terrabit - Record Type",
"summary": "Manage multiple record types",
"version": "17.0.1.1.4",
"version": "17.0.1.1.5",
"author": "Terrabit, Voicu Stefan",
"website": "https://www.terrabit.ro",
"category": "Generic Modules/Other",
Expand Down
7 changes: 7 additions & 0 deletions deltatech_record_type/models/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@ class SaleOrder(models.Model):
_inherit = "purchase.order"

po_type = fields.Many2one("record.type", string="Order Type", tracking=True)
journal_id = fields.Many2one("account.journal", string="Journal", domain="[('type', '=', 'purchase')]")

@api.onchange("po_type")
def _onchange_po_type(self):
for default_value in self.po_type.default_values_ids:
self[default_value.field_name] = safe_eval(default_value.field_value)

def _prepare_invoice(self):
invoice_vals = super()._prepare_invoice()
if self.journal_id:
invoice_vals["journal_id"] = self.journal_id.id
return invoice_vals
3 changes: 3 additions & 0 deletions deltatech_record_type/views/purchase_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<field name="currency_id" position="after">
<field name="po_type" options="{'no_create':True}" domain="[('model', '=', 'purchase.order')]" />
</field>
<field name="fiscal_position_id" position="after">
<field name="journal_id" />
</field>
</field>
</record>

Expand Down

0 comments on commit 7136b48

Please sign in to comment.