Conversation
Add an acceptance label printed from transfers (3 per A4 portrait sheet), so that the incoming goods can be tagged with their acceptance number and the result of the acceptance test can be marked by hand on the label.
The date to be printed as the arrival date differs between operations, so the effective date of the transfer cannot always be used. Let the field be selected in the inventory settings, among the date and datetime fields of the transfer and of its lines, and keep the effective date of the transfer as the default.
The goods are accepted per lot, so the lot number and the expiration date of that lot belong on the label as well. They stay blank while the lots of the line are unknown, and a line received in several lots prints them all. The barcode becomes a row of the table like every other value, instead of a picture below it, so that the whole label reads as a single form. The status area is what differs the most between operations, so it moves to the inventory settings as editable HTML. The built-in area is printed as long as the setting is left empty, which keeps it translated. Depends on product_expiry, which is where the expiration date of a lot comes from.
The layout of the label was an asset of web.report_assets_common, which is fetched over HTTP by wkhtmltopdf and shared by every report of the database. A base URL that cannot be reached therefore produced a label without page breaks nor fixed bands, silently, and the rules were loaded by reports that have no use for them. Move the rules into a style element of the report template, so that the layout travels with the markup it applies to and the module needs no asset bundle. The rendered PDF is unchanged.
|
To use Codex here, create a Codex account and connect to github. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 919233bb26
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| class StockMove(models.Model): | ||
| _inherit = "stock.move" | ||
|
|
||
| acceptance_number = fields.Char(copy=False) |
There was a problem hiding this comment.
Prevent differently numbered moves from merging
When a draft transfer contains otherwise merge-compatible moves with different acceptance numbers, the normal stock.move confirmation merge does not consider this newly added field, so the moves can collapse into one line and one acceptance number is discarded. Include acceptance_number among the distinct fields used when merging moves so each numbered line still produces its intended label.
Useful? React with 👍 / 👎.
| self.env["ir.config_parameter"].sudo().set_param( | ||
| STATUS_HTML_PARAM, False if is_html_empty(status_html) else status_html |
There was a problem hiding this comment.
Keep the built-in status area language-dependent
When the status parameter is initially unset, get_values() fills this transient field with the built-in area translated for the settings user's language, and saving Inventory settings—even without editing this field—persists that rendered HTML here. Subsequent reports then treat it as custom content and print that one language for every user instead of translating the built-in area for the printing user; leave the parameter unset when the submitted value is the built-in default.
Useful? React with 👍 / 👎.
This comment was marked as off-topic.
This comment was marked as off-topic.
nobuQuartile
left a comment
There was a problem hiding this comment.
Functional review: LGTM
|
@AungKoKoLin1997 |
| @api.onchange("company_id") | ||
| def _onchange_company_id_acceptance_label(self): |
There was a problem hiding this comment.
As we talked, please remove it if it is not necessary. You could consider default attribute if you want the default value.
|
Pushed Review comments
Tests
15 tests pass locally (
|
AungKoKoLin1997
left a comment
There was a problem hiding this comment.
Code Review: LGTM
Co-authored-by: Aung Ko Ko Lin (Quartile) <45355704+AungKoKoLin1997@users.noreply.github.com>
|
@kanda999 |
|
@kanda999, could you review this PR? |
The acceptance number was a plain field of the transfer line, so a line received in several lots could only carry one number, and the lots kept none of their own. The detailed operations now hold the number, the transfer line summarizes the numbers of its operations, and each lot keeps the numbers it was received under. A line of a product without tracking is still numbered on the line itself, which is carried over to its first detailed operation; for a tracked product the field is read-only on the line and is entered per lot instead. The numbers of the lot are computed from its operations rather than appended to on receipt, so that a number corrected, or a receipt cancelled after the fact, drops out instead of staying on the lot for good. Transfers can also be searched by acceptance number.
QT7060
Adds an acceptance label that is printed from transfers, three labels per A4 portrait sheet (one per horizontal band).
product_expiry, which the module now depends on.□ 検査中 / ↓ / □ 適合 or □ 不合格) so that it only has to be adjusted; emptying it restores the built-in area, which follows the language of the printing user.Verified on
2rbkk1: 13 tests pass, and the rendered PDF fits eight rows in each 98mm band in both English and Japanese.